r10k 2.0.3 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (198) hide show
  1. checksums.yaml +8 -8
  2. data/CHANGELOG.mkd +150 -0
  3. data/README.mkd +10 -1
  4. data/doc/dynamic-environments/configuration.mkd +31 -0
  5. data/doc/dynamic-environments/quickstart.mkd +33 -79
  6. data/doc/faq.mkd +67 -0
  7. data/doc/git/providers.mkd +37 -0
  8. data/doc/puppetfile.mkd +73 -0
  9. data/integration/lib/r10k_utils.rb +47 -2
  10. data/integration/pre-suite/01_git_config.rb +9 -8
  11. data/integration/pre-suite/02_pe_r10k.rb +5 -8
  12. data/integration/scripts/setup_r10k_env_centos5.sh +1 -1
  13. data/integration/scripts/setup_r10k_env_centos6.sh +1 -1
  14. data/integration/scripts/setup_r10k_env_rhel7.sh +1 -1
  15. data/integration/scripts/setup_r10k_env_sles11.sh +1 -1
  16. data/integration/scripts/setup_r10k_env_sles12.sh +1 -1
  17. data/integration/scripts/setup_r10k_env_ubuntu1004.sh +1 -1
  18. data/integration/scripts/setup_r10k_env_ubuntu1204.sh +1 -1
  19. data/integration/scripts/setup_r10k_env_ubuntu1404.sh +1 -1
  20. data/integration/test_run_scripts/all_tests-rugged-pe-centos6.sh +1 -1
  21. data/integration/test_run_scripts/all_tests-rugged-pe-rhel7.sh +1 -1
  22. data/integration/test_run_scripts/all_tests-rugged-pe-sles11.sh +1 -1
  23. data/integration/test_run_scripts/all_tests-rugged-pe-ubuntu1204.sh +1 -1
  24. data/integration/test_run_scripts/all_tests-rugged-pe-ubuntu1404.sh +1 -1
  25. data/integration/test_run_scripts/all_tests-shellgit-pe-centos6.sh +1 -1
  26. data/integration/test_run_scripts/all_tests-shellgit-pe-rhel7.sh +1 -1
  27. data/integration/test_run_scripts/all_tests-shellgit-pe-sles11.sh +1 -1
  28. data/integration/test_run_scripts/all_tests-shellgit-pe-ubuntu1204.sh +1 -1
  29. data/integration/test_run_scripts/all_tests-shellgit-pe-ubuntu1404.sh +1 -1
  30. data/integration/test_run_scripts/basic_functionality/all_tests-pe-centos6.sh +1 -1
  31. data/integration/test_run_scripts/command_line/all_tests-pe-centos6.sh +1 -1
  32. data/integration/test_run_scripts/git_source/all_tests-pe-centos6.sh +1 -1
  33. data/integration/test_run_scripts/user_scenario/basic_workflow/all_tests-pe-centos6.sh +1 -1
  34. data/integration/test_run_scripts/user_scenario/complex_workflow/all_tests-pe-centos6.sh +1 -1
  35. data/integration/tests/basic_functionality/install_pe_only_module_with_puppetfile.rb +83 -0
  36. data/integration/tests/basic_functionality/negative/attempt_to_install_peonly_module_without_license.rb +71 -0
  37. data/integration/tests/basic_functionality/negative/neg_deploy_with_invalid_r10k_yaml.rb +7 -2
  38. data/integration/tests/basic_functionality/negative/neg_deploy_with_missing_r10k_yaml.rb +3 -2
  39. data/integration/tests/basic_functionality/negative/neg_invalid_git_provider.rb +3 -2
  40. data/integration/tests/basic_functionality/negative/negative_bad_proxy.rb +56 -0
  41. data/integration/tests/basic_functionality/proxy_specified_in_configuration.rb +103 -0
  42. data/integration/tests/basic_functionality/proxy_with_puppetfile.rb +61 -0
  43. data/integration/tests/basic_functionality/rugged_git_provider_with_ssh.rb +2 -1
  44. data/integration/tests/basic_functionality/rugged_git_provider_without_ssh.rb +2 -1
  45. data/integration/tests/command_line/deploy_env_without_mod_update.rb +3 -2
  46. data/integration/tests/command_line/negative/neg_deploy_env_with_module_update.rb +3 -2
  47. data/integration/tests/command_line/negative/neg_invalid_cli_dep_flag.rb +2 -1
  48. data/integration/tests/command_line/negative/neg_invalid_cli_env_flag.rb +2 -1
  49. data/integration/tests/command_line/negative/neg_invalid_cmd_line_arg.rb +3 -4
  50. data/integration/tests/git_source/git_source_git.rb +7 -2
  51. data/integration/tests/git_source/git_source_ssh.rb +3 -2
  52. data/integration/tests/git_source/git_source_submodule.rb +2 -1
  53. data/integration/tests/git_source/negative/neg_git_broken_remote.rb +2 -1
  54. data/integration/tests/git_source/negative/neg_git_unauthorized_https.rb +2 -1
  55. data/integration/tests/git_source/negative/neg_git_unauthorized_ssh.rb +2 -1
  56. data/integration/tests/git_source/negative/neg_git_unicode_branch.rb +2 -1
  57. data/integration/tests/user_scenario/basic_workflow/multi_env_1000_branches.rb +3 -3
  58. data/integration/tests/user_scenario/basic_workflow/multi_env_custom_forge_git_module.rb +2 -1
  59. data/integration/tests/user_scenario/basic_workflow/multi_env_custom_forge_git_module_static.rb +9 -5
  60. data/integration/tests/user_scenario/basic_workflow/multi_env_hiera.rb +9 -2
  61. data/integration/tests/user_scenario/basic_workflow/multi_env_multi_source.rb +2 -1
  62. data/integration/tests/user_scenario/basic_workflow/multi_source_custom_forge_git_module.rb +2 -1
  63. data/integration/tests/user_scenario/basic_workflow/negative/neg_bad_basedir.rb +2 -1
  64. data/integration/tests/user_scenario/basic_workflow/negative/neg_bad_forge_module.rb +7 -2
  65. data/integration/tests/user_scenario/basic_workflow/negative/neg_bad_git_module.rb +3 -4
  66. data/integration/tests/user_scenario/basic_workflow/negative/neg_bad_git_module_ref.rb +2 -1
  67. data/integration/tests/user_scenario/basic_workflow/negative/neg_bad_git_remote.rb +2 -1
  68. data/integration/tests/user_scenario/basic_workflow/negative/neg_branch_name_collision.rb +2 -1
  69. data/integration/tests/user_scenario/basic_workflow/negative/neg_disk_full.rb +2 -1
  70. data/integration/tests/user_scenario/basic_workflow/negative/neg_duplicate_module_names.rb +10 -4
  71. data/integration/tests/user_scenario/basic_workflow/negative/neg_inaccessible_forge.rb +9 -2
  72. data/integration/tests/user_scenario/basic_workflow/negative/neg_invalid_env_name.rb +2 -1
  73. data/integration/tests/user_scenario/basic_workflow/negative/neg_invalid_puppet_file.rb +2 -1
  74. data/integration/tests/user_scenario/basic_workflow/negative/neg_module_specified_at_deleted_release.rb +7 -2
  75. data/integration/tests/user_scenario/basic_workflow/negative/neg_read_only.rb +2 -1
  76. data/integration/tests/user_scenario/basic_workflow/negative/neg_specify_deleted_forge_module.rb +9 -2
  77. data/integration/tests/user_scenario/basic_workflow/single_env_10000_files.rb +2 -1
  78. data/integration/tests/user_scenario/basic_workflow/single_env_custom_forge_git_module.rb +2 -1
  79. data/integration/tests/user_scenario/basic_workflow/single_env_custom_forge_module.rb +2 -1
  80. data/integration/tests/user_scenario/basic_workflow/single_env_custom_module.rb +2 -1
  81. data/integration/tests/user_scenario/basic_workflow/single_env_large_files.rb +2 -1
  82. data/integration/tests/user_scenario/basic_workflow/single_env_module_already_installed.rb +2 -1
  83. data/integration/tests/user_scenario/basic_workflow/single_env_module_last_release_deleted.rb +2 -1
  84. data/integration/tests/user_scenario/basic_workflow/single_env_non-existent_base_dir.rb +2 -1
  85. data/integration/tests/user_scenario/basic_workflow/single_env_purge_unmanaged_modules.rb +3 -2
  86. data/integration/tests/user_scenario/basic_workflow/single_env_switch_forge_git_module.rb +3 -2
  87. data/integration/tests/user_scenario/basic_workflow/single_env_unicode_paths.rb +2 -1
  88. data/integration/tests/user_scenario/basic_workflow/single_env_upgrade_forge_mod_revert_change.rb +4 -3
  89. data/integration/tests/user_scenario/complex_workflow/multi_env_add_change_remove.rb +3 -2
  90. data/integration/tests/user_scenario/complex_workflow/multi_env_remove_re-add.rb +4 -3
  91. data/integration/tests/user_scenario/complex_workflow/multi_env_unamanaged.rb +3 -2
  92. data/integration/tests/user_scenario/complex_workflow/single_env_git_module_update.rb +3 -2
  93. data/lib/r10k/action/base.rb +31 -0
  94. data/lib/r10k/action/deploy/deploy_helpers.rb +34 -0
  95. data/lib/r10k/action/deploy/display.rb +57 -75
  96. data/lib/r10k/action/deploy/environment.rb +52 -15
  97. data/lib/r10k/action/deploy/module.rb +13 -18
  98. data/lib/r10k/action/puppetfile/check.rb +8 -18
  99. data/lib/r10k/action/puppetfile/install.rb +13 -27
  100. data/lib/r10k/action/puppetfile/purge.rb +8 -17
  101. data/lib/r10k/action/runner.rb +39 -3
  102. data/lib/r10k/cli.rb +1 -3
  103. data/lib/r10k/cli/deploy.rb +3 -1
  104. data/lib/r10k/cli/puppetfile.rb +2 -2
  105. data/lib/r10k/deployment.rb +8 -6
  106. data/lib/r10k/deployment/config.rb +18 -65
  107. data/lib/r10k/environment/base.rb +19 -0
  108. data/lib/r10k/environment/git.rb +9 -0
  109. data/lib/r10k/environment/svn.rb +9 -0
  110. data/lib/r10k/forge/module_release.rb +21 -14
  111. data/lib/r10k/git.rb +6 -0
  112. data/lib/r10k/git/alternates.rb +20 -6
  113. data/lib/r10k/git/cache.rb +1 -1
  114. data/lib/r10k/git/rugged/bare_repository.rb +5 -0
  115. data/lib/r10k/git/rugged/base_repository.rb +6 -20
  116. data/lib/r10k/git/rugged/credentials.rb +66 -0
  117. data/lib/r10k/git/rugged/thin_repository.rb +16 -11
  118. data/lib/r10k/git/rugged/working_repository.rb +15 -7
  119. data/lib/r10k/git/shellgit/bare_repository.rb +9 -4
  120. data/lib/r10k/git/shellgit/thin_repository.rb +8 -10
  121. data/lib/r10k/git/stateful_repository.rb +1 -1
  122. data/lib/r10k/initializers.rb +55 -0
  123. data/lib/r10k/module.rb +1 -0
  124. data/lib/r10k/module/base.rb +3 -2
  125. data/lib/r10k/module/forge.rb +14 -6
  126. data/lib/r10k/module/local.rb +36 -0
  127. data/lib/r10k/module/metadata_file.rb +2 -2
  128. data/lib/r10k/puppetfile.rb +1 -1
  129. data/lib/r10k/settings.rb +86 -0
  130. data/lib/r10k/settings/collection.rb +118 -0
  131. data/lib/r10k/settings/definition.rb +112 -0
  132. data/lib/r10k/settings/enum_definition.rb +22 -0
  133. data/lib/r10k/settings/loader.rb +96 -0
  134. data/lib/r10k/settings/uri_definition.rb +19 -0
  135. data/lib/r10k/util/subprocess/runner/windows.rb +4 -4
  136. data/lib/r10k/version.rb +1 -1
  137. data/r10k.gemspec +2 -3
  138. data/spec/fixtures/unit/puppetfile/argument-error/Puppetfile +1 -0
  139. data/spec/fixtures/unit/util/subprocess/{posix/runner → runner}/no-execute.sh +0 -0
  140. data/spec/integration/git/rugged/thin_repository_spec.rb +2 -2
  141. data/spec/integration/git/rugged/working_repository_spec.rb +9 -0
  142. data/spec/integration/git/shellgit/thin_repository_spec.rb +2 -2
  143. data/spec/integration/git/stateful_repository_spec.rb +1 -1
  144. data/spec/r10k-mocks/mock_config.rb +10 -13
  145. data/spec/r10k-mocks/mock_env.rb +8 -0
  146. data/spec/shared-examples/deploy-actions.rb +69 -0
  147. data/spec/shared-examples/puppetfile-action.rb +17 -0
  148. data/spec/unit/action/cri_runner_spec.rb +3 -1
  149. data/spec/unit/action/deploy/deploy_helpers_spec.rb +38 -0
  150. data/spec/unit/action/deploy/display_spec.rb +31 -0
  151. data/spec/unit/action/deploy/environment_spec.rb +56 -0
  152. data/spec/unit/action/deploy/module_spec.rb +17 -0
  153. data/spec/unit/action/puppetfile/check_spec.rb +26 -0
  154. data/spec/unit/action/puppetfile/install_spec.rb +68 -0
  155. data/spec/unit/action/puppetfile/purge_spec.rb +19 -0
  156. data/spec/unit/action/runner_spec.rb +10 -9
  157. data/spec/unit/deployment/config_spec.rb +20 -44
  158. data/spec/unit/deployment_spec.rb +1 -1
  159. data/spec/unit/environment/git_spec.rb +20 -0
  160. data/spec/unit/environment/svn_spec.rb +20 -0
  161. data/spec/unit/forge/module_release_spec.rb +6 -3
  162. data/spec/unit/git/alternates_spec.rb +38 -12
  163. data/spec/unit/git/cache_spec.rb +4 -0
  164. data/spec/unit/git/rugged/credentials_spec.rb +74 -0
  165. data/spec/unit/initializers_spec.rb +68 -0
  166. data/spec/unit/module/base_spec.rb +2 -2
  167. data/spec/unit/module/forge_spec.rb +11 -3
  168. data/spec/unit/module/metadata_file_spec.rb +0 -1
  169. data/spec/unit/puppetfile_spec.rb +11 -0
  170. data/spec/unit/settings/collection_spec.rb +122 -0
  171. data/spec/unit/settings/definition_spec.rb +78 -0
  172. data/spec/unit/settings/enum_definition_spec.rb +20 -0
  173. data/spec/unit/{deployment/config → settings}/loader_spec.rb +50 -2
  174. data/spec/unit/settings/uri_definition_spec.rb +23 -0
  175. data/spec/unit/settings_spec.rb +151 -0
  176. data/spec/unit/util/subprocess/runner/posix_spec.rb +1 -1
  177. data/spec/unit/util/subprocess/runner/windows_spec.rb +7 -0
  178. metadata +53 -90
  179. data/lib/r10k/deployment/config/loader.rb +0 -59
  180. data/lib/shared/puppet/module_tool/metadata.rb +0 -197
  181. data/lib/shared/puppet_forge/connection.rb +0 -64
  182. data/lib/shared/puppet_forge/connection/connection_failure.rb +0 -26
  183. data/lib/shared/puppet_forge/error.rb +0 -41
  184. data/lib/shared/puppet_forge/tar.rb +0 -10
  185. data/lib/shared/puppet_forge/tar/mini.rb +0 -81
  186. data/lib/shared/puppet_forge/unpacker.rb +0 -68
  187. data/lib/shared/puppet_forge/v3.rb +0 -13
  188. data/lib/shared/puppet_forge/v3/module.rb +0 -69
  189. data/lib/shared/puppet_forge/v3/module_release.rb +0 -85
  190. data/lib/shared/puppet_forge/version.rb +0 -3
  191. data/spec/unit/puppet/module_tool/metadata_spec.rb +0 -301
  192. data/spec/unit/puppet_forge/connection/connection_failure_spec.rb +0 -28
  193. data/spec/unit/puppet_forge/connection_spec.rb +0 -41
  194. data/spec/unit/puppet_forge/tar/mini_spec.rb +0 -87
  195. data/spec/unit/puppet_forge/tar_spec.rb +0 -9
  196. data/spec/unit/puppet_forge/unpacker_spec.rb +0 -59
  197. data/spec/unit/puppet_forge/v3/module_release_spec.rb +0 -83
  198. data/spec/unit/puppet_forge/v3/module_spec.rb +0 -75
