r10k 1.5.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. checksums.yaml +15 -0
  2. data/.travis.yml +0 -1
  3. data/CHANGELOG.mkd +63 -0
  4. data/Gemfile +2 -2
  5. data/README.mkd +1 -10
  6. data/doc/dynamic-environments/configuration.mkd +24 -6
  7. data/doc/dynamic-environments/quickstart.mkd +1 -1
  8. data/integration/Gemfile +1 -1
  9. data/integration/configs/pe/centos-5-64mda +25 -0
  10. data/integration/configs/pe/centos-6-64mda +1 -1
  11. data/integration/configs/pe/centos-7-64mda +1 -1
  12. data/integration/configs/pe/debian-6-64mda +1 -1
  13. data/integration/configs/pe/debian-7-64mda +1 -1
  14. data/integration/configs/pe/redhat-6-64mda +1 -1
  15. data/integration/configs/pe/redhat-7-64mda +1 -1
  16. data/integration/configs/pe/sles-11-64mda +1 -1
  17. data/integration/configs/pe/sles-12-64mda +25 -0
  18. data/integration/configs/pe/ubuntu-1004-64mda +1 -1
  19. data/integration/configs/pe/ubuntu-1204-64mda +1 -1
  20. data/integration/configs/pe/ubuntu-1404-64mda +1 -1
  21. data/integration/files/pre-suite/git_config.pp.erb +19 -0
  22. data/integration/pre-suite/01_git_config.rb +5 -17
  23. data/integration/pre-suite/02_pe_r10k.rb +0 -2
  24. data/integration/scripts/README.mkd +86 -0
  25. data/integration/scripts/setup_r10k_env_centos5.sh +23 -0
  26. data/integration/scripts/setup_r10k_env_centos6.sh +23 -0
  27. data/integration/scripts/setup_r10k_env_rhel7.sh +23 -0
  28. data/integration/scripts/setup_r10k_env_sles11.sh +23 -0
  29. data/integration/scripts/setup_r10k_env_sles12.sh +23 -0
  30. data/integration/scripts/setup_r10k_env_ubuntu1004.sh +23 -0
  31. data/integration/scripts/setup_r10k_env_ubuntu1204.sh +23 -0
  32. data/integration/scripts/setup_r10k_env_ubuntu1404.sh +23 -0
  33. data/integration/tests/basic_functionality/negative/neg_invalid_git_provider.rb +44 -0
  34. data/integration/tests/basic_functionality/rugged_git_provider_with_ssh.rb +106 -0
  35. data/integration/tests/basic_functionality/rugged_git_provider_without_ssh.rb +107 -0
  36. data/integration/tests/git_source/git_source_git.rb +1 -1
  37. data/integration/tests/git_source/git_source_ssh.rb +1 -1
  38. data/integration/tests/git_source/negative/neg_git_unauthorized_https.rb +1 -1
  39. data/integration/tests/git_source/negative/neg_git_unauthorized_ssh.rb +1 -1
  40. data/integration/tests/user_scenario/basic_workflow/negative/neg_bad_basedir.rb +1 -1
  41. data/integration/tests/user_scenario/basic_workflow/negative/neg_bad_git_module.rb +8 -2
  42. data/integration/tests/user_scenario/basic_workflow/negative/neg_bad_git_module_ref.rb +1 -1
  43. data/integration/tests/user_scenario/basic_workflow/negative/neg_bad_git_remote.rb +1 -1
  44. data/integration/tests/user_scenario/basic_workflow/negative/neg_branch_name_collision.rb +1 -1
  45. data/integration/tests/user_scenario/basic_workflow/negative/neg_disk_full.rb +5 -1
  46. data/integration/tests/user_scenario/basic_workflow/negative/neg_duplicate_module_names.rb +3 -3
  47. data/integration/tests/user_scenario/basic_workflow/negative/neg_invalid_puppet_file.rb +1 -1
  48. data/integration/tests/user_scenario/basic_workflow/negative/neg_read_only.rb +1 -1
  49. data/integration/tests/user_scenario/basic_workflow/single_env_10000_files.rb +4 -0
  50. data/integration/tests/user_scenario/basic_workflow/single_env_large_files.rb +4 -0
  51. data/integration/tests/user_scenario/complex_workflow/multi_env_unamanaged.rb +77 -0
  52. data/integration/tests/user_scenario/complex_workflow/single_env_git_module_update.rb +99 -0
  53. data/lib/r10k/action/deploy/display.rb +0 -1
  54. data/lib/r10k/action/runner.rb +20 -0
  55. data/lib/r10k/cli.rb +0 -3
  56. data/lib/r10k/cli/deploy.rb +0 -3
  57. data/lib/r10k/deployment.rb +1 -7
  58. data/lib/r10k/deployment/config.rb +15 -1
  59. data/lib/r10k/deployment/config/loader.rb +0 -11
  60. data/lib/r10k/environment/git.rb +0 -9
  61. data/lib/r10k/environment/svn.rb +0 -9
  62. data/lib/r10k/errors.rb +0 -3
  63. data/lib/r10k/feature.rb +24 -3
  64. data/lib/r10k/forge/module_release.rb +142 -0
  65. data/lib/r10k/git.rb +32 -11
  66. data/lib/r10k/module/forge.rb +25 -54
  67. data/lib/r10k/module_repository/forge.rb +2 -5
  68. data/lib/r10k/puppetfile.rb +1 -1
  69. data/lib/r10k/util/license.rb +20 -0
  70. data/lib/r10k/version.rb +1 -1
  71. data/lib/shared/puppet_forge/connection.rb +62 -0
  72. data/lib/shared/puppet_forge/error.rb +28 -0
  73. data/lib/shared/puppet_forge/tar.rb +10 -0
  74. data/lib/shared/puppet_forge/tar/mini.rb +81 -0
  75. data/lib/shared/puppet_forge/unpacker.rb +68 -0
  76. data/lib/shared/puppet_forge/v3.rb +13 -0
  77. data/lib/shared/puppet_forge/v3/module.rb +66 -0
  78. data/lib/shared/puppet_forge/v3/module_release.rb +73 -0
  79. data/lib/shared/puppet_forge/version.rb +3 -0
  80. data/r10k.gemspec +2 -2
  81. data/r10k.yaml.example +80 -5
  82. data/spec/spec_helper.rb +0 -12
  83. data/spec/unit/action/runner_spec.rb +53 -0
  84. data/spec/unit/deployment/config/loader_spec.rb +5 -19
  85. data/spec/unit/deployment/config_spec.rb +8 -0
  86. data/spec/unit/deployment_spec.rb +1 -1
  87. data/spec/unit/forge/module_release_spec.rb +130 -0
  88. data/spec/unit/git_spec.rb +5 -5
  89. data/spec/unit/module/forge_spec.rb +66 -116
  90. data/spec/unit/module_repository/forge_spec.rb +35 -5
  91. data/spec/unit/module_spec.rb +10 -10
  92. data/spec/unit/puppet_forge/connection_spec.rb +41 -0
  93. data/spec/unit/puppet_forge/tar/mini_spec.rb +87 -0
  94. data/spec/unit/puppet_forge/tar_spec.rb +9 -0
  95. data/spec/unit/puppet_forge/unpacker_spec.rb +59 -0
  96. data/spec/unit/puppet_forge/v3/module_release_spec.rb +68 -0
  97. data/spec/unit/puppet_forge/v3/module_spec.rb +67 -0
  98. metadata +48 -112
  99. data/lib/r10k/cli/environment.rb +0 -28
  100. data/lib/r10k/cli/environment/deploy.rb +0 -26
  101. data/lib/r10k/cli/environment/list.rb +0 -23
  102. data/lib/r10k/cli/environment/stale.rb +0 -24
  103. data/lib/r10k/cli/module.rb +0 -29
  104. data/lib/r10k/cli/module/deploy.rb +0 -27
  105. data/lib/r10k/cli/module/list.rb +0 -24
  106. data/lib/r10k/cli/synchronize.rb +0 -27
  107. data/lib/r10k/deployment/basedir.rb +0 -4
  108. data/lib/r10k/deployment/environment.rb +0 -20
  109. data/lib/r10k/deployment/source.rb +0 -37
  110. data/lib/r10k/git/commit.rb +0 -22
  111. data/lib/r10k/git/head.rb +0 -36
  112. data/lib/r10k/git/ref.rb +0 -66
  113. data/lib/r10k/git/remote_head.rb +0 -19
  114. data/lib/r10k/git/repository.rb +0 -158
  115. data/lib/r10k/git/tag.rb +0 -29
  116. data/lib/r10k/git/working_dir.rb +0 -186
  117. data/lib/r10k/registry.rb +0 -4
  118. data/lib/r10k/semver.rb +0 -128
  119. data/lib/r10k/task.rb +0 -12
  120. data/lib/r10k/task/deployment.rb +0 -164
  121. data/lib/r10k/task/environment.rb +0 -31
  122. data/lib/r10k/task/module.rb +0 -19
  123. data/lib/r10k/task/puppetfile.rb +0 -102
  124. data/lib/r10k/task_runner.rb +0 -72
  125. data/lib/r10k/util/monkey_patches.rb +0 -11
  126. data/spec/fixtures/vcr/cassettes/R10K_ModuleRepository_Forge/and_the_expected_version_is_latest/can_fetch_all_versions_of_a_given_module.yml +0 -187
  127. data/spec/fixtures/vcr/cassettes/R10K_ModuleRepository_Forge/and_the_expected_version_is_latest/can_fetch_the_latest_version_of_a_given_module.yml +0 -187
  128. data/spec/fixtures/vcr/cassettes/R10K_ModuleRepository_Forge/and_the_expected_version_is_latest/ignores_deleted_releases.yml +0 -190
  129. data/spec/fixtures/vcr/cassettes/R10K_ModuleRepository_Forge/it_handles_errors_from_forgeapi_puppetlabs_com/raises_an_error_for_a_non-existant_module.yml +0 -34
  130. data/spec/fixtures/vcr/cassettes/R10K_Module_Forge/and_the_expected_version_is_latest/sets_the_expected_version_based_on_the_latest_forge_version.yml +0 -103
  131. data/spec/shared-examples/git-ref.rb +0 -49
  132. data/spec/unit/deployment/environment_spec.rb +0 -25
  133. data/spec/unit/git/commit_spec.rb +0 -34
  134. data/spec/unit/git/head_spec.rb +0 -22
  135. data/spec/unit/git/ref_spec.rb +0 -45
  136. data/spec/unit/git/repository_spec.rb +0 -34
  137. data/spec/unit/git/tag_spec.rb +0 -32
  138. data/spec/unit/git/working_dir_spec.rb +0 -122
  139. data/spec/unit/util/monkey_patches_spec.rb +0 -20
