r10k 2.0.3 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/CHANGELOG.mkd +150 -0
- data/README.mkd +10 -1
- data/doc/dynamic-environments/configuration.mkd +31 -0
- data/doc/dynamic-environments/quickstart.mkd +33 -79
- data/doc/faq.mkd +67 -0
- data/doc/git/providers.mkd +37 -0
- data/doc/puppetfile.mkd +73 -0
- data/integration/lib/r10k_utils.rb +47 -2
- data/integration/pre-suite/01_git_config.rb +9 -8
- data/integration/pre-suite/02_pe_r10k.rb +5 -8
- data/integration/scripts/setup_r10k_env_centos5.sh +1 -1
- data/integration/scripts/setup_r10k_env_centos6.sh +1 -1
- data/integration/scripts/setup_r10k_env_rhel7.sh +1 -1
- data/integration/scripts/setup_r10k_env_sles11.sh +1 -1
- data/integration/scripts/setup_r10k_env_sles12.sh +1 -1
- data/integration/scripts/setup_r10k_env_ubuntu1004.sh +1 -1
- data/integration/scripts/setup_r10k_env_ubuntu1204.sh +1 -1
- data/integration/scripts/setup_r10k_env_ubuntu1404.sh +1 -1
- data/integration/test_run_scripts/all_tests-rugged-pe-centos6.sh +1 -1
- data/integration/test_run_scripts/all_tests-rugged-pe-rhel7.sh +1 -1
- data/integration/test_run_scripts/all_tests-rugged-pe-sles11.sh +1 -1
- data/integration/test_run_scripts/all_tests-rugged-pe-ubuntu1204.sh +1 -1
- data/integration/test_run_scripts/all_tests-rugged-pe-ubuntu1404.sh +1 -1
- data/integration/test_run_scripts/all_tests-shellgit-pe-centos6.sh +1 -1
- data/integration/test_run_scripts/all_tests-shellgit-pe-rhel7.sh +1 -1
- data/integration/test_run_scripts/all_tests-shellgit-pe-sles11.sh +1 -1
- data/integration/test_run_scripts/all_tests-shellgit-pe-ubuntu1204.sh +1 -1
- data/integration/test_run_scripts/all_tests-shellgit-pe-ubuntu1404.sh +1 -1
- data/integration/test_run_scripts/basic_functionality/all_tests-pe-centos6.sh +1 -1
- data/integration/test_run_scripts/command_line/all_tests-pe-centos6.sh +1 -1
- data/integration/test_run_scripts/git_source/all_tests-pe-centos6.sh +1 -1
- data/integration/test_run_scripts/user_scenario/basic_workflow/all_tests-pe-centos6.sh +1 -1
- data/integration/test_run_scripts/user_scenario/complex_workflow/all_tests-pe-centos6.sh +1 -1
- data/integration/tests/basic_functionality/install_pe_only_module_with_puppetfile.rb +83 -0
- data/integration/tests/basic_functionality/negative/attempt_to_install_peonly_module_without_license.rb +71 -0
- data/integration/tests/basic_functionality/negative/neg_deploy_with_invalid_r10k_yaml.rb +7 -2
- data/integration/tests/basic_functionality/negative/neg_deploy_with_missing_r10k_yaml.rb +3 -2
- data/integration/tests/basic_functionality/negative/neg_invalid_git_provider.rb +3 -2
- data/integration/tests/basic_functionality/negative/negative_bad_proxy.rb +56 -0
- data/integration/tests/basic_functionality/proxy_specified_in_configuration.rb +103 -0
- data/integration/tests/basic_functionality/proxy_with_puppetfile.rb +61 -0
- data/integration/tests/basic_functionality/rugged_git_provider_with_ssh.rb +2 -1
- data/integration/tests/basic_functionality/rugged_git_provider_without_ssh.rb +2 -1
- data/integration/tests/command_line/deploy_env_without_mod_update.rb +3 -2
- data/integration/tests/command_line/negative/neg_deploy_env_with_module_update.rb +3 -2
- data/integration/tests/command_line/negative/neg_invalid_cli_dep_flag.rb +2 -1
- data/integration/tests/command_line/negative/neg_invalid_cli_env_flag.rb +2 -1
- data/integration/tests/command_line/negative/neg_invalid_cmd_line_arg.rb +3 -4
- data/integration/tests/git_source/git_source_git.rb +7 -2
- data/integration/tests/git_source/git_source_ssh.rb +3 -2
- data/integration/tests/git_source/git_source_submodule.rb +2 -1
- data/integration/tests/git_source/negative/neg_git_broken_remote.rb +2 -1
- data/integration/tests/git_source/negative/neg_git_unauthorized_https.rb +2 -1
- data/integration/tests/git_source/negative/neg_git_unauthorized_ssh.rb +2 -1
- data/integration/tests/git_source/negative/neg_git_unicode_branch.rb +2 -1
- data/integration/tests/user_scenario/basic_workflow/multi_env_1000_branches.rb +3 -3
- data/integration/tests/user_scenario/basic_workflow/multi_env_custom_forge_git_module.rb +2 -1
- data/integration/tests/user_scenario/basic_workflow/multi_env_custom_forge_git_module_static.rb +9 -5
- data/integration/tests/user_scenario/basic_workflow/multi_env_hiera.rb +9 -2
- data/integration/tests/user_scenario/basic_workflow/multi_env_multi_source.rb +2 -1
- data/integration/tests/user_scenario/basic_workflow/multi_source_custom_forge_git_module.rb +2 -1
- data/integration/tests/user_scenario/basic_workflow/negative/neg_bad_basedir.rb +2 -1
- data/integration/tests/user_scenario/basic_workflow/negative/neg_bad_forge_module.rb +7 -2
- data/integration/tests/user_scenario/basic_workflow/negative/neg_bad_git_module.rb +3 -4
- data/integration/tests/user_scenario/basic_workflow/negative/neg_bad_git_module_ref.rb +2 -1
- data/integration/tests/user_scenario/basic_workflow/negative/neg_bad_git_remote.rb +2 -1
- data/integration/tests/user_scenario/basic_workflow/negative/neg_branch_name_collision.rb +2 -1
- data/integration/tests/user_scenario/basic_workflow/negative/neg_disk_full.rb +2 -1
- data/integration/tests/user_scenario/basic_workflow/negative/neg_duplicate_module_names.rb +10 -4
- data/integration/tests/user_scenario/basic_workflow/negative/neg_inaccessible_forge.rb +9 -2
- data/integration/tests/user_scenario/basic_workflow/negative/neg_invalid_env_name.rb +2 -1
- data/integration/tests/user_scenario/basic_workflow/negative/neg_invalid_puppet_file.rb +2 -1
- data/integration/tests/user_scenario/basic_workflow/negative/neg_module_specified_at_deleted_release.rb +7 -2
- data/integration/tests/user_scenario/basic_workflow/negative/neg_read_only.rb +2 -1
- data/integration/tests/user_scenario/basic_workflow/negative/neg_specify_deleted_forge_module.rb +9 -2
- data/integration/tests/user_scenario/basic_workflow/single_env_10000_files.rb +2 -1
- data/integration/tests/user_scenario/basic_workflow/single_env_custom_forge_git_module.rb +2 -1
- data/integration/tests/user_scenario/basic_workflow/single_env_custom_forge_module.rb +2 -1
- data/integration/tests/user_scenario/basic_workflow/single_env_custom_module.rb +2 -1
- data/integration/tests/user_scenario/basic_workflow/single_env_large_files.rb +2 -1
- data/integration/tests/user_scenario/basic_workflow/single_env_module_already_installed.rb +2 -1
- data/integration/tests/user_scenario/basic_workflow/single_env_module_last_release_deleted.rb +2 -1
- data/integration/tests/user_scenario/basic_workflow/single_env_non-existent_base_dir.rb +2 -1
- data/integration/tests/user_scenario/basic_workflow/single_env_purge_unmanaged_modules.rb +3 -2
- data/integration/tests/user_scenario/basic_workflow/single_env_switch_forge_git_module.rb +3 -2
- data/integration/tests/user_scenario/basic_workflow/single_env_unicode_paths.rb +2 -1
- data/integration/tests/user_scenario/basic_workflow/single_env_upgrade_forge_mod_revert_change.rb +4 -3
- data/integration/tests/user_scenario/complex_workflow/multi_env_add_change_remove.rb +3 -2
- data/integration/tests/user_scenario/complex_workflow/multi_env_remove_re-add.rb +4 -3
- data/integration/tests/user_scenario/complex_workflow/multi_env_unamanaged.rb +3 -2
- data/integration/tests/user_scenario/complex_workflow/single_env_git_module_update.rb +3 -2
- data/lib/r10k/action/base.rb +31 -0
- data/lib/r10k/action/deploy/deploy_helpers.rb +34 -0
- data/lib/r10k/action/deploy/display.rb +57 -75
- data/lib/r10k/action/deploy/environment.rb +52 -15
- data/lib/r10k/action/deploy/module.rb +13 -18
- data/lib/r10k/action/puppetfile/check.rb +8 -18
- data/lib/r10k/action/puppetfile/install.rb +13 -27
- data/lib/r10k/action/puppetfile/purge.rb +8 -17
- data/lib/r10k/action/runner.rb +39 -3
- data/lib/r10k/cli.rb +1 -3
- data/lib/r10k/cli/deploy.rb +3 -1
- data/lib/r10k/cli/puppetfile.rb +2 -2
- data/lib/r10k/deployment.rb +8 -6
- data/lib/r10k/deployment/config.rb +18 -65
- data/lib/r10k/environment/base.rb +19 -0
- data/lib/r10k/environment/git.rb +9 -0
- data/lib/r10k/environment/svn.rb +9 -0
- data/lib/r10k/forge/module_release.rb +21 -14
- data/lib/r10k/git.rb +6 -0
- data/lib/r10k/git/alternates.rb +20 -6
- data/lib/r10k/git/cache.rb +1 -1
- data/lib/r10k/git/rugged/bare_repository.rb +5 -0
- data/lib/r10k/git/rugged/base_repository.rb +6 -20
- data/lib/r10k/git/rugged/credentials.rb +66 -0
- data/lib/r10k/git/rugged/thin_repository.rb +16 -11
- data/lib/r10k/git/rugged/working_repository.rb +15 -7
- data/lib/r10k/git/shellgit/bare_repository.rb +9 -4
- data/lib/r10k/git/shellgit/thin_repository.rb +8 -10
- data/lib/r10k/git/stateful_repository.rb +1 -1
- data/lib/r10k/initializers.rb +55 -0
- data/lib/r10k/module.rb +1 -0
- data/lib/r10k/module/base.rb +3 -2
- data/lib/r10k/module/forge.rb +14 -6
- data/lib/r10k/module/local.rb +36 -0
- data/lib/r10k/module/metadata_file.rb +2 -2
- data/lib/r10k/puppetfile.rb +1 -1
- data/lib/r10k/settings.rb +86 -0
- data/lib/r10k/settings/collection.rb +118 -0
- data/lib/r10k/settings/definition.rb +112 -0
- data/lib/r10k/settings/enum_definition.rb +22 -0
- data/lib/r10k/settings/loader.rb +96 -0
- data/lib/r10k/settings/uri_definition.rb +19 -0
- data/lib/r10k/util/subprocess/runner/windows.rb +4 -4
- data/lib/r10k/version.rb +1 -1
- data/r10k.gemspec +2 -3
- data/spec/fixtures/unit/puppetfile/argument-error/Puppetfile +1 -0
- data/spec/fixtures/unit/util/subprocess/{posix/runner → runner}/no-execute.sh +0 -0
- data/spec/integration/git/rugged/thin_repository_spec.rb +2 -2
- data/spec/integration/git/rugged/working_repository_spec.rb +9 -0
- data/spec/integration/git/shellgit/thin_repository_spec.rb +2 -2
- data/spec/integration/git/stateful_repository_spec.rb +1 -1
- data/spec/r10k-mocks/mock_config.rb +10 -13
- data/spec/r10k-mocks/mock_env.rb +8 -0
- data/spec/shared-examples/deploy-actions.rb +69 -0
- data/spec/shared-examples/puppetfile-action.rb +17 -0
- data/spec/unit/action/cri_runner_spec.rb +3 -1
- data/spec/unit/action/deploy/deploy_helpers_spec.rb +38 -0
- data/spec/unit/action/deploy/display_spec.rb +31 -0
- data/spec/unit/action/deploy/environment_spec.rb +56 -0
- data/spec/unit/action/deploy/module_spec.rb +17 -0
- data/spec/unit/action/puppetfile/check_spec.rb +26 -0
- data/spec/unit/action/puppetfile/install_spec.rb +68 -0
- data/spec/unit/action/puppetfile/purge_spec.rb +19 -0
- data/spec/unit/action/runner_spec.rb +10 -9
- data/spec/unit/deployment/config_spec.rb +20 -44
- data/spec/unit/deployment_spec.rb +1 -1
- data/spec/unit/environment/git_spec.rb +20 -0
- data/spec/unit/environment/svn_spec.rb +20 -0
- data/spec/unit/forge/module_release_spec.rb +6 -3
- data/spec/unit/git/alternates_spec.rb +38 -12
- data/spec/unit/git/cache_spec.rb +4 -0
- data/spec/unit/git/rugged/credentials_spec.rb +74 -0
- data/spec/unit/initializers_spec.rb +68 -0
- data/spec/unit/module/base_spec.rb +2 -2
- data/spec/unit/module/forge_spec.rb +11 -3
- data/spec/unit/module/metadata_file_spec.rb +0 -1
- data/spec/unit/puppetfile_spec.rb +11 -0
- data/spec/unit/settings/collection_spec.rb +122 -0
- data/spec/unit/settings/definition_spec.rb +78 -0
- data/spec/unit/settings/enum_definition_spec.rb +20 -0
- data/spec/unit/{deployment/config → settings}/loader_spec.rb +50 -2
- data/spec/unit/settings/uri_definition_spec.rb +23 -0
- data/spec/unit/settings_spec.rb +151 -0
- data/spec/unit/util/subprocess/runner/posix_spec.rb +1 -1
- data/spec/unit/util/subprocess/runner/windows_spec.rb +7 -0
- metadata +53 -90
- data/lib/r10k/deployment/config/loader.rb +0 -59
- data/lib/shared/puppet/module_tool/metadata.rb +0 -197
- data/lib/shared/puppet_forge/connection.rb +0 -64
- data/lib/shared/puppet_forge/connection/connection_failure.rb +0 -26
- data/lib/shared/puppet_forge/error.rb +0 -41
- data/lib/shared/puppet_forge/tar.rb +0 -10
- data/lib/shared/puppet_forge/tar/mini.rb +0 -81
- data/lib/shared/puppet_forge/unpacker.rb +0 -68
- data/lib/shared/puppet_forge/v3.rb +0 -13
- data/lib/shared/puppet_forge/v3/module.rb +0 -69
- data/lib/shared/puppet_forge/v3/module_release.rb +0 -85
- data/lib/shared/puppet_forge/version.rb +0 -3
- data/spec/unit/puppet/module_tool/metadata_spec.rb +0 -301
- data/spec/unit/puppet_forge/connection/connection_failure_spec.rb +0 -28
- data/spec/unit/puppet_forge/connection_spec.rb +0 -41
- data/spec/unit/puppet_forge/tar/mini_spec.rb +0 -87
- data/spec/unit/puppet_forge/tar_spec.rb +0 -9
- data/spec/unit/puppet_forge/unpacker_spec.rb +0 -59
- data/spec/unit/puppet_forge/v3/module_release_spec.rb +0 -83
- data/spec/unit/puppet_forge/v3/module_spec.rb +0 -75
@@ -0,0 +1,83 @@
|
|
1
|
+
require 'git_utils'
|
2
|
+
require 'r10k_utils'
|
3
|
+
require 'master_manipulator'
|
4
|
+
test_name 'RK-158 - C92362 - Install a PE-only module from forge'
|
5
|
+
|
6
|
+
#Init
|
7
|
+
env_path = on(master, puppet('config print environmentpath')).stdout.rstrip
|
8
|
+
r10k_fqp = get_r10k_fqp(master)
|
9
|
+
master_certname = on(master, puppet('config', 'print', 'certname')).stdout.rstrip
|
10
|
+
|
11
|
+
git_repo_path = '/git_repos'
|
12
|
+
git_repo_name = 'environments'
|
13
|
+
git_control_remote = File.join(git_repo_path, "#{git_repo_name}.git")
|
14
|
+
git_environments_path = '/root/environments'
|
15
|
+
last_commit = git_last_commit(master, git_environments_path)
|
16
|
+
git_provider = ENV['GIT_PROVIDER'] || 'shellgit'
|
17
|
+
|
18
|
+
r10k_config_path = get_r10k_config_file_path(master)
|
19
|
+
r10k_config_bak_path = "#{r10k_config_path}.bak"
|
20
|
+
|
21
|
+
#In-line files
|
22
|
+
r10k_conf = <<-CONF
|
23
|
+
cachedir: '/var/cache/r10k'
|
24
|
+
git:
|
25
|
+
provider: '#{git_provider}'
|
26
|
+
sources:
|
27
|
+
control:
|
28
|
+
basedir: "#{env_path}"
|
29
|
+
remote: "#{git_control_remote}"
|
30
|
+
CONF
|
31
|
+
|
32
|
+
#Manifest
|
33
|
+
site_pp_path = File.join(git_environments_path, 'manifests', 'site.pp')
|
34
|
+
site_pp = create_site_pp(master_certname, ' include peonly')
|
35
|
+
|
36
|
+
# Verification
|
37
|
+
notify_message_regex = /I am in the production environment, this is a PE only module/
|
38
|
+
|
39
|
+
#Teardown
|
40
|
+
teardown do
|
41
|
+
step 'remove license file'
|
42
|
+
on(master, 'rm -f /etc/puppetlabs/license.key')
|
43
|
+
|
44
|
+
step 'Restore Original "r10k" Config'
|
45
|
+
on(master, "mv #{r10k_config_bak_path} #{r10k_config_path}")
|
46
|
+
|
47
|
+
step 'cleanup r10k'
|
48
|
+
clean_up_r10k(master, last_commit, git_environments_path)
|
49
|
+
end
|
50
|
+
|
51
|
+
#Setup
|
52
|
+
step 'Stub the forge'
|
53
|
+
stub_forge_on(master)
|
54
|
+
|
55
|
+
step 'Backup a Valid "r10k" Config'
|
56
|
+
on(master, "mv #{r10k_config_path} #{r10k_config_bak_path}")
|
57
|
+
|
58
|
+
step 'Update the "r10k" Config'
|
59
|
+
create_remote_file(master, r10k_config_path, r10k_conf)
|
60
|
+
|
61
|
+
step 'Download license file from int-resources'
|
62
|
+
curl_on(master, 'http://int-resources.ops.puppetlabs.net/QA_resources/r10k/license.key -o /etc/puppetlabs/license.key')
|
63
|
+
|
64
|
+
step 'Inject New "site.pp" to the "production" Environment'
|
65
|
+
inject_site_pp(master, site_pp_path, site_pp)
|
66
|
+
|
67
|
+
step 'Copy Puppetfile to "production" Environment Git Repo'
|
68
|
+
create_remote_file(master, "#{git_environments_path}/Puppetfile", 'mod "ztr-peonly"')
|
69
|
+
|
70
|
+
step 'Push Changes'
|
71
|
+
git_add_commit_push(master, 'production', 'add Puppetfile', git_environments_path)
|
72
|
+
|
73
|
+
#Tests
|
74
|
+
step 'Deploy "production" Environment via r10k'
|
75
|
+
on(master, "#{r10k_fqp} deploy environment -p")
|
76
|
+
|
77
|
+
agents.each do |agent|
|
78
|
+
step "Run Puppet Agent"
|
79
|
+
on(agent, puppet('agent', '--test', '--environment production'), :acceptable_exit_codes => 2) do |result|
|
80
|
+
assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!')
|
81
|
+
assert_match(notify_message_regex, result.stdout, 'Expected message not found!')
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'git_utils'
|
2
|
+
require 'r10k_utils'
|
3
|
+
require 'master_manipulator'
|
4
|
+
test_name 'RK-158 - C92361 - Attempt to install a PE-only module with no license file'
|
5
|
+
|
6
|
+
#Init
|
7
|
+
env_path = on(master, puppet('config print environmentpath')).stdout.rstrip
|
8
|
+
r10k_fqp = get_r10k_fqp(master)
|
9
|
+
master_certname = on(master, puppet('config', 'print', 'certname')).stdout.rstrip
|
10
|
+
|
11
|
+
git_repo_path = '/git_repos'
|
12
|
+
git_repo_name = 'environments'
|
13
|
+
git_control_remote = File.join(git_repo_path, "#{git_repo_name}.git")
|
14
|
+
git_environments_path = '/root/environments'
|
15
|
+
last_commit = git_last_commit(master, git_environments_path)
|
16
|
+
git_provider = ENV['GIT_PROVIDER'] || 'shellgit'
|
17
|
+
|
18
|
+
r10k_config_path = get_r10k_config_file_path(master)
|
19
|
+
r10k_config_bak_path = "#{r10k_config_path}.bak"
|
20
|
+
|
21
|
+
#In-line files
|
22
|
+
r10k_conf = <<-CONF
|
23
|
+
cachedir: '/var/cache/r10k'
|
24
|
+
git:
|
25
|
+
provider: '#{git_provider}'
|
26
|
+
sources:
|
27
|
+
control:
|
28
|
+
basedir: "#{env_path}"
|
29
|
+
remote: "#{git_control_remote}"
|
30
|
+
CONF
|
31
|
+
|
32
|
+
#Manifest
|
33
|
+
site_pp_path = File.join(git_environments_path, 'manifests', 'site.pp')
|
34
|
+
site_pp = create_site_pp(master_certname, ' include peonly')
|
35
|
+
|
36
|
+
# Verification
|
37
|
+
error_message_regex = /You must have a valid Puppet Enterprise license on this node in order to download ztr-peonly/
|
38
|
+
|
39
|
+
#Teardown
|
40
|
+
teardown do
|
41
|
+
step 'Restore Original "r10k" Config'
|
42
|
+
on(master, "mv #{r10k_config_bak_path} #{r10k_config_path}")
|
43
|
+
|
44
|
+
step 'cleanup r10k'
|
45
|
+
clean_up_r10k(master, last_commit, git_environments_path)
|
46
|
+
end
|
47
|
+
|
48
|
+
#Setup
|
49
|
+
step 'Stub the forge'
|
50
|
+
stub_forge_on(master)
|
51
|
+
|
52
|
+
step 'Backup a Valid "r10k" Config'
|
53
|
+
on(master, "mv #{r10k_config_path} #{r10k_config_bak_path}")
|
54
|
+
|
55
|
+
step 'Update the "r10k" Config'
|
56
|
+
create_remote_file(master, r10k_config_path, r10k_conf)
|
57
|
+
|
58
|
+
step 'Inject New "site.pp" to the "production" Environment'
|
59
|
+
inject_site_pp(master, site_pp_path, site_pp)
|
60
|
+
|
61
|
+
step 'Copy Puppetfile to "production" Environment Git Repo'
|
62
|
+
create_remote_file(master, "#{git_environments_path}/Puppetfile", 'mod "ztr-peonly"')
|
63
|
+
|
64
|
+
step 'Push Changes'
|
65
|
+
git_add_commit_push(master, 'production', 'add Puppetfile', git_environments_path)
|
66
|
+
|
67
|
+
#Test
|
68
|
+
step 'Deploy "production" Environment via r10k'
|
69
|
+
on(master, "#{r10k_fqp} deploy environment -p", :acceptable_exit_codes => [0,1]) do |result|
|
70
|
+
assert_match(error_message_regex, result.stderr, 'Expected error message was not observed!')
|
71
|
+
end
|
@@ -8,6 +8,7 @@ env_path = on(master, puppet('config print environmentpath')).stdout.rstrip
|
|
8
8
|
git_repo_path = '/git_repos'
|
9
9
|
git_control_remote = File.join(git_repo_path, 'environments.git')
|
10
10
|
git_provider = ENV['GIT_PROVIDER'] || 'shellgit'
|
11
|
+
r10k_fqp = get_r10k_fqp(master)
|
11
12
|
|
12
13
|
r10k_config_path = get_r10k_config_file_path(master)
|
13
14
|
r10k_config_bak_path = "#{r10k_config_path}.bak"
|
@@ -24,7 +25,11 @@ sources:
|
|
24
25
|
CONF
|
25
26
|
|
26
27
|
#Verification
|
27
|
-
|
28
|
+
if get_puppet_version(master) < 4.0
|
29
|
+
error_message_regex = /ERROR.*can\'t\ convert\ nil\ into\ String/
|
30
|
+
else
|
31
|
+
error_message_regex = /ERROR.* -> no implicit conversion of nil into String/
|
32
|
+
end
|
28
33
|
|
29
34
|
#Teardown
|
30
35
|
teardown do
|
@@ -41,6 +46,6 @@ create_remote_file(master, r10k_config_path, r10k_conf)
|
|
41
46
|
|
42
47
|
#Tests
|
43
48
|
step 'Attempt to Deploy via r10k'
|
44
|
-
on(master,
|
49
|
+
on(master, "#{r10k_fqp} deploy environment -v", :acceptable_exit_codes => 1) do |result|
|
45
50
|
assert_match(error_message_regex, result.stderr, 'Expected message not found!')
|
46
51
|
end
|
@@ -6,9 +6,10 @@ test_name 'CODEMGMT-84 - C59270 - Attempt to Deploy with Missing r10k Configurat
|
|
6
6
|
#Init
|
7
7
|
r10k_config_path = get_r10k_config_file_path(master)
|
8
8
|
r10k_config_bak_path = "#{r10k_config_path}.bak"
|
9
|
+
r10k_fqp = get_r10k_fqp(master)
|
9
10
|
|
10
11
|
#Verification
|
11
|
-
error_message_regex = /
|
12
|
+
error_message_regex = /No configuration file given, no config file found in current directory, and no global config present/
|
12
13
|
|
13
14
|
#Teardown
|
14
15
|
teardown do
|
@@ -22,6 +23,6 @@ on(master, "mv #{r10k_config_path} #{r10k_config_bak_path}")
|
|
22
23
|
|
23
24
|
#Tests
|
24
25
|
step 'Attempt to Deploy via r10k'
|
25
|
-
on(master,
|
26
|
+
on(master, "#{r10k_fqp} deploy environment -v", :acceptable_exit_codes => 8) do |result|
|
26
27
|
assert_match(error_message_regex, result.stderr, 'Expected message not found!')
|
27
28
|
end
|
@@ -6,6 +6,7 @@ env_path = on(master, puppet('config print environmentpath')).stdout.rstrip
|
|
6
6
|
git_repo_path = '/git_repos'
|
7
7
|
git_control_remote = File.join(git_repo_path, 'environments.git')
|
8
8
|
git_provider = 'invalid'
|
9
|
+
r10k_fqp = get_r10k_fqp(master)
|
9
10
|
|
10
11
|
r10k_config_path = get_r10k_config_file_path(master)
|
11
12
|
r10k_config_bak_path = "#{r10k_config_path}.bak"
|
@@ -22,7 +23,7 @@ sources:
|
|
22
23
|
CONF
|
23
24
|
|
24
25
|
#Verification
|
25
|
-
error_message_regex = /
|
26
|
+
error_message_regex = /should be one of.*not .invalid./
|
26
27
|
|
27
28
|
#Teardown
|
28
29
|
teardown do
|
@@ -39,6 +40,6 @@ create_remote_file(master, r10k_config_path, r10k_conf)
|
|
39
40
|
|
40
41
|
#Tests
|
41
42
|
step 'Attempt to Deploy via r10k'
|
42
|
-
on(master,
|
43
|
+
on(master, "#{r10k_fqp} deploy environment -v", :acceptable_exit_codes => 8) do |result|
|
43
44
|
assert_match(error_message_regex, result.stderr, 'Expected message not found!')
|
44
45
|
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'git_utils'
|
2
|
+
require 'r10k_utils'
|
3
|
+
require 'master_manipulator'
|
4
|
+
test_name 'RK-110 - C88671 - Specify a bad proxy to r10k'
|
5
|
+
|
6
|
+
confine(:to, :platform => ['el', 'sles'])
|
7
|
+
|
8
|
+
#Init
|
9
|
+
master_platform = fact_on(master, 'osfamily')
|
10
|
+
r10k_fqp = get_r10k_fqp(master)
|
11
|
+
|
12
|
+
case master_platform
|
13
|
+
when 'RedHat'
|
14
|
+
pkg_manager = 'yum'
|
15
|
+
when 'Suse'
|
16
|
+
pkg_manager = 'zypper'
|
17
|
+
end
|
18
|
+
|
19
|
+
install_squid = "#{pkg_manager} install -y squid"
|
20
|
+
remove_squid = "#{pkg_manager} remove -y squid"
|
21
|
+
|
22
|
+
#Verification
|
23
|
+
error_regex = /Unable to connect to.*getaddrinfo: Name or service not known/i
|
24
|
+
|
25
|
+
#Teardown
|
26
|
+
teardown do
|
27
|
+
step 'Remove puppetfile'
|
28
|
+
on(master, 'rm -rf modules/')
|
29
|
+
on(master, 'rm Puppetfile')
|
30
|
+
|
31
|
+
step 'Remove Squid'
|
32
|
+
on(master, puppet("apply -e 'service {'squid' : ensure => stopped}'"))
|
33
|
+
on(master, remove_squid)
|
34
|
+
|
35
|
+
step 'Remove proxy environment variable'
|
36
|
+
master.delete_env_var('http_proxy', 'http://notarealhostname:3128')
|
37
|
+
end
|
38
|
+
|
39
|
+
step 'Install and configure squid proxy'
|
40
|
+
on(master, install_squid)
|
41
|
+
master.add_env_var('http_proxy', "http://notarealhostname:3128")
|
42
|
+
|
43
|
+
step 'turn off the firewall'
|
44
|
+
on(master, puppet("apply -e 'service {'iptables' : ensure => stopped}'"))
|
45
|
+
|
46
|
+
step 'start squid proxy'
|
47
|
+
on(master, puppet("apply -e 'service {'squid' : ensure => running}'"))
|
48
|
+
|
49
|
+
#Tests
|
50
|
+
step 'make a puppetfile'
|
51
|
+
create_remote_file(master, "Puppetfile", 'mod "puppetlabs/motd"')
|
52
|
+
|
53
|
+
step 'Use a r10k puppetfile'
|
54
|
+
on(master, "#{r10k_fqp} puppetfile install", {:acceptable_exit_codes => [0,1,2]}) do |result|
|
55
|
+
assert_match(error_regex, result.stderr, 'Did not see the expected error')
|
56
|
+
end
|
@@ -0,0 +1,103 @@
|
|
1
|
+
require 'git_utils'
|
2
|
+
require 'r10k_utils'
|
3
|
+
require 'master_manipulator'
|
4
|
+
test_name 'RK-110 - C87652 - Specify the proxy in the r10k.yaml'
|
5
|
+
|
6
|
+
confine(:to, :platform => ['el', 'sles'])
|
7
|
+
|
8
|
+
#Init
|
9
|
+
master_platform = fact_on(master, 'osfamily')
|
10
|
+
env_path = on(master, puppet('config print environmentpath')).stdout.rstrip
|
11
|
+
r10k_fqp = get_r10k_fqp(master)
|
12
|
+
|
13
|
+
git_repo_path = '/git_repos'
|
14
|
+
git_repo_name = 'environments'
|
15
|
+
git_control_remote = File.join(git_repo_path, "#{git_repo_name}.git")
|
16
|
+
git_environments_path = '/root/environments'
|
17
|
+
last_commit = git_last_commit(master, git_environments_path)
|
18
|
+
git_provider = ENV['GIT_PROVIDER']
|
19
|
+
|
20
|
+
local_files_root_path = ENV['FILES'] || 'files'
|
21
|
+
|
22
|
+
git_manifest_template_path = File.join(local_files_root_path, 'pre-suite', 'git_config.pp.erb')
|
23
|
+
git_manifest = ERB.new(File.read(git_manifest_template_path)).result(binding)
|
24
|
+
|
25
|
+
r10k_config_path = get_r10k_config_file_path(master)
|
26
|
+
r10k_config_bak_path = "#{r10k_config_path}.bak"
|
27
|
+
|
28
|
+
case master_platform
|
29
|
+
when 'RedHat'
|
30
|
+
pkg_manager = 'yum'
|
31
|
+
when 'Suse'
|
32
|
+
pkg_manager = 'zypper'
|
33
|
+
end
|
34
|
+
|
35
|
+
install_squid = "#{pkg_manager} install -y squid"
|
36
|
+
remove_squid = "#{pkg_manager} remove -y squid"
|
37
|
+
squid_log = "/var/log/squid/access.log"
|
38
|
+
|
39
|
+
#In-line files
|
40
|
+
r10k_conf = <<-CONF
|
41
|
+
cachedir: '/var/cache/r10k'
|
42
|
+
git:
|
43
|
+
provider: '#{git_provider}'
|
44
|
+
sources:
|
45
|
+
control:
|
46
|
+
basedir: "#{env_path}"
|
47
|
+
remote: "#{git_control_remote}"
|
48
|
+
forge:
|
49
|
+
proxy: "http://#{master.hostname}:3128"
|
50
|
+
CONF
|
51
|
+
|
52
|
+
#Verification
|
53
|
+
squid_log_regex = /CONNECT forgeapi.puppetlabs.com:443/
|
54
|
+
|
55
|
+
#Teardown
|
56
|
+
teardown do
|
57
|
+
step 'Restore "git" Package'
|
58
|
+
on(master, puppet('apply'), :stdin => git_manifest, :acceptable_exit_codes => [0,2])
|
59
|
+
|
60
|
+
step 'Restore Original "r10k" Config'
|
61
|
+
on(master, "mv #{r10k_config_bak_path} #{r10k_config_path}")
|
62
|
+
|
63
|
+
clean_up_r10k(master, last_commit, git_environments_path)
|
64
|
+
|
65
|
+
step 'Remove Squid'
|
66
|
+
on(master, puppet("apply -e 'service {'squid' : ensure => stopped}'"))
|
67
|
+
on(master, remove_squid)
|
68
|
+
end
|
69
|
+
|
70
|
+
#Setup
|
71
|
+
step 'Backup Current "r10k" Config'
|
72
|
+
on(master, "mv #{r10k_config_path} #{r10k_config_bak_path}")
|
73
|
+
|
74
|
+
step 'Update the "r10k" Config'
|
75
|
+
create_remote_file(master, r10k_config_path, r10k_conf)
|
76
|
+
|
77
|
+
step 'Checkout "production" Branch'
|
78
|
+
git_on(master, 'checkout production', git_environments_path)
|
79
|
+
|
80
|
+
step 'Copy Puppetfile to "production" Environment Git Repo'
|
81
|
+
create_remote_file(master, "#{git_environments_path}/Puppetfile", 'mod "puppetlabs/motd"')
|
82
|
+
|
83
|
+
step 'Push Changes'
|
84
|
+
git_add_commit_push(master, 'production', 'add Puppetfile', git_environments_path)
|
85
|
+
|
86
|
+
step 'Install and configure squid proxy'
|
87
|
+
on(master, install_squid)
|
88
|
+
|
89
|
+
step 'turn off the firewall'
|
90
|
+
on(master, puppet("apply -e 'service {'iptables' : ensure => stopped}'"))
|
91
|
+
|
92
|
+
step 'start squid proxy'
|
93
|
+
on(master, puppet("apply -e 'service {'squid' : ensure => running}'"))
|
94
|
+
|
95
|
+
#Tests
|
96
|
+
step 'Deploy "production" Environment via r10k'
|
97
|
+
on(master, "#{r10k_fqp} deploy environment -p")
|
98
|
+
|
99
|
+
step 'Read the squid logs'
|
100
|
+
on(master, "cat #{squid_log}") do |result|
|
101
|
+
assert_match(squid_log_regex, result.stdout, 'Proxy logs did not indicate use of the proxy.')
|
102
|
+
end
|
103
|
+
|