@@ -0,0 +1,78 @@
1
+ require 'spec_helper'
2
+ require 'r10k/settings/definition'
3
+
4
+ describe R10K::Settings::Definition do
5
+ describe "#evaluate" do
6
+ it "assigns a value, validates it, and resolves a final value" do
7
+ subject = described_class.new(:setting)
8
+ expect(subject).to receive(:assign).with("myvalue")
9
+ expect(subject).to receive(:validate)
10
+ expect(subject).to receive(:resolve)
11
+ subject.evaluate("myvalue")
12
+ end
13
+ end
14
+
15
+ describe "#assign" do
16
+ it 'stores the provided value' do
17
+ subject = described_class.new(:setting)
18
+ subject.assign("I'm the value")
19
+ expect(subject.value).to eq "I'm the value"
20
+ end
21
+
22
+ it "normalizes the stored value when a normalize hook is set" do
23
+ subject = described_class.new(:setting, :normalize => lambda { |input| input.to_sym })
24
+ subject.assign("symbolizeme")
25
+ expect(subject.value).to eq :symbolizeme
26
+ end
27
+ end
28
+
29
+ describe "#validate" do
30
+ it "does nothing if a value has not been assigned" do
31
+ subject = described_class.new(:setting, :validate => lambda { |_| raise "Shouldn't be called" })
32
+ subject.validate
33
+ end
34
+
35
+ it "does nothing if a validate hook has not been assigned" do
36
+ subject = described_class.new(:setting)
37
+ subject.assign("I'm the value")
38
+ subject.validate
39
+ end
40
+
41
+ it "raises up errors raised from the validate hook" do
42
+ subject = described_class.new(:satellite, :validate => lambda { |input| raise ArgumentError, "Invalid value #{input}: that's no moon!" })
43
+ subject.assign("Alderaan")
44
+ expect {
45
+ subject.validate
46
+ }.to raise_error(ArgumentError, "Invalid value Alderaan: that's no moon!")
47
+ end
48
+
49
+ it "returns if the validate hook did not raise an error" do
50
+ subject = described_class.new(:setting, :validate => lambda { |_| "That's a moon" })
51
+ subject.assign("Mun")
52
+ subject.validate
53
+ end
54
+ end
55
+
56
+ describe "#resolve" do
57
+ it "returns the value when the value has been given" do
58
+ subject = described_class.new(:setting)
59
+ subject.assign("Mun")
60
+ expect(subject.resolve).to eq "Mun"
61
+ end
62
+
63
+ it "resolves the default when the default is a proc" do
64
+ subject = described_class.new(:setting, :default => lambda { "Minmus" })
65
+ expect(subject.resolve).to eq "Minmus"
66
+ end
67
+
68
+ it "returns the default when the default is not a proc" do
69
+ subject = described_class.new(:setting, :default => "Ike")
70
+ expect(subject.resolve).to eq "Ike"
71
+ end
72
+
73
+ it "returns nil when there is no value nor default" do
74
+ subject = described_class.new(:setting)
75
+ expect(subject.resolve).to be_nil
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,20 @@
1
+ require 'spec_helper'
2
+ require 'r10k/settings/enum_definition'
3
+
4
+ describe R10K::Settings::EnumDefinition do
5
+
6
+ subject { described_class.new(:enum, :enum => %w[one two three]) }
7
+
8
+ describe '#validate' do
9
+ it "doesn't raise an error when given an expected value" do
10
+ subject.assign('two')
11
+ subject.validate
12
+ end
13
+ it "raises an error when given a value outside the enum" do
14
+ subject.assign('dos')
15
+ expect {
16
+ subject.validate
17
+ }.to raise_error(ArgumentError, "Setting enum should be one of #{%w[one two three].inspect}, not 'dos'")
18
+ end
19
+ end
20
+ end
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
- require 'r10k/deployment/config/loader'
2
+ require 'r10k/settings/loader'
3
3
 