@@ -93,7 +93,7 @@ step 'Update the "r10k" Config'
93
93
  create_remote_file(master, r10k_config_path, r10k_conf)
94
94
 
95
95
  step 'Install "puppetlabs-xinetd" Module'
96
- on(master, puppet('module install puppetlabs-xinetd'))
96
+ on(master, puppet('module install puppetlabs-xinetd --modulepath /opt/puppet/share/puppet/modules'))
97
97
 
98
98
  step 'Install and Configure "git-daemon" service'
99
99
  on(master, puppet('apply'), :stdin => git_daemon_xinetd_enable_manifest)
@@ -8,7 +8,7 @@ env_path = on(master, puppet('config print environmentpath')).stdout.rstrip
8
8
  git_control_remote = 'git@github.com:puppetlabs/codemgmt-92.git'
9
9
  git_provider = ENV['GIT_PROVIDER'] || 'shellgit'
10
10
 
11
- jenkins_key_path = File.file?('/var/lib/jenkins/.ssh/id_rsa-jenkins') ? '/var/lib/jenkins/.ssh/id_rsa-jenkins' : File.expand_path('~/.ssh/id_rsa-jenkins')
11
+ jenkins_key_path = File.file?("#{ENV['HOME']}/.ssh/id_rsa") ? "#{ENV['HOME']}/.ssh/id_rsa" : File.expand_path('~/.ssh/id_rsa-jenkins')
12
12
  ssh_private_key_path = '/root/.ssh/id_rsa-jenkins'
