source stringclasses 1
value | repo stringlengths 5 63 | repo_url stringlengths 24 82 | path stringlengths 5 167 | language stringclasses 1
value | license stringclasses 5
values | stars int64 10 51.4k | ref stringclasses 23
values | size_bytes int64 200 258k | text stringlengths 137 258k |
|---|---|---|---|---|---|---|---|---|---|
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | app/models/chef_deployment_runner.rb | Ruby | mit | 49 | master | 566 | class ChefDeploymentRunner < DeploymentRunner
protected
def deployment_type
:chef
end
def build_ssh_session
put_arguments = dna.merge(:path => "/etc/chef/dna.json")
cookbook_url = instances.first.environment.application.cookbook_clone_url
SshSession.new(*instances.map(&:connectio... |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | app/models/deployment_logger.rb | Ruby | mit | 49 | master | 796 | class DeploymentLogger
attr_reader :log_type, :instances, :logs
def initialize(log_type, *instances)
@log_type = log_type
@instances = instances
init_logs
end
def log(host, stream, data)
log_for(host).append(build_line(stream, data))
end
def system_message(message)
logs.values.each d... |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | app/models/dna.rb | Ruby | mit | 49 | master | 862 | require 'json/pure'
class Dna < HashWithIndifferentAccess
attr_reader :cookbook, :role, :environment, :instance
def initialize(environment, role, cookbook, instance)
super()
@role = role
@cookbook = cookbook
@environment = environment
@instance = instance
set_initial_run_list... |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | app/models/deployment_runner.rb | Ruby | mit | 49 | master | 1,551 | class DeploymentRunner
attr_reader :instances, :logger, :notifier
def initialize(*instances)
@instances = instances
@logger = DeploymentLogger.new(deployment_type, *instances)
@notifier = InstanceNotifier.new(self, *instances)
end
def perform_deployment
notifier.start
handle_result ssh... |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | app/models/instance_notifier.rb | Ruby | mit | 49 | master | 751 | class InstanceNotifier
attr_reader :runner, :instances
def initialize(runner, *instances)
@runner = runner
@instances = instances
end
def successful
notify_all :successful
end
def start
notify_all :start
end
def cancelled(failed_hosts)
notify_some(failed_hosts, :failure, :canc... |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | app/models/cookbook_repository.rb | Ruby | mit | 49 | master | 535 | class CookbookRepository
attr_reader :repo_location
def initialize(repo_location)
@repo_location = repo_location
clone_exists? ? pull : clone
end
def read(file)
File.read(clone_location + "/#{file}")
end
protected
def clone_exists?
File.directory?(clone_location + "/.git")
end
... |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | app/models/ssh_session.rb | Ruby | mit | 49 | master | 1,142 | class SshSession
class ResultSet < Ssh::ResultProxy
attr_accessor :cancelled
def initialize; end
def cancelled?
cancelled
end
def failed_hosts
failures.first.failures.map(&:host)
end
end
attr_reader :commands, :ssh
def initialize(*hosts, &block)
@commands = []
@s... |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | app/models/instance.rb | Ruby | mit | 49 | master | 4,373 | class Instance < ActiveRecord::Base
class << self
def ami_for(instance_size)
%w(m1.small c1.medium).include?(instance_size) ? "ami-b6a241df" : "ami-4aa94a23"
end
def deployment_event_map
{:start => "deploying",
:successful => "deployed",
:failure => "deployment_failed",
... |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | app/controllers/applications_controller.rb | Ruby | mit | 49 | master | 258 | class ApplicationsController < ResourceController::Base
create.flash "Your application has been created."
create.wants.html { redirect_to application_environments_url(object) }
update.wants.html { redirect_to application_environments_url(object) }
end |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | app/controllers/instances_controller.rb | Ruby | mit | 49 | master | 548 | class InstancesController < ResourceController::Base
belongs_to :environment
create.flash { "Your instance(s) are being launched." }
create.wants.html { redirect_to [@environment.application, @environment] }
destroy.wants.html { redirect_to [@environment.application, @environment] }
index.wants.js { render... |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | app/controllers/application_controller.rb | Ruby | mit | 49 | master | 346 | # Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.
class ApplicationController < ActionController::Base
helper :all # include all helpers, all the time
# Scrub sensitive parameters from your log
# filter_parame... |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | app/controllers/environments_controller.rb | Ruby | mit | 49 | master | 286 | class EnvironmentsController < ResourceController::Base
belongs_to :application
create.flash { "Your environment has been created." }
def deployments
load_object
@environment.send_later :deploy
flash[:notice] = "Deploying..."
redirect_to @environment
end
end |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | test/factories.rb | Ruby | mit | 49 | master | 864 | Factory.define :application do |a|
a.name "SomeApp"
a.clone_url "git@github.com/somebody/some-app.git"
a.cookbook_clone_url "git@github.com/somebody/some-app.git"
end
Factory.define :environment do |e|
e.association :application
e.name "production"
e.domain "mysite.com"
end
Factory.define :instance d... |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | test/unit/cookbook_repository_test.rb | Ruby | mit | 49 | master | 1,571 | require File.expand_path('../../test_helper', __FILE__)
class CookbookRepositoryTest < ActiveSupport::TestCase
def setup
Rails.backtrace_cleaner.remove_silencers!
end
context "Initializing a cookbook repository" do
should "clone the repository" do
repo_location = "git@github.com:giraffesoft/cond... |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | test/unit/deployment_runner_test.rb | Ruby | mit | 49 | master | 2,091 | require 'test_helper'
class DeploymentRunnerTest < ActiveSupport::TestCase
def setup
DeploymentRunner.any_instance.stubs(:deployment_type).returns(:chef)
Ec2.mode = :test
@successful = Factory(:running_instance)
@failure = Factory(:running_instance, :dns_name => "failsauce.com")
... |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | test/unit/ssh_session_test.rb | Ruby | mit | 49 | master | 3,479 | require 'test_helper'
class SshSessionTest < ActiveSupport::TestCase
context "Instantiating an ssh recipe" do
setup do
@recipe = SshSession.new("james@myserver.com") do
put "asdf"
run "ls -la"
run "other stuffs"
end
end
should "collect the commands" do
assert_eq... |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | test/unit/log_test.rb | Ruby | mit | 49 | master | 712 | require File.expand_path('../../test_helper', __FILE__)
class LogTest < ActiveSupport::TestCase
context "Appending data to a log" do
setup do
@log = Log.new :log => "something, something else\n"
@log.append "and some other stuff"
end
should "save the appended data to the log" do
expect... |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | test/unit/instance_notifier_test.rb | Ruby | mit | 49 | master | 1,696 | require 'test_helper'
class InstanceNotifierTest < ActiveSupport::TestCase
def setup
Ec2.mode = :test
@success = Factory(:running_instance)
@failure = Factory(:running_instance, :dns_name => "failsauce.com")
@deployer = ChefDeploymentRunner.new
@notifier = InstanceNotifier.new(@deployer, @succ... |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | test/unit/application_test.rb | Ruby | mit | 49 | master | 203 | require File.dirname(__FILE__) + '/../test_helper'
class ApplicationTest < Test::Unit::TestCase
should_validate_presence_of :name, :clone_url, :cookbook_clone_url
should_have_many :environments
end |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | test/unit/ssh_test.rb | Ruby | mit | 49 | master | 4,563 | require File.expand_path('../../test_helper', __FILE__)
require 'test/mocks/ssh_multi_mock'
class SshTest < Test::Unit::TestCase
context "Initializing an SSH session" do
should "tell the ssh session to use all of the hosts" do
Net::SSH::Multi::Session.any_instance.
expects(:use).with("james@myserve... |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | test/unit/ec2_test.rb | Ruby | mit | 49 | master | 3,700 | require File.expand_path('../../test_helper', __FILE__)
class Ec2Test < Test::Unit::TestCase
def setup
Ec2.test_mode_calls = {}
File.stubs(:read).with(Rails.root.to_s + "/config/aws.yml").returns("
test:
:access_key_id: test_access_key_id
:secret_access_key: test_secret_access_key")
end
context "In ... |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | test/unit/environment_test.rb | Ruby | mit | 49 | master | 7,568 | require File.dirname(__FILE__) + '/../test_helper'
class EnvironmentTest < Test::Unit::TestCase
should_belong_to :application
should_have_many :instances
should_validate_presence_of :name
def setup
Ec2.mode = :test
end
context "When a database server has been created" do
setup do
@instance ... |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | test/unit/deployment_logger_test.rb | Ruby | mit | 49 | master | 1,729 | require 'test_helper'
class DeploymentLoggerTest < ActiveSupport::TestCase
def setup
Ec2.mode = :test
end
context "Logging a chef deployment" do
setup do
@instance = Factory(:mysql_master)
@logger = DeploymentLogger.new(:chef, @instance)
end
should "create an instance of chef_log ... |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | test/unit/instance_test.rb | Ruby | mit | 49 | master | 7,853 | require File.dirname(__FILE__) + '/../test_helper'
class InstanceTest < Test::Unit::TestCase
def setup
Ec2.mode = :test
Ec2.test_mode_calls = {}
@instance = Factory(:mysql_master)
@environment = Factory(:environment)
CookbookRepository.any_instance.stubs(:pull)
Coo... |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | test/unit/dna_test.rb | Ruby | mit | 49 | master | 1,613 | require File.expand_path('../../test_helper', __FILE__)
class DnaTest < ActiveSupport::TestCase
context "initializing the dna for an instance type" do
setup do
CookbookRepository.any_instance.stubs(:clone)
CookbookRepository.any_instance.stubs(:pull)
@repo = CookbookRepository.new("doesn't matt... |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | test/unit/address_test.rb | Ruby | mit | 49 | master | 349 | require File.expand_path('../../test_helper', __FILE__)
class AddressTest < ActiveSupport::TestCase
def setup
Ec2.mode = :test
end
context "Creating a new address" do
should "allocate an address via ec2" do
@address = Address.create
assert_equal Ec2.test_responses[:allocate_address], @addre... |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | test/unit/mocks/ssh_multi_mock_test.rb | Ruby | mit | 49 | master | 1,505 | require File.expand_path('../../../test_helper', __FILE__)
require 'test/mocks/ssh_multi_mock'
class SSHMultiMockTestTest < ActiveSupport::TestCase
def setup
@ssh = SSHMultiMock.new
end
context "Using a server" do
setup do
@ssh.use "james@myserver.com"
end
should "record the servers that ... |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | test/mocks/ssh_multi_mock.rb | Ruby | mit | 49 | master | 870 | require 'ostruct'
class SSHMultiMock
attr_reader :servers_used, :responses, :exit_codes
def initialize
@servers_used = []
@responses = {}
@exit_codes = {}
end
def use(host)
@servers_used << host
end
def add_command_response(command, *response)
responses[command] ||= []
respo... |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | lib/tasks/cucumber.rake | Ruby | mit | 49 | master | 532 | $LOAD_PATH.unshift(RAILS_ROOT + '/vendor/plugins/cucumber/lib') if File.directory?(RAILS_ROOT + '/vendor/plugins/cucumber/lib')
begin
require 'cucumber/rake/task'
Cucumber::Rake::Task.new(:features) do |t|
t.fork = true
t.cucumber_opts = ['--format', (ENV['CUCUMBER_FORMAT'] || 'pretty')]
end
task :fea... |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | lib/tasks/jobs.rake | Ruby | mit | 49 | master | 313 | namespace :jobs do
desc "Clear the delayed_job queue."
task :clear => :environment do
Delayed::Job.delete_all
end
desc "Start a delayed_job worker."
task :work => :environment do
Delayed::Worker.new(:min_priority => ENV['MIN_PRIORITY'], :max_priority => ENV['MAX_PRIORITY']).start
end
end |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | features/step_definitions/instance_steps.rb | Ruby | mit | 49 | master | 818 | Given %r{^that I've launched a (.+) instance in (.+)$} do |instance_type, env_name|
Factory(instance_type.to_sym,
:environment => Environment.find_by_name(env_name))
end
When /^I create an? "(.+)" instance$/ do |type|
env = Environment.find_by_name("production")
visit application_environment_url(env... |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | features/step_definitions/webrat_steps.rb | Ruby | mit | 49 | master | 3,721 | require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
# Commonly used webrat steps
# http://github.com/brynary/webrat
Given /^I am on (.+)$/ do |page_name|
visit path_to(page_name)
end
When /^I go to (.+)$/ do |page_name|
visit path_to(page_name)
end
When /^I press "([^\"]*)"$/ d... |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | features/support/env.rb | Ruby | mit | 49 | master | 829 | # Sets up the Rails environment for Cucumber
ENV["RAILS_ENV"] ||= "cucumber"
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
require 'cucumber/rails/world'
# Comment out the next line if you don't want Cucumber Unicode support
require 'cucumber/formatter/unicode'
# Comment out the next ... |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | features/support/paths.rb | Ruby | mit | 49 | master | 883 | module NavigationHelpers
# Maps a name to a path. Used by the
#
# When /^I go to (.+)$/ do |page_name|
#
# step definition in webrat_steps.rb
#
def path_to(page_name)
case page_name
when /the homepage/
'/'
when /the new application page/
new_application_url
when /the app... |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | config/routes.rb | Ruby | mit | 49 | master | 294 | ActionController::Routing::Routes.draw do |map|
map.resources :applications, :has_many => :environments
map.resources :environments, :member => {:deployments => :post} do |e|
e.resources :instances, :member => {:deployments => :post}
end
map.root :controller => "applications"
end |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | config/environment.rb | Ruby | mit | 49 | master | 2,605 | # Be sure to restart your server when you modify this file
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.3.2' unless defined? RAILS_GEM_VERSION
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
... |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | config/environments/cucumber.rb | Ruby | mit | 49 | master | 1,238 | config.cache_classes = true # This must be true for Cucumber to operate correctly!
# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
# Show full error reports and disable caching
config.action_controller.consider_all_requests_local = true
config.action_controller.perform_caching... |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | config/initializers/session_store.rb | Ruby | mit | 49 | master | 802 | # Be sure to restart your server when you modify this file.
# Your secret key for verifying cookie session data integrity.
# If you change this key, all old sessions will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
Act... |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | db/schema.rb | Ruby | mit | 49 | master | 2,639 | # This file is auto-generated from the current state of the database. Instead of editing this file,
# please use the migrations feature of Active Record to incrementally modify your database, and
# then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your data... |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | db/migrate/20090915012643_remove_table_chef_logs.rb | Ruby | mit | 49 | master | 313 | class RemoveTableChefLogs < ActiveRecord::Migration
def self.up
drop_table :chef_logs
end
def self.down
create_table :chef_logs do |t|
t.integer "instance_id"
t.boolean "successful"
t.text "body"
t.datetime "created_at"
t.datetime "updated_at"
end
end
end |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | db/migrate/20090927180320_add_configured_to_instances.rb | Ruby | mit | 49 | master | 214 | class AddConfiguredToInstances < ActiveRecord::Migration
def self.up
add_column :instances, :configured, :boolean, :default => false
end
def self.down
remove_column :instances, :configured
end
end |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | db/migrate/20090825135733_create_addresses.rb | Ruby | mit | 49 | master | 269 | class CreateAddresses < ActiveRecord::Migration
def self.up
create_table :addresses do |t|
t.integer :environment_id
t.integer :instance_id
t.string :address
t.timestamps
end
end
def self.down
drop_table :addresses
end
end |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | db/migrate/20090824142554_create_volumes.rb | Ruby | mit | 49 | master | 325 | class CreateVolumes < ActiveRecord::Migration
def self.up
create_table :volumes do |t|
t.integer :environment_id
t.string :role
t.integer :instance_id
t.integer :size
t.string :zone
t.string :state
t.timestamps
end
end
def self.down
drop_table :volumes
end... |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | db/migrate/20090615003426_add_dns_name_and_private_dns_name_to_instances.rb | Ruby | mit | 49 | master | 306 | class AddDnsNameAndPrivateDnsNameToInstances < ActiveRecord::Migration
def self.up
add_column :instances, :dns_name, :string
add_column :instances, :private_dns_name, :string
end
def self.down
remove_column :instances, :private_dns_name
remove_column :instances, :dns_name
end
end |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | db/migrate/20090613162214_create_environments.rb | Ruby | mit | 49 | master | 262 | class CreateEnvironments < ActiveRecord::Migration
def self.up
create_table :environments, :force => true do |t|
t.integer :application_id
t.string :name
t.timestamps
end
end
def self.down
drop_table :environments
end
end |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | db/migrate/20090823134716_create_deployments.rb | Ruby | mit | 49 | master | 258 | class CreateDeployments < ActiveRecord::Migration
def self.up
create_table :deployments do |t|
t.string :type
t.integer :instance_id
t.text :log
t.timestamps
end
end
def self.down
drop_table :deployments
end
end |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | db/migrate/20090703200434_create_chef_logs.rb | Ruby | mit | 49 | master | 259 | class CreateChefLogs < ActiveRecord::Migration
def self.up
create_table :chef_logs do |t|
t.integer :instance_id
t.boolean :successful
t.text :body
t.timestamps
end
end
def self.down
drop_table :chef_logs
end
end |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | db/migrate/20090824145141_rename_state_to_config_state_on_instances.rb | Ruby | mit | 49 | master | 219 | class RenameStateToConfigStateOnInstances < ActiveRecord::Migration
def self.up
rename_column :instances, :state, :config_state
end
def self.down
rename_column :instances, :config_state, :state
end
end |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | db/migrate/20090823151939_rename_status_to_state_on_instances.rb | Ruby | mit | 49 | master | 202 | class RenameStatusToStateOnInstances < ActiveRecord::Migration
def self.up
rename_column :instances, :status, :state
end
def self.down
rename_column :instances, :state, :status
end
end |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | db/migrate/20090825144710_add_master_id_to_environments.rb | Ruby | mit | 49 | master | 200 | class AddMasterIdToEnvironments < ActiveRecord::Migration
def self.up
add_column :environments, :master_id, :integer
end
def self.down
remove_column :environments, :master_id
end
end |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | db/migrate/20090613170445_create_instances.rb | Ruby | mit | 49 | master | 295 | class CreateInstances < ActiveRecord::Migration
def self.up
create_table :instances, :force => true do |t|
t.integer :environment_id
t.string :size
t.string :zone
t.string :role
t.timestamps
end
end
def self.down
drop_table :instances
end
end |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | db/migrate/20090613020038_create_applications.rb | Ruby | mit | 49 | master | 256 | class CreateApplications < ActiveRecord::Migration
def self.up
create_table :applications, :force => true do |t|
t.string :name
t.string :clone_url
t.timestamps
end
end
def self.down
drop_table :applications
end
end |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | db/migrate/20090615141410_add_cookbook_clone_url_to_applications.rb | Ruby | mit | 49 | master | 225 | class AddCookbookCloneUrlToApplications < ActiveRecord::Migration
def self.up
add_column :applications, :cookbook_clone_url, :string
end
def self.down
remove_column :applications, :cookbook_clone_url
end
end |
github | jamesgolick/conductor | https://github.com/jamesgolick/conductor | db/migrate/20090821154249_create_delayed_jobs.rb | Ruby | mit | 49 | master | 496 | class CreateDelayedJobs < ActiveRecord::Migration
def self.up
create_table :delayed_jobs, :force => true do |table|
table.integer :priority, :default => 0
table.integer :attempts, :default => 0
table.text :handler
table.string :last_error
table.datetime :run_at
table.da... |
github | voxpupuli/puppet-selinux | https://github.com/voxpupuli/puppet-selinux | Rakefile | Ruby | apache-2.0 | 49 | master | 902 | # Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/
begin
require 'voxpupuli/test/rake'
rescue LoadError
# only available if gem group test is installed
end
begin
require 'voxpupuli/acceptance/rake'
rescue LoadError
# only available if gem group acceptanc... |
github | voxpupuli/puppet-selinux | https://github.com/voxpupuli/puppet-selinux | spec/support/acceptance/helper_methods.rb | Ruby | apache-2.0 | 49 | master | 709 | # frozen_string_literal: true
def policy_package_for(hosts)
case hosts[0]['platform']
when %r{^debian}
'selinux-policy-default'
else
'selinux-policy-targeted'
end
end
def have_selinux_ruby_library(hosts)
hosts[0]['platform'] !~ %r{^debian}
end
def ensure_permissive_mode_on(hosts)
hosts.each do |h... |
github | voxpupuli/puppet-selinux | https://github.com/voxpupuli/puppet-selinux | spec/classes/selinux_build_spec.rb | Ruby | apache-2.0 | 49 | master | 743 | # frozen_string_literal: true
require 'spec_helper'
describe 'selinux::build' do
let(:params) { { module_build_root: '/var/lib/puppet/puppet-selinux' } }
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_file('/var/lib/puppet/puppet-selinux').with_ensure('directory') }
it { is_expected.... |
github | voxpupuli/puppet-selinux | https://github.com/voxpupuli/puppet-selinux | spec/classes/selinux_spec.rb | Ruby | apache-2.0 | 49 | master | 3,933 | # frozen_string_literal: true
require 'spec_helper'
describe 'selinux' do
on_supported_os.each do |os, facts|
context "on #{os}" do
let(:facts) do
facts
end
it { is_expected.to contain_class('selinux').without_mode }
it { is_expected.to contain_class('selinux').without_type }
... |
github | voxpupuli/puppet-selinux | https://github.com/voxpupuli/puppet-selinux | spec/classes/selinux_package_spec.rb | Ruby | apache-2.0 | 49 | master | 4,569 | # frozen_string_literal: true
require 'spec_helper'
describe 'selinux' do
context 'package' do
%w[7].each do |majrelease|
context "On RedHat #{majrelease} based OSes" do
let(:facts) do
{
osfamily: 'RedHat',
operatingsystem: 'RedHat',
operatingsystemmaj... |
github | voxpupuli/puppet-selinux | https://github.com/voxpupuli/puppet-selinux | spec/classes/selinux_config_mode_spec.rb | Ruby | apache-2.0 | 49 | master | 4,033 | # frozen_string_literal: true
require 'spec_helper'
describe 'selinux' do
on_supported_os.each do |os, os_facts|
context "on #{os}" do
context 'when in enforcing mode' do
let(:facts) do
override_facts(os_facts, 'os' => { 'selinux' => {
'enabled' => true,
... |
github | voxpupuli/puppet-selinux | https://github.com/voxpupuli/puppet-selinux | spec/classes/selinux_config_type_spec.rb | Ruby | apache-2.0 | 49 | master | 1,527 | # frozen_string_literal: true
require 'spec_helper'
describe 'selinux' do
on_supported_os.each do |os, facts|
context "on #{os}" do
let(:facts) do
facts
end
context 'config' do
context 'invalid type' do
let(:params) { { type: 'invalid' } }
it { is_expected... |
github | voxpupuli/puppet-selinux | https://github.com/voxpupuli/puppet-selinux | spec/acceptance/class_disabled_spec.rb | Ruby | apache-2.0 | 49 | master | 3,533 | # frozen_string_literal: true
require 'spec_helper_acceptance'
describe 'selinux class - mode switching' do
# To exercice autorelabelling.
# The fcontext rules should be portable for this file
test_file_path = '/var/test'
test_file_type = 'var_t'
# On Debian, SELinux is disabled by default. This first step... |
github | voxpupuli/puppet-selinux | https://github.com/voxpupuli/puppet-selinux | spec/acceptance/class_spec.rb | Ruby | apache-2.0 | 49 | master | 5,853 | # frozen_string_literal: true
require 'spec_helper_acceptance'
describe 'selinux class' do
before(:all) do
ensure_permissive_mode_on(hosts)
end
let(:manifest) do
<<-EOS
$have_selinux_ruby_library = #{have_selinux_ruby_library(hosts) ? 'true' : 'false'}
class { 'selinux': mode => 'enforcing... |
github | voxpupuli/puppet-selinux | https://github.com/voxpupuli/puppet-selinux | spec/acceptance/selinux_permissive_spec.rb | Ruby | apache-2.0 | 49 | master | 2,455 | # frozen_string_literal: true
require 'spec_helper_acceptance'
describe 'selinux::permissive define', :requires_selinux_ruby_library do
before(:all) do
ensure_permissive_mode_on(hosts)
end
context 'ensure present for passwd_t' do
let(:result) do
manifest = "selinux::permissive {'passwd_t':}"
... |
github | voxpupuli/puppet-selinux | https://github.com/voxpupuli/puppet-selinux | spec/acceptance/selinux_module_refpolicy_spec.rb | Ruby | apache-2.0 | 49 | master | 1,862 | # frozen_string_literal: true
require 'spec_helper_acceptance'
#
# Test if refpolicy builder can build module A and B
# where module B depends on an interface provided by
# module A.
#
describe 'selinux module refpolicy' do
before(:all) do
ensure_permissive_mode_on(hosts)
end
let(:manifest) do
<<-EOS
... |
github | voxpupuli/puppet-selinux | https://github.com/voxpupuli/puppet-selinux | spec/defines/selinux_permissive_spec.rb | Ruby | apache-2.0 | 49 | master | 2,424 | # frozen_string_literal: true
require 'spec_helper'
describe 'selinux::permissive' do
let(:title) { 'mycontextp' }
on_supported_os.each do |os, facts|
context "on #{os}" do
let(:facts) do
facts
end
context 'SELinux enabled' do
let(:facts) do
override_facts(super()... |
github | voxpupuli/puppet-selinux | https://github.com/voxpupuli/puppet-selinux | spec/defines/selinux_boolean_spec.rb | Ruby | apache-2.0 | 49 | master | 2,204 | # frozen_string_literal: true
require 'spec_helper'
describe 'selinux::boolean' do
let(:title) { 'mybool' }
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:facts) do
os_facts
end
it { is_expected.to contain_selinux__boolean('mybool').that_requires('Anchor[selinux:... |
github | voxpupuli/puppet-selinux | https://github.com/voxpupuli/puppet-selinux | spec/defines/selinux_fcontext_spec.rb | Ruby | apache-2.0 | 49 | master | 2,619 | # frozen_string_literal: true
require 'spec_helper'
describe 'selinux::fcontext' do
let(:title) { 'myfile' }
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:facts) do
override_facts(os_facts, 'os' => { 'selinux' => { 'enabled' => true } })
end
context 'ordering' d... |
github | voxpupuli/puppet-selinux | https://github.com/voxpupuli/puppet-selinux | spec/defines/selinux_exec_restorecon_spec.rb | Ruby | apache-2.0 | 49 | master | 2,761 | # frozen_string_literal: true
require 'spec_helper'
describe 'selinux::exec_restorecon' do
on_supported_os.each do |os, facts|
context "on #{os}" do
let :facts do
facts
end
context 'with resource titled /opt/mycustompath' do
let(:title) { '/opt/mycustompath' }
context... |
github | voxpupuli/puppet-selinux | https://github.com/voxpupuli/puppet-selinux | spec/defines/selinux_fcontext_equivalence_spec.rb | Ruby | apache-2.0 | 49 | master | 1,989 | # frozen_string_literal: true
require 'spec_helper'
describe 'selinux::fcontext::equivalence' do
let(:title) { '/opt/some/path' }
on_supported_os.each do |os, facts|
context "on #{os}" do
let(:facts) do
facts
end
context 'SELinux enabled' do
let(:facts) do
overrid... |
github | voxpupuli/puppet-selinux | https://github.com/voxpupuli/puppet-selinux | spec/defines/selinux_login_spec.rb | Ruby | apache-2.0 | 49 | master | 1,476 | # frozen_string_literal: true
require 'spec_helper'
describe 'selinux::login' do
let(:title) { 'myapp' }
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:facts) do
override_facts(os_facts, 'os' => { 'selinux' => { 'enabled' => true } })
end
context 'ordering' do
... |
github | voxpupuli/puppet-selinux | https://github.com/voxpupuli/puppet-selinux | spec/defines/selinux_module_spec.rb | Ruby | apache-2.0 | 49 | master | 12,306 | # frozen_string_literal: true
require 'spec_helper'
describe 'selinux::module' do
let(:title) { 'mymodule' }
on_supported_os.each do |os, facts|
context "on #{os}" do
let(:facts) do
facts
end
let(:workdir) do
'/var/lib/puppet/puppet-selinux/modules'
end
let(:modu... |
github | voxpupuli/puppet-selinux | https://github.com/voxpupuli/puppet-selinux | spec/defines/selinux_port_spec.rb | Ruby | apache-2.0 | 49 | master | 2,349 | # frozen_string_literal: true
require 'spec_helper'
describe 'selinux::port' do
let(:title) { 'myapp' }
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:facts) do
override_facts(os_facts, 'os' => { 'selinux' => { 'enabled' => true } })
end
context 'ordering' do
... |
github | voxpupuli/puppet-selinux | https://github.com/voxpupuli/puppet-selinux | spec/unit/puppet/provider/selinux_fcontext/semanage_spec.rb | Ruby | apache-2.0 | 49 | master | 7,148 | # frozen_string_literal: true
require 'spec_helper'
# stub the selinux module for tests in travis
module Selinux
def selinux_file_context_local_path
'spec_dummy'
end
def selinux_file_context_path
'spec_policy_dummy'
end
end
semanage_provider = Puppet::Type.type(:selinux_fcontext).provider(:semanage)... |
github | voxpupuli/puppet-selinux | https://github.com/voxpupuli/puppet-selinux | spec/unit/puppet/provider/selinux_fcontext_equivalence/semanage_spec.rb | Ruby | apache-2.0 | 49 | master | 4,053 | # frozen_string_literal: true
require 'spec_helper'
# Provide a dummy Selinux module for the test
module Selinux
def selinux_file_context_subs_path
'spec_dummy'
end
end
semanage_provider = Puppet::Type.type(:selinux_fcontext_equivalence).provider(:semanage)
fc_equiv = Puppet::Type.type(:selinux_fcontext_equi... |
github | voxpupuli/puppet-selinux | https://github.com/voxpupuli/puppet-selinux | spec/unit/puppet/provider/selinux_permissive/semanage_spec.rb | Ruby | apache-2.0 | 49 | master | 2,985 | # frozen_string_literal: true
require 'spec_helper'
semanage_provider = Puppet::Type.type(:selinux_permissive).provider(:semanage)
permissive = Puppet::Type.type(:selinux_permissive)
describe semanage_provider do
let(:semanage_output) do
<<-EOS
Customized Permissive Types
Builtin Permissive Types
... |
github | voxpupuli/puppet-selinux | https://github.com/voxpupuli/puppet-selinux | spec/unit/puppet/type/selinux_fcontext_equivalence_spec.rb | Ruby | apache-2.0 | 49 | master | 633 | # frozen_string_literal: true
require 'spec_helper'
describe Puppet::Type.type(:selinux_fcontext_equivalence) do
on_supported_os.each do |_os, _facts|
context 'Type instance creation' do
it 'fails with invalid path' do
expect { described_class.new(path: 'no_good') }.to raise_error Puppet::Resource... |
github | voxpupuli/puppet-selinux | https://github.com/voxpupuli/puppet-selinux | spec/unit/provider/selinux_port/semanage_spec.rb | Ruby | apache-2.0 | 49 | master | 5,998 | # frozen_string_literal: true
require 'spec_helper'
semanage_provider = Puppet::Type.type(:selinux_port).provider(:semanage)
port = Puppet::Type.type(:selinux_port)
# 23 lines:
ports_helper_output = <<~EOS
policy system_u:object_r:ipp_port_t:s0 8614 8610 tcp
policy system_u:object_r:ipp_port_t:s0 8614 8610 udp
... |
github | voxpupuli/puppet-selinux | https://github.com/voxpupuli/puppet-selinux | spec/unit/provider/selinux_login/semanage_spec.rb | Ruby | apache-2.0 | 49 | master | 4,723 | # frozen_string_literal: true
require 'spec_helper'
LOGIN_HELPER_OUTPUT = <<~EOS
policy root unconfined_u s0-s0:c0.c1023
policy __default__ unconfined_u s0-s0:c0.c1023
policy localuser staff_u s0-s0:c0.c1023
policy %localgroup unconfined_u s0-s0:c0.c1023
policy %localgroup2 unconfined_u s0-s0:c0.c1023
loc... |
github | voxpupuli/puppet-selinux | https://github.com/voxpupuli/puppet-selinux | spec/hosts/examples_spec.rb | Ruby | apache-2.0 | 49 | master | 464 | # frozen_string_literal: true
require 'spec_helper'
describe 'example.com' do
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let(:facts) { os_facts }
Dir['examples/**/*.pp'].each do |example|
context "with #{example}" do
# Would be nicer to override the manifest
... |
github | voxpupuli/puppet-selinux | https://github.com/voxpupuli/puppet-selinux | lib/puppet/provider/selinux_fcontext_equivalence/semanage.rb | Ruby | apache-2.0 | 49 | master | 1,848 | # frozen_string_literal: true
Puppet::Type.type(:selinux_fcontext_equivalence).provide(:semanage) do
desc 'Support managing SELinux custom fcontext definitions via semanage'
defaultfor kernel: 'Linux'
commands semanage: 'semanage'
confine 'os.selinux.enabled': true
mk_resource_methods
def self.parse_fc... |
github | voxpupuli/puppet-selinux | https://github.com/voxpupuli/puppet-selinux | lib/puppet/provider/selinux_fcontext/semanage.rb | Ruby | apache-2.0 | 49 | master | 3,392 | # frozen_string_literal: true
Puppet::Type.type(:selinux_fcontext).provide(:semanage) do
desc 'Support managing SELinux custom fcontext definitions via semanage'
defaultfor kernel: 'Linux'
commands semanage: 'semanage'
# semanage fails when SELinux is disabled, so let's not pretend to work in that situation.... |
github | voxpupuli/puppet-selinux | https://github.com/voxpupuli/puppet-selinux | lib/puppet/provider/selinux_port/semanage.rb | Ruby | apache-2.0 | 49 | master | 4,534 | # frozen_string_literal: true
Puppet::Type.type(:selinux_port).provide(:semanage) do
desc 'Support managing SELinux custom port definitions via semanage'
defaultfor kernel: 'Linux'
# SELinux must be enabled. Is there a way to get a better error message?
confine 'os.selinux.enabled': true
# Determine the ap... |
github | voxpupuli/puppet-selinux | https://github.com/voxpupuli/puppet-selinux | lib/puppet/provider/selinux_permissive/semanage.rb | Ruby | apache-2.0 | 49 | master | 1,761 | # frozen_string_literal: true
Puppet::Type.type(:selinux_permissive).provide(:semanage) do
desc 'Support managing SELinux permissive types definitions via semanage'
defaultfor kernel: 'Linux'
# SELinux must be enabled. Is there a way to get a better error message?
confine 'os.selinux.enabled': true
command... |
github | voxpupuli/puppet-selinux | https://github.com/voxpupuli/puppet-selinux | lib/puppet/provider/selinux_login/semanage.rb | Ruby | apache-2.0 | 49 | master | 5,743 | # frozen_string_literal: true
Puppet::Type.type(:selinux_login).provide(:semanage) do
desc 'Support managing SELinux login definitions via semanage'
defaultfor kernel: 'Linux'
# semanage fails when SELinux is disabled, so let's not pretend to work in that situation.
confine 'os.selinux.enabled': true
# Det... |
github | voxpupuli/puppet-selinux | https://github.com/voxpupuli/puppet-selinux | lib/puppet/type/selinux_port.rb | Ruby | apache-2.0 | 49 | master | 1,469 | # frozen_string_literal: true
Puppet::Type.newtype(:selinux_port) do
@doc = 'Manage SELinux port definitions. You should use selinux::port instead of this directly.'
ensurable
newparam(:title, namevar: true) do
desc 'Should be of the form "protocol_lowport-highport" or the type may misbehave'
end
newp... |
github | voxpupuli/puppet-selinux | https://github.com/voxpupuli/puppet-selinux | lib/puppet/type/selinux_fcontext.rb | Ruby | apache-2.0 | 49 | master | 1,412 | # frozen_string_literal: true
Puppet::Type.newtype(:selinux_fcontext) do
@doc = 'Manage SELinux fcontext definitions. You should use selinux::fcontext instead of this directly.'
ensurable
# The pathspec can't be the namevar because it is completely valid to have
# two with the same spec but different file ty... |
github | voxpupuli/puppet-selinux | https://github.com/voxpupuli/puppet-selinux | lib/puppet/type/selinux_permissive.rb | Ruby | apache-2.0 | 49 | master | 590 | # frozen_string_literal: true
Puppet::Type.newtype(:selinux_permissive) do
@doc = 'Manage SELinux permissive types.'
ensurable
newparam(:seltype) do
desc 'The SELinux type that should be permissive'
isnamevar
end
newparam(:local) do
desc 'A read-only attribue indicating whether the type is loc... |
github | voxpupuli/puppet-selinux | https://github.com/voxpupuli/puppet-selinux | lib/puppet/type/selinux_login.rb | Ruby | apache-2.0 | 49 | master | 1,251 | # frozen_string_literal: true
Puppet::Type.newtype(:selinux_login) do
@doc = 'Manage SELinux login definitions. You should use selinux::login instead of this directly.'
ensurable
newparam(:title, namevar: true) do
desc 'Should be of the form "linuxuser_selinuxuser" or the type may misbehave'
end
newpr... |
github | voxpupuli/puppet-selinux | https://github.com/voxpupuli/puppet-selinux | lib/puppet/type/selinux_fcontext_equivalence.rb | Ruby | apache-2.0 | 49 | master | 1,167 | # frozen_string_literal: true
require 'pathname'
Puppet::Type.newtype(:selinux_fcontext_equivalence) do
@doc = 'Manage SELinux fcontext equivalence definitions. You should use selinux::fcontext instead of this directly.'
ensurable
# The pathspec can't be the namevar because it is completely valid to have
# ... |
github | voxpupuli/puppet-selinux | https://github.com/voxpupuli/puppet-selinux | lib/facter/selinux_python_command.rb | Ruby | apache-2.0 | 49 | master | 541 | # frozen_string_literal: true
# DEPRECATED: Determine the path to python on the system
Facter.add(:selinux_python_command) do
confine 'os.family': 'RedHat'
setcode do
if File.exist? '/usr/libexec/platform-python'
# RHEL 8 / CentOS 8
'/usr/libexec/platform-python'
elsif Facter::Core::Execution.e... |
github | milkcocoa/grape-jbuilder | https://github.com/milkcocoa/grape-jbuilder | grape-jbuilder.gemspec | Ruby | mit | 49 | master | 1,184 | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'grape/jbuilder/version'
Gem::Specification.new do |spec|
spec.name = "grape-jbuilder"
spec.version = Grape::Jbuilder::VERSION
spec.authors = ["Shu Masuda"]
spec.email... |
github | milkcocoa/grape-jbuilder | https://github.com/milkcocoa/grape-jbuilder | Rakefile | Ruby | mit | 49 | master | 227 | require 'bundler/gem_tasks'
require 'rspec/core'
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec) do |spec|
spec.rspec_opts = ['-fd -c']
spec.pattern = FileList['spec/**/*_spec.rb']
end
task default: :spec |
github | milkcocoa/grape-jbuilder | https://github.com/milkcocoa/grape-jbuilder | spec/spec_helper.rb | Ruby | mit | 49 | master | 464 | $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'bundler'
Bundler.setup :default, :test
require 'active_support/core_ext/hash/conversions'
require 'grape/jbuilder'
require 'json_expressions/rspec'
require 'ostruct'
require 'rack/test'
require 'rspe... |
github | milkcocoa/grape-jbuilder | https://github.com/milkcocoa/grape-jbuilder | spec/acceptance/partials_spec.rb | Ruby | mit | 49 | master | 967 | require 'spec_helper'
describe 'Grape::Jbuilder partials' do
let(:app) { Class.new(Grape::API) }
before :each do
app.format :json
app.formatter :json, Grape::Formatter::Jbuilder
app.before do
env['api.tilt.root'] = "#{File.dirname(__FILE__)}/../views"
end
end
it 'proper render partials'... |
github | milkcocoa/grape-jbuilder | https://github.com/milkcocoa/grape-jbuilder | spec/acceptance/templates_spec.rb | Ruby | mit | 49 | master | 1,421 | require 'spec_helper'
describe Grape::Jbuilder do
let(:app) { Class.new(Grape::API) }
before do
app.format :json
app.formatter :json, Grape::Formatter::Jbuilder
app.before do
env['api.tilt.root'] = "#{File.dirname(__FILE__)}/../views"
end
end
it 'should work without jbuilder template' d... |
github | milkcocoa/grape-jbuilder | https://github.com/milkcocoa/grape-jbuilder | spec/grape/formatter/jbuilder_spec.rb | Ruby | mit | 49 | master | 1,591 | require 'spec_helper'
describe Grape::Formatter::Jbuilder do
let(:object) { double }
let(:env) { {'api.endpoint' => endpoint, 'api.tilt.root' => '/tmp'} }
let(:endpoint) { double :options => {} }
let(:renderer) { double :render => '' }
before :each do
Grape::Jbuilder::Renderer.stub :new => rende... |
github | milkcocoa/grape-jbuilder | https://github.com/milkcocoa/grape-jbuilder | spec/grape/jbuilder/renderer_spec.rb | Ruby | mit | 49 | master | 1,249 | require 'spec_helper'
describe Grape::Jbuilder::Renderer do
let(:engine) { double :render => '' }
let(:scope) { double }
before :each do
Tilt.stub :new => engine
end
describe '#render' do
it "raises an error if the view path is nil" do
renderer = Grape::Jbuilder::Renderer.new(nil, 'file')
... |
github | milkcocoa/grape-jbuilder | https://github.com/milkcocoa/grape-jbuilder | lib/grape/jbuilder.rb | Ruby | mit | 49 | master | 202 | require 'grape'
require 'hashie/hash'
require 'jbuilder'
require 'tilt'
require 'tilt/jbuilder.rb'
require 'grape/formatter/jbuilder'
require 'grape/jbuilder/renderer'
require 'grape/jbuilder/version' |
github | milkcocoa/grape-jbuilder | https://github.com/milkcocoa/grape-jbuilder | lib/grape/formatter/jbuilder.rb | Ruby | mit | 49 | master | 775 | module Grape
module Formatter
class Jbuilder
attr_reader :env, :endpoint, :object
def self.call(object, env)
new(object, env).call
end
def initialize(object, env)
@object, @env = object, env
@endpoint = env['api.endpoint']
end
def call
ret... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.