4
- describe R10K::Deployment::Config::Loader do
4
+ describe R10K::Settings::Loader do
5
5
 
6
6
  context 'populate_loadpath' do
7
7
  it 'includes /etc/puppetlabs/r10k/r10k.yaml in the loadpath' do
@@ -58,5 +58,53 @@ describe R10K::Deployment::Config::Loader do
58
58
 
59
59
  subject.search
60
60
  end
61
+
62
+ describe 'using an override value' do
63
+ it 'uses the override when set and ignores files in the load path' do
64
+ expect(File).to_not receive(:file?)
65
+ expect(subject.search('/some/override/r10k.yaml')).to eq '/some/override/r10k.yaml'
66
+ end
67
+
68
+ it 'ignores a nil override value' do
69
+ allow(File).to receive(:file?).and_return false
70
+ allow(File).to receive(:file?).with('/etc/puppetlabs/r10k/r10k.yaml').and_return true
71
+ allow(File).to receive(:file?).with('/etc/r10k.yaml').and_return true
72
+ expect(subject.search(nil)).to eq('/etc/puppetlabs/r10k/r10k.yaml')
73
+ end
74
+ end
75
+ end
76
+
77
+ context '#read' do
78
+ it "raises an error if no config file could be found" do
79
+ expect(subject).to receive(:search).and_return nil
80
+ expect {
81
+ subject.read
82
+ }.to raise_error(R10K::Settings::Loader::ConfigError, "No configuration file given, no config file found in current directory, and no global config present")
83
+ end
84
+
85
+ it "raises an error if the YAML file load raises an error" do
86
+ expect(subject).to receive(:search).and_return '/some/path/r10k.yaml'
87
+ expect(YAML).to receive(:load_file).and_raise(Errno::ENOENT, "/no/such/file")
88
+ expect {
89
+ subject.read
90
+ }.to raise_error(R10K::Settings::Loader::ConfigError, "Couldn't load config file: No such file or directory - /no/such/file")
91
+ end
92
+
93
+ it "recursively replaces string keys with symbol keys in the parsed structure" do
94
+ expect(subject).to receive(:search).and_return '/some/path/r10k.yaml'
95
+ expect(YAML).to receive(:load_file).and_return({
96
+ 'cachedir' => '/var/cache/r10k',
97
+ 'git' => {
98
+ 'provider' => 'rugged',
99
+ }
100
+ })
101
+
102
+ expect(subject.read).to eq({
103
+ :cachedir => '/var/cache/r10k',
104
+ :git => {
105
+ :provider => 'rugged',
106
+ }
107
+ })
108
+ end
61
109
  end