13
13
  ssh_config_path = '/root/.ssh/config'
14
14
 
@@ -23,7 +23,7 @@ sources:
23
23
  CONF
24
24
 
25
25
  #Verification
26
- error_message_regex = /ERROR\]/m
26
+ error_message_regex = /ERROR.*Unable to determine current branches for Git source 'broken'/m
27
27
 
28
28
  #Teardown
29
29
  teardown do
@@ -36,7 +36,7 @@ Host github.com
36
36
  CONF
37
37
 
38
38
  #Verification
39
- error_message_regex = /ERROR\].*Permission denied/m
39
+ error_message_regex = /ERROR.*Unable to determine current branches for Git source 'broken'/m
40
40
 
41
41
  #Teardown
42
42
  teardown do
@@ -23,7 +23,7 @@ sources:
23
23
  CONF
24
24
 
25
25
  #Verification
26
- error_message_regex = /could not create leading directories of.*File name too long/
26
+ error_message_regex = /ERROR.*(Failed to make directory|could not create leading directories of.*File name too long)/m
27
27
 
28
28
  #Teardown
29
29
  teardown do
@@ -3,6 +3,10 @@ require 'r10k_utils'
3
3
  require 'master_manipulator'
4
4
  test_name 'CODEMGMT-42 - C59229 - Attempt to Deploy Environment with Non-existent Git Module'