62
110
  end
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+ require 'r10k/settings/uri_definition'
3
+
4
+ describe R10K::Settings::URIDefinition do
5
+
6
+ subject { described_class.new(:uri) }
7
+
8
+ it "passes validation if a value has not been set" do
9
+ expect(subject.validate).to be_nil
10
+ end
11
+
12
+ it "passes validation when given a valid url" do
13
+ subject.assign("http://definitely.a/url")
14
+ expect(subject.validate).to be_nil
15
+ end
16
+
17
+ it "raises an error when given an invalid URL" do
18
+ subject.assign("That's no URI!")
19
+ expect {
20
+ subject.validate
21
+ }.to raise_error(ArgumentError, "Setting uri requires a URL but 'That's no URI!' could not be parsed as a URL")
22
+ end
23
+ end
@@ -0,0 +1,151 @@
1
+ require 'spec_helper'
2
+ require 'r10k/settings'
3
+
4
+ describe R10K::Settings do
5
+ describe "git settings" do
6
+ subject { described_class.git_settings }
7
+
8
+ describe "provider" do
9
+ it "normalizes valid values to a symbol" do
10
+ output = subject.evaluate("provider" => "rugged")
11
+ expect(output[:provider]).to eq(:rugged)
12
+ end
13
+ end
14
+
15
+ describe "username" do
16
+ it "defaults to the current user" do
17
+ expect(Etc).to receive(:getlogin).and_return("puppet")
18
+ output = subject.evaluate({})
19
+ expect(output[:username]).to eq("puppet")
20
+ end
21
+
22
+ it "passes values through unchanged" do
23
+ output = subject.evaluate("username" => "git")
24
+ expect(output[:username]).to eq("git")
25
+ end
26
+ end
27
+
28
+ describe "private_key" do
29
+ it "passes values through unchanged" do
30
+ output = subject.evaluate("private_key" => "/etc/puppetlabs/r10k/id_rsa")
31
+ expect(output[:private_key]).to eq("/etc/puppetlabs/r10k/id_rsa")
32
+ end
33
+ end
34
+ end
35
+
36
+ describe "forge settings" do
37
+ subject { described_class.forge_settings }
38
+
39
+ describe "proxy" do
40
+ it "accepts valid URIs" do
41
+ output = subject.evaluate("proxy" => "http://proxy.tessier-ashpool.freeside:3128")
42
+ expect(output[:proxy]).to eq "http://proxy.tessier-ashpool.freeside:3128"
43
+ end
44
+
45
+ it "rejects invalid URIs" do
46
+ expect {
47
+ subject.evaluate("proxy" => "that's no proxy!")
48
+ }.to raise_error do |err|
49
+ expect(err.message).to match(/Validation failed for forge settings group/)
50
+ expect(err.errors.size).to eq 1
51
+ expect(err.errors[:proxy]).to be_a_kind_of(ArgumentError)
52
+ expect(err.errors[:proxy].message).to match(/could not be parsed as a URL/)
53
+ end
54
+ end
55
+ end
56
+
57
+ describe "baseurl" do
58
+ it "accepts valid URIs" do
59
+ output = subject.evaluate("baseurl" => "https://forge.tessier-ashpool.freeside")
60
+ expect(output[:baseurl]).to eq "https://forge.tessier-ashpool.freeside"
61
+ end
62
+
63
+ it "rejects invalid URIs" do
64
+ expect {
65
+ subject.evaluate("baseurl" => "that's no forge!")
66
+ }.to raise_error do |err|
67
+ expect(err.message).to match(/Validation failed for forge settings group/)
68
+ expect(err.errors.size).to eq 1
69
+ expect(err.errors[:baseurl]).to be_a_kind_of(ArgumentError)
70
+ expect(err.errors[:baseurl].message).to match(/could not be parsed as a URL/)
71
+ end
72
+ end
73
+ end
74
+ end
75
+
76
+ describe "deploy settings" do
77
+ subject { described_class.deploy_settings }
78
+
79
+ describe "write_lock" do
80
+ it "accepts a string with a reason for the write lock" do
81
+ output = subject.evaluate("write_lock" => "No maintenance window active, code freeze till 2038-01-19")
82
+ expect(output[:write_lock]).to eq("No maintenance window active, code freeze till 2038-01-19")
83
+ end
84
+
85
+ it "accepts false and null values for the write lock" do
86
+ output = subject.evaluate("write_lock" => false)
87
+ expect(output[:write_lock]).to eq false
88
+ end
89
+
90
+ it "rejects non-string truthy values for the write lock" do
91
+ expect {
92
+ subject.evaluate("write_lock" => %w[list of reasons why deploys are locked])
93
+ }.to raise_error do |err|
94
+ expect(err.message).to match(/Validation failed for deploy settings group/)
95
+ expect(err.errors.size).to eq 1
96
+ expect(err.errors[:write_lock]).to be_a_kind_of(ArgumentError)
97
+ expect(err.errors[:write_lock].message).to match(/should be a string containing the reason/)
98
+ end
99
+ end
100
+ end
101
+ end
102
+
103
+ describe "global settings" do
104
+ subject { described_class.global_settings }
105
+ describe "sources" do
106
+ it "passes values through unchanged" do
107
+ output = subject.evaluate("sources" => {"puppet" => {"remote" => "https://git.tessier-ashpool.freeside"}})
108
+ expect(output[:sources]).to eq({"puppet" => {"remote" => "https://git.tessier-ashpool.freeside"}})
109
+ end
110
+ end
111
+
112
+ describe "cachedir" do
113
+ it "passes values through unchanged" do
114
+ output = subject.evaluate("cachedir" => "/srv/r10k/git")
115
+ expect(output[:cachedir]).to eq("/srv/r10k/git")
116
+ end
117
+ end
118
+
119
+ describe "postrun" do
120
+ it "accepts an argument vector" do
121
+ output = subject.evaluate("postrun" => ["curl", "-F", "deploy=done", "http://reporting.tessier-ashpool.freeside/r10k"])
122
+ expect(output[:postrun]).to eq(["curl", "-F", "deploy=done", "http://reporting.tessier-ashpool.freeside/r10k"])
123
+ end
124
+
125
+ it "rejects a string command" do
126
+ expect {
127
+ subject.evaluate("postrun" => "curl -F 'deploy=done' https://reporting.tessier-ashpool.freeside/r10k")
128
+ }.to raise_error do |err|
129
+ expect(err.message).to match(/Validation failed for global settings group/)
130
+ expect(err.errors.size).to eq 1
131
+ expect(err.errors[:postrun]).to be_a_kind_of(ArgumentError)
132
+ expect(err.errors[:postrun].message).to eq("The postrun setting should be an array of strings, not a String")
133
+ end
134
+ end
135
+ end
136
+
137
+ describe "git settings" do
138
+ it "passes settings through to the git settings" do
139
+ output = subject.evaluate("git" => {"provider" => "shellgit", "username" => "git"})
140
+ expect(output[:git]).to eq(:provider => :shellgit, :username => "git", :private_key => nil)
141
+ end
142
+ end
143
+
144
+ describe "forge settings" do
145
+ it "passes settings through to the forge settings" do
146
+ output = subject.evaluate("forge" => {"baseurl" => "https://forge.tessier-ashpool.freeside", "proxy" => "https://proxy.tessier-ashpool.freesize:3128"})
147
+ expect(output[:forge]).to eq(:baseurl => "https://forge.tessier-ashpool.freeside", :proxy => "https://proxy.tessier-ashpool.freesize:3128")
148
+ end
149
+ end
150
+ end
151
+ end
@@ -2,6 +2,6 @@ require 'spec_helper'
2
2
  require 'r10k/util/subprocess/runner'
3
3
 
4
4
  describe R10K::Util::Subprocess::Runner::POSIX, :if => R10K::Util::Platform.posix? do
5
- fixture_root = File.expand_path('spec/fixtures/unit/util/subprocess/posix/runner', PROJECT_ROOT)
5
+ fixture_root = File.expand_path('spec/fixtures/unit/util/subprocess/runner', PROJECT_ROOT)
6
6
  it_behaves_like 'a subprocess runner', fixture_root
7
7
  end
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+ require 'r10k/util/subprocess/runner'
3
+
4
+ describe R10K::Util::Subprocess::Runner::Windows do
5
+ fixture_root = File.expand_path('spec/fixtures/unit/util/subprocess/runner', PROJECT_ROOT)
6
+ it_behaves_like 'a subprocess runner', fixture_root
7
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: r10k
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrien Thebo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-13 00:00:00.000000000 Z
11
+ date: 2015-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colored
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ~>
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.10'
69
+ - !ruby/object:Gem::Dependency
70
+ name: puppet_forge
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: 2.1.1
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: 2.1.1
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: faraday
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -255,9 +269,14 @@ files:
255
269
  - integration/test_run_scripts/user_scenario/basic_workflow/all_tests-pe-centos6.sh
256
270
  - integration/test_run_scripts/user_scenario/complex_workflow/all_tests-pe-centos6.sh