5
5
 
6
+ if ENV['GIT_PROVIDER'] == 'shellgit'
7
+ skip_test('Skipping test because of known failure RK-80.')
8
+ end
9
+
6
10
  #Init
7
11
  master_certname = on(master, puppet('config', 'print', 'certname')).stdout.rstrip
8
12
  git_environments_path = '/root/environments'
@@ -16,7 +20,7 @@ PUPPETFILE
16
20
  puppet_file_path = File.join(git_environments_path, 'Puppetfile')
17
21
 
18
22
  #Verification
19
- error_message_regex = /ERROR\] Couldn't update git cache/
23
+ error_message_regex = /ERROR.*uses the SSH protocol but no private key was given/
20
24
 
21
25
  #Teardown
22
26
  teardown do
@@ -36,5 +40,7 @@ git_add_commit_push(master, 'production', 'Update Puppetfile.', git_environments
36
40
  #Tests
37
41
  step 'Attempt to Deploy via r10k'
38
42
  on(master, 'r10k deploy environment -v -p', :acceptable_exit_codes => 1) do |result|
39
- assert_match(error_message_regex, result.stderr, 'Expected message not found!')
43
+ expect_failure('Expected to fail due to RK-80') do
44
+ assert_no_match(error_message_regex, result.stderr, 'Expected message not found!')
45
+ end
40
46
  end
@@ -18,7 +18,7 @@ PUPPETFILE
18
18
  puppet_file_path = File.join(git_environments_path, 'Puppetfile')
19
19
 
20
20
  #Verification
21
- error_message_regex = /Cannot check out Git ref 'does_not_exist'/
21
+ error_message_regex = /ERROR.*Unable to sync repo to unresolvable ref/
22
22
 
23
23
  #Teardown
24
24
  teardown do
@@ -22,7 +22,7 @@ sources:
22
22
  CONF
23
23
 
24
24
  #Verification
25
- error_message_regex = /ERROR\] Couldn't update git cache for \/does\/not\/exist/
25
+ error_message_regex = /ERROR.*Unable to determine current branches for Git source 'broken'/
26
26
 
27
27
  #Teardown
28
28
  teardown do
@@ -35,7 +35,7 @@ sources:
35
35
  CONF
36
36
 
37
37
  #Verification
38
- error_message_regex = /ERROR\] Environment collision/
38
+ error_message_regex = /ERROR.*Environment collision/
39
39
 
40
40
  #Teardown
41
41
  teardown do
@@ -2,6 +2,10 @@ require 'git_utils'
2
2
  require 'r10k_utils'
3
3
  test_name 'CODEMGMT-86 - C59265 - Attempt to Deploy Environment to Disk with Insufficient Free Space'
4
4
 
5
+ if fact_on(master, 'osfamily') == 'RedHat' and fact_on(master, "operatingsystemmajrelease").to_i < 6
6
+ skip_test('This version of EL is not supported by this test case!')
7
+ end
8
+
5
9
  #Init
6
10
  git_repo_path = '/git_repos'
7
11
  git_repo_name = 'environments'
@@ -33,7 +37,7 @@ sources:
33
37
  CONF
34
38
 
35
39
  #Verification
36
- error_message_regex = /ERROR\].*No space left on device/m
40
+ error_message_regex = /ERROR.*No space left on device/m
37
41
 
38
42
  #Teardown
39
43
  teardown do
@@ -8,7 +8,7 @@ git_environments_path = '/root/environments'
8
8
  last_commit = git_last_commit(master, git_environments_path)
9
9
 
10
10
  #Verification