257
271
  - integration/tests/README.mkd
272
+ - integration/tests/basic_functionality/install_pe_only_module_with_puppetfile.rb
273
+ - integration/tests/basic_functionality/negative/attempt_to_install_peonly_module_without_license.rb
258
274
  - integration/tests/basic_functionality/negative/neg_deploy_with_invalid_r10k_yaml.rb
259
275
  - integration/tests/basic_functionality/negative/neg_deploy_with_missing_r10k_yaml.rb
260
276
  - integration/tests/basic_functionality/negative/neg_invalid_git_provider.rb
277
+ - integration/tests/basic_functionality/negative/negative_bad_proxy.rb
278
+ - integration/tests/basic_functionality/proxy_specified_in_configuration.rb
279
+ - integration/tests/basic_functionality/proxy_with_puppetfile.rb
261
280
  - integration/tests/basic_functionality/rugged_git_provider_with_ssh.rb
262
281
  - integration/tests/basic_functionality/rugged_git_provider_without_ssh.rb
263
282
  - integration/tests/command_line/deploy_env_without_mod_update.rb
@@ -309,8 +328,10 @@ files:
309
328
  - integration/tests/user_scenario/complex_workflow/multi_env_unamanaged.rb
310
329
  - integration/tests/user_scenario/complex_workflow/single_env_git_module_update.rb
311
330
  - lib/r10k.rb
331
+ - lib/r10k/action/base.rb
312
332
  - lib/r10k/action/cri_runner.rb
313
333
  - lib/r10k/action/deploy.rb
334
+ - lib/r10k/action/deploy/deploy_helpers.rb
314
335
  - lib/r10k/action/deploy/display.rb
315
336
  - lib/r10k/action/deploy/environment.rb
316
337
  - lib/r10k/action/deploy/module.rb
@@ -329,7 +350,6 @@ files:
329
350
  - lib/r10k/cli/version.rb
330
351
  - lib/r10k/deployment.rb
331
352
  - lib/r10k/deployment/config.rb
332
- - lib/r10k/deployment/config/loader.rb
333
353
  - lib/r10k/environment.rb
334
354
  - lib/r10k/environment/base.rb
335
355
  - lib/r10k/environment/git.rb
@@ -349,6 +369,7 @@ files:
349
369
  - lib/r10k/git/rugged/bare_repository.rb
350
370
  - lib/r10k/git/rugged/base_repository.rb
351
371
  - lib/r10k/git/rugged/cache.rb
372
+ - lib/r10k/git/rugged/credentials.rb
352
373
  - lib/r10k/git/rugged/thin_repository.rb
353
374
  - lib/r10k/git/rugged/working_repository.rb
354
375
  - lib/r10k/git/shellgit.rb
@@ -358,6 +379,7 @@ files:
358
379
  - lib/r10k/git/shellgit/thin_repository.rb
359
380
  - lib/r10k/git/shellgit/working_repository.rb
360
381
  - lib/r10k/git/stateful_repository.rb
382
+ - lib/r10k/initializers.rb
361
383
  - lib/r10k/instance_cache.rb