11
- error_message_regex = /ERROR\]/
11
+ error_message_regex = /ERROR.*undefined method `full_module_name' for nil:NilClass/
12
12
 
13
13
  #File
14
14
  puppet_file = <<-PUPPETFILE
@@ -38,8 +38,8 @@ git_add_commit_push(master, 'production', 'Add modules.', git_environments_path)
38
38
 
39
39
  #Tests
40
40
  step 'Attempt to Deploy via r10k'
41
- on(master, 'r10k deploy environment -v -p', :acceptable_exit_codes => 0) do |result|
41
+ on(master, 'r10k deploy environment -v -p', :acceptable_exit_codes => 1) do |result|
42
42
  expect_failure('Expected to fail due to CODEMGMT-71') do
43
- assert_match(error_message_regex, result.stderr, 'Expected message not found!')
43
+ assert_no_match(error_message_regex, result.stderr, 'Expected message not found!')
44
44
  end
45
45
  end
@@ -14,7 +14,7 @@ puppet_file = <<-PUPPETFILE
14
14
  PUPPETFILE
15
15
 
16
16
  #Verification
17
- error_message_regex = /ERROR\].*syntax error/m
17
+ error_message_regex = /ERROR.*Failed to evaluate/m
18
18
 
19
19
  #Teardown
20
20
  teardown do
@@ -27,7 +27,7 @@ sources:
27
27
  CONF
28
28
 
29
29
  #Verification
30
- error_message_regex = /ERROR\].*Read-only file system/m
30
+ error_message_regex = /ERROR.*Read-only file system/m
31
31
 
32
32
  #Teardown
33
33
  teardown do
@@ -3,6 +3,10 @@ require 'r10k_utils'
3
3
  require 'master_manipulator'
4
4
  test_name 'CODEMGMT-62 - C59239 - Single Environment with 10,000 Files'
5
5
 
6
+ if fact_on(master, 'osfamily') == 'RedHat' and fact_on(master, "operatingsystemmajrelease").to_i < 6
7
+ skip_test('This version of EL is not supported by this test case!')
8
+ end
9
+
6
10
  #Init
7
11
  master_certname = on(master, puppet('config', 'print', 'certname')).stdout.rstrip
8
12
  environment_path = on(master, puppet('config', 'print', 'environmentpath')).stdout.rstrip
@@ -3,6 +3,10 @@ require 'r10k_utils'
3
3
  require 'master_manipulator'
4
4
  test_name 'CODEMGMT-62 - C59242 - Single Environment with Large Binary Files'
5
5
 
6
+ if fact_on(master, 'osfamily') == 'RedHat' and fact_on(master, "operatingsystemmajrelease").to_i < 6
7
+ skip_test('This version of EL is not supported by this test case!')
8
+ end
9
+
6
10
  #Init
7
11
  master_certname = on(master, puppet('config', 'print', 'certname')).stdout.rstrip
8
12
  environment_path = on(master, puppet('config', 'print', 'environmentpath')).stdout.rstrip
@@ -0,0 +1,77 @@
1
+ require 'git_utils'
2
+ require 'r10k_utils'
3
+ require 'master_manipulator'
4
+ test_name 'CODEMGMT-155 - C62421 - Multiple Environments with Existing Unmanaged Environments'
5
+
6
+ #Init
7
+ master_certname = on(master, puppet('config', 'print', 'certname')).stdout.rstrip
8
+ environment_path = on(master, puppet('config', 'print', 'environmentpath')).stdout.rstrip
9
+
10
+ git_environments_path = '/root/environments'
11
+ last_commit = git_last_commit(master, git_environments_path)
12
+
13
+ local_files_root_path = ENV['FILES'] || 'files'
14
+ helloworld_module_path = File.join(local_files_root_path, 'modules', 'helloworld')
15
+
16
+ #Manifest
17
+ site_pp_path = File.join(git_environments_path, 'manifests', 'site.pp')
18
+ site_pp = create_site_pp(master_certname, ' include helloworld')
19
+
20
+ #Verification
21
+ notify_message_prod_env_regex = /I am in the production environment/
22
+ notify_message_test_env_regex = /I am in the test environment/
23
+ removal_message_test_env_regex = /Removing unmanaged path.*test/
24
+ error_message_regex = /Could not retrieve catalog from remote server/
25
+
26
+ #Teardown
27
+ teardown do
28
+ clean_up_r10k(master, last_commit, git_environments_path)
29
+ end
30
+
31
+ #Setup
32
+ step 'Checkout "production" Branch'
33
+ git_on(master, 'checkout production', git_environments_path)
34
+
35
+ step 'Copy "helloworld" Module to "production" Environment Git Repo'
36
+ scp_to(master, helloworld_module_path, File.join(git_environments_path, "site", 'helloworld'))
37
+
38
+ step 'Inject New "site.pp" to the "production" Environment'
39
+ inject_site_pp(master, site_pp_path, site_pp)
40
+
41
+ step 'Push Changes'
42
+ git_add_commit_push(master, 'production', 'Update site.pp and add module.', git_environments_path)
43
+
44
+ #Tests
45
+ step 'Deploy "production" Environment via r10k'
46
+ on(master, 'r10k deploy environment -v')
47
+
48
+ agents.each do |agent|
49
+ step 'Run Puppet Agent'
50
+ on(agent, puppet('agent', '--test', '--environment production'), :acceptable_exit_codes => 2) do |result|
51
+ assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!')
52
+ assert_match(notify_message_prod_env_regex, result.stdout, 'Expected message not found!')
53
+ end
54
+ end
55
+
56
+ step 'Create Unmanaged "test" Environment'
57
+ on(master, "cp -r #{environment_path}/production #{environment_path}/test")
58
+
59
+ agents.each do |agent|
60
+ step 'Run Puppet Agent Against "test" Environment'
61
+ on(agent, puppet('agent', '--test', '--environment test'), :acceptable_exit_codes => 2) do |result|
62
+ assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!')
63
+ assert_match(notify_message_test_env_regex, result.stdout, 'Expected message not found!')
64
+ end
65
+ end
66
+
67
+ step 'Re-deploy Environments via r10k'
68
+ on(master, 'r10k deploy environment -v') do |result|
69
+ assert_match(removal_message_test_env_regex, result.output, 'Unexpected error was detected!')
70
+ end
71
+
72
+ agents.each do |agent|
73
+ step 'Run Puppet Agent Against "test" Environment'
74
+ on(agent, puppet('agent', '--test', '--environment test'), :acceptable_exit_codes => 1) do |result|
75
+ assert_match(error_message_regex, result.stderr, 'Expected message not found!')
76
+ end
77
+ end
@@ -0,0 +1,99 @@
1
+ require 'git_utils'
2
+ require 'r10k_utils'
3
+ require 'master_manipulator'
4
+ test_name 'CODEMGMT-155 - C64588 - Single Environment with Git Module Using a Branch Reference where Updates Occur After Initial Deploy'
5
+
6
+ #Init
7
+ master_certname = on(master, puppet('config', 'print', 'certname')).stdout.rstrip
8
+ environment_path = on(master, puppet('config', 'print', 'environmentpath')).stdout.rstrip
9
+
10
+ git_repo_parent_path = '/git_repos'
11
+ git_repo_module_name = 'helloworld_module'
12
+ git_remote_module_path = File.join(git_repo_parent_path, "#{git_repo_module_name}.git")
13
+ git_module_clone_path = '/root/helloworld'
14
+
15
+ git_environments_path = '/root/environments'
16
+ last_commit = git_last_commit(master, git_environments_path)
17
+
18
+ local_files_root_path = ENV['FILES'] || 'files'
19
+ helloworld_module_path = File.join(local_files_root_path, 'modules', 'helloworld')
20
+
21
+ #Verification
22
+ notify_original_message_regex = /I am in the production environment/
23
+ notify_updated_message = 'A totally different message'
24
+ notify_updated_message_regex = /#{notify_updated_message}/
25
+
26
+ #File
27
+ puppet_file = <<-PUPPETFILE
28
+ mod 'test/helloworld',
29
+ :git => '#{git_remote_module_path}',
30
+ :ref => 'master'
31
+ PUPPETFILE
32
+
33
+ puppet_file_path = File.join(git_environments_path, 'Puppetfile')
34
+
35
+ updated_helloworld_manifest = <<-MANIFEST
36
+ class helloworld {
37
+ notify { "Hello world!": message => "#{notify_updated_message}"}
38
+ }
39
+ MANIFEST
40
+
41
+ #Manifest
42
+ site_pp_path = File.join(git_environments_path, 'manifests', 'site.pp')
43
+ site_pp = create_site_pp(master_certname, ' include helloworld')
44
+
45
+ #Teardown
46
+ teardown do
47
+ step 'Remove Git Repo and Clone for Module'
48
+ on(master, "rm -rf #{git_remote_module_path} #{git_module_clone_path}")
49
+
50
+ clean_up_r10k(master, last_commit, git_environments_path)
51
+ end
52
+
53
+ #Setup
54
+ step 'Create Bare Git Repo and Clone'
55
+ on(master, "mkdir -p #{git_remote_module_path} #{git_module_clone_path}")
56
+ git_init_bare_repo_and_clone(master, git_repo_parent_path, git_repo_module_name, git_module_clone_path)
57
+
58
+ step 'Copy "helloworld" Module to Git Repo'
59
+ scp_to(master, "#{helloworld_module_path}/manifests", git_module_clone_path)
60
+
61
+ step 'Push Changes for Module Git Repo to Remote'
62
+ git_add_commit_push(master, 'master', 'Add module.', git_module_clone_path)
63
+
64
+ step 'Inject New "site.pp" to the "production" Environment'
65
+ inject_site_pp(master, site_pp_path, site_pp)
66
+
67
+ step 'Create "Puppetfile" for the "production" Environment'
68
+ create_remote_file(master, puppet_file_path, puppet_file)
69
+
70
+ step 'Push Changes to Environments Git Repo Remote'
71
+ git_add_commit_push(master, 'production', 'Update site.pp and add module.', git_environments_path)
72
+
73
+ #Tests
74
+ step 'Deploy "production" Environment via r10k'
75
+ on(master, 'r10k deploy environment -v -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_original_message_regex, result.stdout, 'Expected message not found!')
82
+ end
83
+ end
84
+
85
+ step 'Update "helloworld" Module and Push Changes'
86
+ create_remote_file(master, "#{git_module_clone_path}/manifests/init.pp", updated_helloworld_manifest)
87
+ on(master, "chmod -R 644 #{git_module_clone_path}")
88
+ git_add_commit_push(master, 'master', 'Update module.', git_module_clone_path)
89
+
90
+ step 'Deploy "production" Environment Again via r10k'
91
+ on(master, 'r10k deploy environment -v -p')
92
+
93
+ agents.each do |agent|
94
+ step 'Run Puppet Agent'
95
+ on(agent, puppet('agent', '--test', '--environment production'), :acceptable_exit_codes => 2) do |result|
96
+ assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!')
97
+ assert_match(notify_updated_message_regex, result.stdout, 'Expected message not found!')
98
+ end
99
+ end
@@ -1,4 +1,3 @@
1
- require 'r10k/util/monkey_patches'
2
1
  require 'r10k/util/setopts'
3
2
  require 'r10k/deployment'
4
3
  require 'r10k/logging'
@@ -1,6 +1,13 @@
1
+ require 'r10k/logging'
2
+ require 'r10k/errors'
3
+ require 'r10k/util/license'
4
+ require 'shared/puppet_forge/connection'
5
+
1
6
  module R10K
2
7
  module Action
3
8
  class Runner
9
+ include R10K::Logging
10
+
4
11
  def initialize(opts, argv, klass)
5
12
  @opts = opts
6
13
  @argv = argv
@@ -30,6 +37,19 @@ module R10K
30
37
  end
31
38
 
32
39
  def setup_settings
40
+ setup_authorization
41
+ end
42
+
43
+ def setup_authorization
44
+ begin
45
+ license = R10K::Util::License.load
46
+
47
+ if license.respond_to?(:authorization_token)
48
+ PuppetForge::Connection.authorization = license.authorization_token
49
+ end
50
+ rescue R10K::Error => e
51
+ logger.warn e.message
52
+ end
33
53
  end
34
54
  end
35
55
  end
@@ -48,9 +48,6 @@ module R10K::CLI
48
48
  end
49
49
 
50
50
  require 'r10k/cli/deploy'
51
- require 'r10k/cli/environment'
52
- require 'r10k/cli/module'
53
- require 'r10k/cli/synchronize'
54
51
  require 'r10k/cli/puppetfile'
55
52
  require 'r10k/cli/version'
56
53
  require 'r10k/cli/help'
@@ -2,9 +2,6 @@ require 'r10k/cli'
2
2
  require 'r10k/deployment'
3
3
  require 'r10k/deployment/config'
4
4
 
5
- require 'r10k/task_runner'
6
- require 'r10k/task/deployment'
7
-
8
5
  require 'r10k/action/cri_runner'
9
6
  require 'r10k/action/deploy'
10
7
 
@@ -11,9 +11,6 @@ module R10K
11
11
  # @api private
12
12
  class Deployment
13
13
 
14
- require 'r10k/deployment/environment'
15
- require 'r10k/deployment/basedir'
16
- require 'r10k/deployment/source'
17
14
  require 'r10k/deployment/config'
18
15
 
19
16
  # Generate a deployment object based on a config
@@ -37,9 +34,6 @@ module R10K
37
34
  sources.each(&:preload!)
38
35
  end
39
36
 
40
- # @deprecated
41
- alias fetch_sources preload!
42
-
43
37
  # Lazily load all sources
44
38
  #
45
39
  # This instantiates the @_sources instance variable, but should not be
@@ -94,7 +88,7 @@ module R10K
94
88
  msg = ""
95
89
  msg << "Environment collision at #{environment.path} between "
96
90
  msg << "#{source.name}:#{environment.name} and #{osource.name}:#{oenvironment.name}"
97
- raise R10K::R10KError, msg
91
+ raise R10K::Error, msg
98
92
  else
99
93
  hash[environment.path] = [source, environment]
100
94
  end