362
384
  - lib/r10k/keyed_factory.rb
363
385
  - lib/r10k/logging.rb
@@ -366,14 +388,20 @@ files:
366
388
  - lib/r10k/module/base.rb
367
389
  - lib/r10k/module/forge.rb
368
390
  - lib/r10k/module/git.rb
391
+ - lib/r10k/module/local.rb
369
392
  - lib/r10k/module/metadata_file.rb
370
393
  - lib/r10k/module/svn.rb
371
394
  - lib/r10k/module_repository.rb
372
395
  - lib/r10k/module_repository/forge.rb
373
396
  - lib/r10k/puppetfile.rb
374
397
  - lib/r10k/settings.rb
398
+ - lib/r10k/settings/collection.rb
375
399
  - lib/r10k/settings/container.rb
400
+ - lib/r10k/settings/definition.rb
401
+ - lib/r10k/settings/enum_definition.rb
402
+ - lib/r10k/settings/loader.rb
376
403
  - lib/r10k/settings/mixin.rb
404
+ - lib/r10k/settings/uri_definition.rb
377
405
  - lib/r10k/source.rb
378
406
  - lib/r10k/source/base.rb
379
407
  - lib/r10k/source/git.rb
@@ -398,17 +426,6 @@ files:
398
426
  - lib/r10k/util/subprocess/subprocess_error.rb
399
427
  - lib/r10k/util/symbolize_keys.rb
400
428
  - lib/r10k/version.rb
401
- - lib/shared/puppet/module_tool/metadata.rb
402
- - lib/shared/puppet_forge/connection.rb
403
- - lib/shared/puppet_forge/connection/connection_failure.rb
404
- - lib/shared/puppet_forge/error.rb
405
- - lib/shared/puppet_forge/tar.rb
406
- - lib/shared/puppet_forge/tar/mini.rb
407
- - lib/shared/puppet_forge/unpacker.rb
408
- - lib/shared/puppet_forge/v3.rb
409
- - lib/shared/puppet_forge/v3/module.rb
410
- - lib/shared/puppet_forge/v3/module_release.rb
411
- - lib/shared/puppet_forge/version.rb
412
429
  - r10k.gemspec
413
430
  - r10k.yaml.example
414
431
  - spec/fixtures/empty/.empty
@@ -416,9 +433,10 @@ files:
416
433
  - spec/fixtures/module/forge/bad_module/metadata.json
417
434
  - spec/fixtures/module/forge/eight_hundred/Modulefile
418
435
  - spec/fixtures/module/forge/eight_hundred/metadata.json
436
+ - spec/fixtures/unit/puppetfile/argument-error/Puppetfile
419
437
  - spec/fixtures/unit/puppetfile/invalid-syntax/Puppetfile
420
438
  - spec/fixtures/unit/puppetfile/load-error/Puppetfile
421
- - spec/fixtures/unit/util/subprocess/posix/runner/no-execute.sh
439
+ - spec/fixtures/unit/util/subprocess/runner/no-execute.sh
422
440
  - spec/integration/git/rugged/bare_repository_spec.rb
423
441
  - spec/integration/git/rugged/thin_repository_spec.rb
424
442
  - spec/integration/git/rugged/working_repository_spec.rb
@@ -433,17 +451,25 @@ files:
433
451
  - spec/r10k-mocks/mock_env.rb
434
452
  - spec/r10k-mocks/mock_source.rb
435
453
  - spec/shared-contexts/git-fixtures.rb
454
+ - spec/shared-examples/deploy-actions.rb
436
455
  - spec/shared-examples/git-repository.rb
437
456
  - spec/shared-examples/git/bare_repository.rb
438
457
  - spec/shared-examples/git/thin_repository.rb
439
458
  - spec/shared-examples/git/working_repository.rb
459
+ - spec/shared-examples/puppetfile-action.rb
440
460
  - spec/shared-examples/subprocess-runner.rb
441
461
  - spec/spec_helper.rb
442
462
  - spec/unit/action/cri_runner_spec.rb
463
+ - spec/unit/action/deploy/deploy_helpers_spec.rb
464
+ - spec/unit/action/deploy/display_spec.rb
465
+ - spec/unit/action/deploy/environment_spec.rb
466
+ - spec/unit/action/deploy/module_spec.rb
467
+ - spec/unit/action/puppetfile/check_spec.rb
443
468
  - spec/unit/action/puppetfile/cri_runner_spec.rb
469
+ - spec/unit/action/puppetfile/install_spec.rb
470
+ - spec/unit/action/puppetfile/purge_spec.rb
444
471
  - spec/unit/action/runner_spec.rb
445
472
  - spec/unit/action/visitor_spec.rb
446
- - spec/unit/deployment/config/loader_spec.rb
447
473
  - spec/unit/deployment/config_spec.rb
448
474
  - spec/unit/deployment_spec.rb
449
475
  - spec/unit/environment/base_spec.rb
@@ -456,9 +482,11 @@ files:
456
482
  - spec/unit/git/alternates_spec.rb
457
483
  - spec/unit/git/cache_spec.rb
458
484
  - spec/unit/git/rugged/cache_spec.rb
485
+ - spec/unit/git/rugged/credentials_spec.rb
459
486
  - spec/unit/git/shellgit/cache_spec.rb
460
487
  - spec/unit/git/stateful_repository_spec.rb
461
488
  - spec/unit/git_spec.rb
489
+ - spec/unit/initializers_spec.rb
462
490
  - spec/unit/instance_cache_spec.rb
463
491
  - spec/unit/keyed_factory_spec.rb
464
492
  - spec/unit/logging/terminaloutputter_spec.rb
@@ -470,16 +498,14 @@ files:
470
498
  - spec/unit/module/svn_spec.rb
471
499
  - spec/unit/module_repository/forge_spec.rb
472
500
  - spec/unit/module_spec.rb
473
- - spec/unit/puppet/module_tool/metadata_spec.rb
474
- - spec/unit/puppet_forge/connection/connection_failure_spec.rb
475
- - spec/unit/puppet_forge/connection_spec.rb
476
- - spec/unit/puppet_forge/tar/mini_spec.rb
477
- - spec/unit/puppet_forge/tar_spec.rb
478
- - spec/unit/puppet_forge/unpacker_spec.rb
479
- - spec/unit/puppet_forge/v3/module_release_spec.rb
480
- - spec/unit/puppet_forge/v3/module_spec.rb
481
501
  - spec/unit/puppetfile_spec.rb
502
+ - spec/unit/settings/collection_spec.rb
482
503
  - spec/unit/settings/container_spec.rb
504
+ - spec/unit/settings/definition_spec.rb
505
+ - spec/unit/settings/enum_definition_spec.rb
506
+ - spec/unit/settings/loader_spec.rb
507
+ - spec/unit/settings/uri_definition_spec.rb
508
+ - spec/unit/settings_spec.rb
483
509
  - spec/unit/source/base_spec.rb
484
510
  - spec/unit/source/git_spec.rb
485
511
  - spec/unit/source/svn_spec.rb
@@ -493,10 +519,11 @@ files:
493
519
  - spec/unit/util/subprocess/result_spec.rb
494
520
  - spec/unit/util/subprocess/runner/posix_spec.rb
495
521
  - spec/unit/util/subprocess/runner/pump_spec.rb
522
+ - spec/unit/util/subprocess/runner/windows_spec.rb
496
523
  - spec/unit/util/subprocess/subprocess_error_spec.rb
497
524
  - spec/unit/util/subprocess_spec.rb
498
525
  - spec/unit/util/symbolize_keys_spec.rb
499
- homepage: http://github.com/adrienthebo/r10k
526
+ homepage: https://github.com/puppetlabs/r10k
500
527
  licenses:
501
528
  - Apache-2.0
502
529
  metadata: {}
@@ -520,69 +547,5 @@ rubygems_version: 2.4.8
520
547
  signing_key:
521
548
  specification_version: 4
522
549
  summary: Puppet environment and module deployment
523
- test_files:
524
- - spec/integration/git/stateful_repository_spec.rb
525
- - spec/integration/git/shellgit/bare_repository_spec.rb
526
- - spec/integration/git/shellgit/thin_repository_spec.rb
527
- - spec/integration/git/shellgit/working_repository_spec.rb
528
- - spec/integration/git/rugged/bare_repository_spec.rb
529
- - spec/integration/git/rugged/thin_repository_spec.rb
530
- - spec/integration/git/rugged/working_repository_spec.rb
531
- - spec/unit/environment/name_spec.rb
532
- - spec/unit/environment/base_spec.rb
533
- - spec/unit/environment/svn_spec.rb
534
- - spec/unit/environment/git_spec.rb
535
- - spec/unit/module_spec.rb
536
- - spec/unit/module_repository/forge_spec.rb
537
- - spec/unit/git/stateful_repository_spec.rb
538
- - spec/unit/git/cache_spec.rb
539
- - spec/unit/git/shellgit/cache_spec.rb
540
- - spec/unit/git/alternates_spec.rb
541
- - spec/unit/git/rugged/cache_spec.rb
542
- - spec/unit/forge/module_release_spec.rb
543
- - spec/unit/keyed_factory_spec.rb
544
- - spec/unit/puppet/module_tool/metadata_spec.rb
545
- - spec/unit/deployment/config/loader_spec.rb
546
- - spec/unit/deployment/config_spec.rb
547
- - spec/unit/feature_spec.rb
548
- - spec/unit/source_spec.rb
549
- - spec/unit/puppetfile_spec.rb
550
- - spec/unit/util/exec_env_spec.rb
551
- - spec/unit/util/attempt_spec.rb
552
- - spec/unit/util/setopts_spec.rb
553
- - spec/unit/util/subprocess/runner/posix_spec.rb
554
- - spec/unit/util/subprocess/runner/pump_spec.rb
555
- - spec/unit/util/subprocess/result_spec.rb
556
- - spec/unit/util/subprocess/subprocess_error_spec.rb
557
- - spec/unit/util/subprocess_spec.rb
558
- - spec/unit/util/symbolize_keys_spec.rb
559
- - spec/unit/util/commands_spec.rb
560
- - spec/unit/errors/formatting_spec.rb
561
- - spec/unit/instance_cache_spec.rb
562
- - spec/unit/action/visitor_spec.rb
563
- - spec/unit/action/cri_runner_spec.rb
564
- - spec/unit/action/puppetfile/cri_runner_spec.rb
565
- - spec/unit/action/runner_spec.rb
566
- - spec/unit/settings/container_spec.rb
567
- - spec/unit/git_spec.rb
568
- - spec/unit/svn/working_dir_spec.rb
569
- - spec/unit/svn/remote_spec.rb
570
- - spec/unit/source/base_spec.rb
571
- - spec/unit/source/svn_spec.rb
572
- - spec/unit/source/git_spec.rb
573
- - spec/unit/logging/terminaloutputter_spec.rb
574
- - spec/unit/deployment_spec.rb
575
- - spec/unit/module/metadata_file_spec.rb
576
- - spec/unit/module/forge_spec.rb
577
- - spec/unit/module/base_spec.rb
578
- - spec/unit/module/svn_spec.rb
579
- - spec/unit/module/git_spec.rb
580
- - spec/unit/logging_spec.rb
581
- - spec/unit/puppet_forge/tar_spec.rb
582
- - spec/unit/puppet_forge/connection/connection_failure_spec.rb
583
- - spec/unit/puppet_forge/v3/module_spec.rb
584
- - spec/unit/puppet_forge/v3/module_release_spec.rb
585
- - spec/unit/puppet_forge/unpacker_spec.rb
586
- - spec/unit/puppet_forge/connection_spec.rb
587
- - spec/unit/puppet_forge/tar/mini_spec.rb
550
+ test_files: []
588
551
  has_rdoc: