r10k 2.6.9 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +1 -0
  3. data/.travis.yml +9 -16
  4. data/CHANGELOG.mkd +23 -36
  5. data/Gemfile +2 -1
  6. data/MAINTAINERS +18 -0
  7. data/README.mkd +1 -5
  8. data/bin/r10k +2 -2
  9. data/doc/common-patterns.mkd +2 -2
  10. data/doc/dynamic-environments/configuration.mkd +1 -2
  11. data/doc/dynamic-environments/quickstart.mkd +3 -3
  12. data/doc/dynamic-environments/usage.mkd +0 -12
  13. data/doc/puppetfile.mkd +0 -18
  14. data/docker/Gemfile +13 -0
  15. data/docker/ci/build +72 -0
  16. data/docker/distelli-manifest.yml +4 -0
  17. data/docker/r10k/Dockerfile +41 -0
  18. data/docker/r10k/spec/dockerfile_spec.rb +16 -0
  19. data/integration/Gemfile +4 -2
  20. data/integration/Rakefile +3 -2
  21. data/integration/pre-suite/00_pe_install.rb +0 -1
  22. data/integration/pre-suite/30_test_utils.rb +17 -0
  23. data/integration/scripts/README.mkd +86 -0
  24. data/integration/scripts/setup_r10k_env_centos5.sh +23 -0
  25. data/integration/scripts/setup_r10k_env_centos6.sh +23 -0
  26. data/integration/scripts/setup_r10k_env_rhel7.sh +23 -0
  27. data/integration/scripts/setup_r10k_env_sles11.sh +23 -0
  28. data/integration/scripts/setup_r10k_env_sles12.sh +23 -0
  29. data/integration/scripts/setup_r10k_env_ubuntu1004.sh +23 -0
  30. data/integration/scripts/setup_r10k_env_ubuntu1204.sh +23 -0
  31. data/integration/scripts/setup_r10k_env_ubuntu1404.sh +23 -0
  32. data/integration/tests/basic_functionality/install_pe_only_module_with_puppetfile.rb +2 -2
  33. data/integration/tests/basic_functionality/negative/attempt_to_install_peonly_module_without_license.rb +71 -0
  34. data/integration/tests/basic_functionality/proxy_with_pe_only_module.rb +2 -2
  35. data/integration/tests/git_source/HTTP_proxy_and_git_source.rb +2 -2
  36. data/integration/tests/i18n/deploy_module_with_unicode_in_file_name.rb +64 -0
  37. data/integration/tests/purging/does_not_purge_files_on_white_list.rb +93 -0
  38. data/integration/tests/purging/invalid_whitelist_types.rb +63 -0
  39. data/integration/tests/user_scenario/basic_workflow/negative/neg_disk_full.rb +12 -2
  40. data/integration/tests/user_scenario/basic_workflow/negative/neg_duplicate_module_names.rb +1 -8
  41. data/integration/tests/user_scenario/basic_workflow/single_env_10000_files.rb +11 -2
  42. data/integration/tests/user_scenario/basic_workflow/single_env_large_files.rb +12 -2
  43. data/lib/r10k/action/deploy/environment.rb +2 -15
  44. data/lib/r10k/action/puppetfile/check.rb +1 -1
  45. data/lib/r10k/action/puppetfile/cri_runner.rb +1 -13
  46. data/lib/r10k/action/puppetfile/purge.rb +1 -1
  47. data/lib/r10k/cli/deploy.rb +0 -1
  48. data/lib/r10k/cli/puppetfile.rb +4 -0
  49. data/lib/r10k/environment/base.rb +7 -1
  50. data/lib/r10k/environment/svn.rb +1 -1
  51. data/lib/r10k/forge/module_release.rb +2 -2
  52. data/lib/r10k/git/rugged/base_repository.rb +6 -3
  53. data/lib/r10k/git/rugged/working_repository.rb +10 -1
  54. data/lib/r10k/git/shellgit/base_repository.rb +27 -8
  55. data/lib/r10k/git/shellgit/working_repository.rb +20 -6
  56. data/lib/r10k/git/stateful_repository.rb +0 -1
  57. data/lib/r10k/module/git.rb +0 -5
  58. data/lib/r10k/puppetfile.rb +22 -27
  59. data/lib/r10k/source/base.rb +6 -0
  60. data/lib/r10k/source/git.rb +2 -2
  61. data/lib/r10k/source/svn.rb +4 -2
  62. data/lib/r10k/util/purgeable.rb +4 -2
  63. data/lib/r10k/util/subprocess/runner/posix.rb +3 -3
  64. data/lib/r10k/version.rb +1 -4
  65. data/locales/r10k.pot +23 -19
  66. data/r10k.gemspec +4 -8
  67. data/r10k.yaml.example +6 -0
  68. data/spec/fixtures/unit/puppetfile/duplicate-module-error/Puppetfile +10 -0
  69. data/spec/fixtures/unit/puppetfile/name-error/Puppetfile +1 -0
  70. data/spec/shared-examples/git/working_repository.rb +46 -0
  71. data/spec/unit/action/deploy/environment_spec.rb +0 -63
  72. data/spec/unit/action/puppetfile/check_spec.rb +24 -9
  73. data/spec/unit/action/puppetfile/cri_runner_spec.rb +2 -20
  74. data/spec/unit/action/puppetfile/install_spec.rb +16 -16
  75. data/spec/unit/action/puppetfile/purge_spec.rb +29 -6
  76. data/spec/unit/forge/module_release_spec.rb +10 -6
  77. data/spec/unit/git/stateful_repository_spec.rb +1 -4
  78. data/spec/unit/puppetfile_spec.rb +43 -36
  79. metadata +33 -48
  80. data/.github/pull_request_template.md +0 -4
  81. data/.github/workflows/release.yml +0 -36
  82. data/CODEOWNERS +0 -1
  83. data/spec/fixtures/unit/puppetfile/default-branch-override/Puppetfile +0 -5
@@ -0,0 +1,64 @@
1
+ require 'git_utils'
2
+ require 'r10k_utils'
3
+ require 'master_manipulator'
4
+ require 'beaker-qa-i18n'
5
+
6
+ test_name 'Deploy module with unicode file name'
7
+
8
+ #Init
9
+ master_certname = on(master, puppet('config', 'print', 'certname')).stdout.rstrip
10
+ git_environments_path = '/root/environments'
11
+ last_commit = git_last_commit(master, git_environments_path)
12
+ local_files_root_path = ENV['FILES'] || 'files'
13
+ helloworld_module_path = File.join(local_files_root_path, 'modules', 'helloworld')
14
+ r10k_fqp = get_r10k_fqp(master)
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_regex = /I am in the production environment/
22
+
23
+ #Teardown
24
+ teardown do
25
+ clean_up_r10k(master, last_commit, git_environments_path)
26
+ end
27
+
28
+ test_i18n_strings(10, [:syntax, :white_space]) do |test_string|
29
+ #Setup
30
+ test_file_path = File.join(git_environments_path, "site", 'helloworld', 'manifests', test_string)
31
+
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 'Add unicode file to helloworld Module'
39
+ create_remote_file(master, test_file_path, 'test file contents')
40
+
41
+ step 'Inject New "site.pp" to the "production" Environment'
42
+ inject_site_pp(master, site_pp_path, site_pp)
43
+
44
+ step 'Push Changes'
45
+ git_add_commit_push(master, 'production', 'Update site.pp and add module.', git_environments_path)
46
+
47
+ #Tests
48
+ step 'Deploy "production" Environment via r10k'
49
+ on(master, "#{r10k_fqp} deploy environment -v")
50
+
51
+ step 'test deployment of Unicode file'
52
+ deployed_test_file_path = "/etc/puppetlabs/code/environments/production/site/helloworld/manifests/#{test_string}"
53
+ on(master, "test -f #{deployed_test_file_path}", :accept_all_exit_codes => true) do |result|
54
+ assert(result.exit_code == 0, "The unicode test file #{test_string} was not deployed by r10k")
55
+ end
56
+
57
+ agents.each do |agent|
58
+ step "Run Puppet Agent"
59
+ on(agent, puppet('agent', '--test', '--environment production'), :acceptable_exit_codes => 2) do |result|
60
+ assert_no_match(/Error:/, result.stderr, 'Unexpected error was detected!')
61
+ assert_match(notify_message_regex, result.stdout, 'Expected message not found!')
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,93 @@
1
+ require 'git_utils'
2
+ require 'r10k_utils'
3
+ require 'master_manipulator'
4
+ test_name 'RK-257 - C98046 - r10k does not purge files on whitelist'
5
+
6
+ #Init
7
+ env_path = on(master, puppet('config print environmentpath')).stdout.rstrip
8
+ r10k_fqp = get_r10k_fqp(master)
9
+ git_environments_path = '/root/environments'
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
+
15
+ last_commit = git_last_commit(master, git_environments_path)
16
+ git_provider = ENV['GIT_PROVIDER']
17
+
18
+ r10k_config_path = get_r10k_config_file_path(master)
19
+ r10k_config_bak_path = "#{r10k_config_path}.bak"
20
+
21
+ teardown do
22
+ step 'Restore Original "r10k" Config'
23
+ on(master, "mv #{r10k_config_bak_path} #{r10k_config_path}")
24
+
25
+ clean_up_r10k(master, last_commit, git_environments_path)
26
+ end
27
+
28
+ # initalize file content
29
+ step 'Stub the forge'
30
+ stub_forge_on(master)
31
+
32
+ step 'Backup Current "r10k" Config'
33
+ on(master, "mv #{r10k_config_path} #{r10k_config_bak_path}")
34
+
35
+ r10k_conf = <<-CONF
36
+ cachedir: '/var/cache/r10k'
37
+ git:
38
+ provider: '#{git_provider}'
39
+ sources:
40
+ control:
41
+ basedir: "#{env_path}"
42
+ remote: "#{git_control_remote}"
43
+ deploy:
44
+ purge_levels: ['deployment', 'environment', 'puppetfile']
45
+ purge_whitelist: ['**/*.pp']
46
+ CONF
47
+
48
+ step 'Update the "r10k" Config'
49
+ create_remote_file(master, r10k_config_path, r10k_conf)
50
+
51
+ step 'Copy Puppetfile to "production" Environment Git Repo'
52
+ create_remote_file(master, "#{git_environments_path}/Puppetfile", "mod 'puppetlabs-stdlib' \n mod 'puppetlabs-motd'")
53
+
54
+ step 'Push Changes'
55
+ git_add_commit_push(master, 'production', 'add Puppetfile', git_environments_path)
56
+
57
+ step 'Deploy production'
58
+ on(master, "#{r10k_fqp} deploy environment -p")
59
+
60
+ step 'commit a new Puppetfile to production'
61
+ create_remote_file(master, "#{git_environments_path}/Puppetfile", 'mod "puppetlabs-motd"')
62
+
63
+ step 'Push Changes'
64
+ git_add_commit_push(master, 'production', 'add Puppetfile', git_environments_path)
65
+
66
+ step 'create test pp files'
67
+ do_not_purge = [
68
+ "/etc/puppetlabs/code/environments/production/environment_level.pp",
69
+ "/etc/puppetlabs/code/environments/production/site/environment_level.pp"
70
+ ].each do |file|
71
+ create_remote_file(master, file, 'this is a test')
72
+ end
73
+
74
+ purge = [
75
+ "/etc/puppetlabs/code/environments/production/environment_level.zz",
76
+ "/etc/puppetlabs/code/environments/production/site/environment_level.zz"
77
+ ].each do |file|
78
+ create_remote_file(master, file, 'this is a test')
79
+ end
80
+
81
+ #TEST
82
+ step 'Deploy again and check files'
83
+ on(master, "#{r10k_fqp} deploy environment -p")
84
+
85
+ purge.each do |file|
86
+ assert_message = "The file #{file}\n was not purged, it was expected to be"
87
+ assert(on(master, "test -f #{file}", :accept_all_exit_codes => true).exit_code == 1, assert_message)
88
+ end
89
+
90
+ do_not_purge.each do |file|
91
+ assert_message = "The file #{file}\n was purged, it was not expected to be"
92
+ assert(on(master, "test -f #{file}", :accept_all_exit_codes => true).exit_code == 0, assert_message)
93
+ end
@@ -0,0 +1,63 @@
1
+ require 'git_utils'
2
+ require 'r10k_utils'
3
+ require 'master_manipulator'
4
+ test_name 'RK-257 - C98043 - verify default whitelist only accepts strings or array of strings'
5
+
6
+ #Init
7
+ env_path = on(master, puppet('config print environmentpath')).stdout.rstrip
8
+ r10k_fqp = get_r10k_fqp(master)
9
+ git_environments_path = '/root/environments'
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
+
15
+ last_commit = git_last_commit(master, git_environments_path)
16
+ git_provider = ENV['GIT_PROVIDER']
17
+
18
+ r10k_config_path = get_r10k_config_file_path(master)
19
+ r10k_config_bak_path = "#{r10k_config_path}.bak"
20
+
21
+ #invalid content to test
22
+ hash_whitelist = '{:cats => \'cats.txt\'}'
23
+ invalid_array_content_whitelist = '[\'cats.txt\', [:broken]]'
24
+
25
+ teardown do
26
+ step 'Restore Original "r10k" Config'
27
+ on(master, "mv #{r10k_config_bak_path} #{r10k_config_path}")
28
+
29
+ clean_up_r10k(master, last_commit, git_environments_path)
30
+ end
31
+
32
+ # initalize file content
33
+ step 'Stub the forge'
34
+ stub_forge_on(master)
35
+
36
+ step 'Backup Current "r10k" Config'
37
+ on(master, "mv #{r10k_config_path} #{r10k_config_bak_path}")
38
+
39
+ [hash_whitelist, invalid_array_content_whitelist].each do |whitelist_content|
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
+ deploy:
49
+ purge_whitelist: #{whitelist_content}
50
+ CONF
51
+
52
+ step 'Update the "r10k" Config'
53
+ create_remote_file(master, r10k_config_path, r10k_conf)
54
+
55
+ step 'Deploy r10k, and verify that invalid whitelist content causes error'
56
+ on(master, "#{r10k_fqp} deploy environment -p", :accept_all_exit_codes => true) do |result|
57
+ error = /did not find expected node content while parsing a flow node/
58
+ error_message = 'whitelist content did not generate expected error'
59
+ expect_failure('RK-263') do
60
+ assert_no_match(result.stdout, error, error_message)
61
+ end
62
+ end
63
+ end
@@ -20,6 +20,17 @@ r10k_config_bak_path = "#{r10k_config_path}.bak"
20
20
 
21
21
  tmpfs_path = '/mnt/tmpfs'
22
22
 
23
+ if on(master, 'which python', :acceptable_exit_codes => [0, 1]).exit_code == 1
24
+ python_bin = 'python3'
25
+ else
26
+ python_bin = 'python'
27
+ end
28
+
29
+ file_bucket_path = '/opt/filebucket'
30
+ file_bucket_command_path = File.join(file_bucket_path, 'filebucketapp.py')
31
+ file_bucket_command = "#{python_bin} #{file_bucket_command_path}"
32
+ pattern_file_path = File.join(file_bucket_path, 'psuedo_random_128k.pat')
33
+
23
34
  test_files_path = File.join(git_environments_path, 'test_files')
24
35
 
25
36
  #In-line files
@@ -62,8 +73,7 @@ on(master, "mount -osize=10m tmpfs #{tmpfs_path} -t tmpfs")
62
73
  step 'Create Large Binary File'
63
74
  create_remote_file(master, File.join(git_environments_path, '.gitattributes'), '*.file binary')
64
75
  on(master, "mkdir -p #{test_files_path}")
65
- # create a 11 mb file to fill the mount
66
- on(master, "dd if=/dev/urandom of=#{test_files_path}.test.file bs=1048576 count=11")
76
+ on(master, "#{file_bucket_command} -s 11 -f #{test_files_path}/test.file -d #{pattern_file_path}")
67
77
 
68
78
  step 'Push Changes'
69
79
  git_add_commit_push(master, 'production', 'Add large file.', git_environments_path)
@@ -40,12 +40,5 @@ git_add_commit_push(master, 'production', 'Add modules.', git_environments_path)
40
40
  #Tests
41
41
  step 'Attempt to Deploy via r10k'
42
42
  on(master, "#{r10k_fqp} deploy environment -v -p", :acceptable_exit_codes => [0, 1]) do |result|
43
- expect_failure('Expected exit code to be wrong due to RK-101') do
44
- assert_equal(1, result.exit_code, "Expected command to indicate error with exit code")
45
- end
46
-
47
- expect_failure('Expected module to be deployed twice due to RK-101') do
48
- matches = result.stderr.scan(deploy_str)
49
- assert_equal(1, matches.size, "Expected motd module to be deployed once, but deployed #{matches.size}) times")
50
- end
43
+ assert_equal(1, result.exit_code, "Expected command to indicate error with exit code")
51
44
  end
@@ -21,6 +21,16 @@ helloworld_module_path = File.join(local_files_root_path, 'modules', 'helloworld
21
21
  test_files = 'test_files'
22
22
  test_files_path = File.join(git_environments_path, test_files)
23
23
 
24
+ if on(master, 'which python', :acceptable_exit_codes => [0, 1]).exit_code == 1
25
+ python_bin = 'python3'
26
+ else
27
+ python_bin = 'python'
28
+ end
29
+
30
+ file_bucket_path = '/opt/filebucket'
31
+ file_bucket_command_path = File.join(file_bucket_path, 'filebucketapp.py')
32
+ file_bucket_command = "#{python_bin} #{file_bucket_command_path}"
33
+
24
34
  #Manifest
25
35
  site_pp_path = File.join(git_environments_path, 'manifests', 'site.pp')
26
36
  site_pp = create_site_pp(master_certname, ' include helloworld')
@@ -50,8 +60,7 @@ inject_site_pp(master, site_pp_path, site_pp)
50
60
  step 'Create 10,000 Files'
51
61
  create_remote_file(master, File.join(git_environments_path, '.gitattributes'), '*.file binary')
52
62
  on(master, "mkdir -p #{test_files_path}")
53
- # create 10000 1k files with random text
54
- on(master, "for n in {1..10000}; do dd if=/dev/urandom of=#{test_files_path}/test$( printf %03d \"$n\" ).file bs=1024 count=1; done")
63
+ on(master, "#{file_bucket_command} -k -c 10000 -p #{test_files_path}/test -u .file")
55
64
 
56
65
  step 'Create MD5 Checksum of Files'
57
66
  on(master, "cd #{test_files_path};md5sum *.file > #{checksum_file_name}")
@@ -21,6 +21,17 @@ helloworld_module_path = File.join(local_files_root_path, 'modules', 'helloworld
21
21
  test_files = 'test_files'
22
22
  test_files_path = File.join(git_environments_path, 'test_files')
23
23
 
24
+ if on(master, 'which python', :acceptable_exit_codes => [0, 1]).exit_code == 1
25
+ python_bin = 'python3'
26
+ else
27
+ python_bin = 'python'
28
+ end
29
+
30
+ file_bucket_path = '/opt/filebucket'
31
+ file_bucket_command_path = File.join(file_bucket_path, 'filebucketapp.py')
32
+ pattern_file_path = File.join(file_bucket_path, 'psuedo_random_128k.pat')
33
+ file_bucket_command = "#{python_bin} #{file_bucket_command_path}"
34
+
24
35
  #Manifest
25
36
  site_pp_path = File.join(git_environments_path, 'manifests', 'site.pp')
26
37
  site_pp = create_site_pp(master_certname, ' include helloworld')
@@ -50,8 +61,7 @@ inject_site_pp(master, site_pp_path, site_pp)
50
61
  step 'Create Large Binary Files'
51
62
  create_remote_file(master, File.join(git_environments_path, '.gitattributes'), '*.file binary')
52
63
  on(master, "mkdir -p #{test_files_path}")
53
- # create 10 25 MB files with random characters
54
- on(master, "for n in {1..10}; do dd if=/dev/urandom of=#{test_files_path}/test$( printf %03d \"$n\" ).file bs=1048576 count=25; done")
64
+ on(master, "#{file_bucket_command} -c 10 -s 25 -p #{test_files_path}/test -u .file -d #{pattern_file_path}")
55
65
 
56
66
  step 'Create MD5 Checksum of Files'
57
67
  on(master, "cd #{test_files_path};md5sum *.file > #{checksum_file_name}")
@@ -109,7 +109,7 @@ module R10K
109
109
  end
110
110
 
111
111
  def visit_puppetfile(puppetfile)
112
- puppetfile.load(@opts[:'default-branch-override'])
112
+ puppetfile.load
113
113
 
114
114
  yield
115
115
 
@@ -125,24 +125,11 @@ module R10K
125
125
  end
126
126
 
127
127
  def write_environment_info!(environment, started_at, success)
128
- module_deploys = []
129
- begin
130
- environment.puppetfile.modules.each do |mod|
131
- name = mod.name
132
- version = mod.version
133
- sha = mod.repo.head rescue nil
134
- module_deploys.push({:name => name, :version => version, :sha => sha})
135
- end
136
- rescue
137
- logger.debug("Unable to get environment module deploy data for .r10k-deploy.json at #{environment.path}")
138
- end
139
-
140
128
  File.open("#{environment.path}/.r10k-deploy.json", 'w') do |f|
141
129
  deploy_info = environment.info.merge({
142
130
  :started_at => started_at,
143
131
  :finished_at => Time.new,
144
132
  :deploy_success => success,
145
- :module_deploys => module_deploys,
146
133
  })
147
134
 
148
135
  f.puts(JSON.pretty_generate(deploy_info))
@@ -159,7 +146,7 @@ module R10K
159
146
  end
160
147
 
161
148
  def allowed_initialize_opts
162
- super.merge(puppetfile: :self, cachedir: :self, :'no-force' => :self, :'default-branch-override' => :self)
149
+ super.merge(puppetfile: :self, cachedir: :self, :'no-force' => :self)
163
150
  end
164
151
  end
165
152
  end
@@ -8,7 +8,7 @@ module R10K
8
8
  class Check < R10K::Action::Base
9
9
 
10
10
  def call
11
- pf = R10K::Puppetfile.new(@root, @moduledir, @path)
11
+ pf = R10K::Puppetfile.new(@root, @moduledir, @puppetfile)
12
12
  begin
13
13
  pf.load!
14
14
  $stderr.puts _("Syntax OK")
@@ -3,32 +3,20 @@ require 'r10k/action/cri_runner'
3
3
  module R10K
4
4
  module Action
5
5
  module Puppetfile
6
- # Extend the default Cri Runner to use the PUPPETFILE environment
7
- # variables.
6
+ # Extend the default Cri Runner with Puppetfile specific opts
8
7
  #
9
8
  # @api private
10
- # @deprecated The use of these environment variables is deprecated and
11
- # will be removed in 3.0.0.
12
9
  class CriRunner < R10K::Action::CriRunner
13
10
 
14
11
  include R10K::Logging
15
12
 
16
13
  def handle_opts(opts)
17
14
  opts[:root] ||= wd
18
- if env['PUPPETFILE_DIR'] || env['PUPPETFILE']
19
- logger.warn _("The use of the PUPPETFILE and PUPPETFILE_DIR environment variables is deprecated.")
20
- end
21
- opts[:moduledir] ||= env['PUPPETFILE_DIR']
22
- opts[:puppetfile] ||= env['PUPPETFILE']
23
15
  super(opts)
24
16
  end
25
17
 
26
18
  private
27
19
 
28
- def env
29
- ENV
30
- end
31
-
32
20
  def wd
33
21
  Dir.getwd
34
22
  end
@@ -8,7 +8,7 @@ module R10K
8
8
  class Purge < R10K::Action::Base
9
9
 
10
10
  def call
11
- pf = R10K::Puppetfile.new(@root, @moduledir, @path)
11
+ pf = R10K::Puppetfile.new(@root, @moduledir, @puppetfile)
12
12
  pf.load!
13
13
  pf.purge!
14
14
  true
@@ -53,7 +53,6 @@ scheduled. On subsequent deployments, Puppetfile deployment will default to off.
53
53
  DESCRIPTION
54
54
 
55
55
  flag :p, :puppetfile, 'Deploy modules from a puppetfile'
56
- required nil, :'default-branch-override', 'Specify a branchname to override the default branch in the puppetfile'
57
56
 
58
57
  runner R10K::Action::CriRunner.wrap(R10K::Action::Deploy::Environment)
59
58
  end
@@ -44,6 +44,8 @@ Puppetfile (http://bombasticmonkey.com/librarian-puppet/).
44
44
  name 'check'
45
45
  usage 'check'
46
46
  summary 'Try and load the Puppetfile to verify the syntax is correct.'
47
+
48
+ required nil, :puppetfile, 'Path to Puppetfile'
47
49
  runner R10K::Action::Puppetfile::CriRunner.wrap(R10K::Action::Puppetfile::Check)
48
50
  end
49
51
  end
@@ -56,6 +58,8 @@ Puppetfile (http://bombasticmonkey.com/librarian-puppet/).
56
58
  usage 'purge'
57
59
  summary 'Purge unmanaged modules from a Puppetfile managed directory'
58
60
 
61
+ required nil, :moduledir, 'Path to install modules to'
62
+ required nil, :puppetfile, 'Path to Puppetfile'
59
63
  runner R10K::Action::Puppetfile::CriRunner.wrap(R10K::Action::Puppetfile::Purge)
60
64
  end
61
65
  end
@@ -24,6 +24,11 @@ class R10K::Environment::Base
24
24
  # @return [R10K::Puppetfile] The puppetfile instance associated with this environment
25
25
  attr_reader :puppetfile
26
26
 
27
+ # @!attribute [r] puppetfile_name
28
+ # @api public
29
+ # @return [String] The puppetfile name (relative)
30
+ attr_reader :puppetfile_name
31
+
27
32
  # Initialize the given environment.
28
33
  #
29
34
  # @param name [String] The unique name describing this environment.
@@ -36,11 +41,12 @@ class R10K::Environment::Base
36
41
  @basedir = basedir
37
42
  @dirname = dirname
38
43
  @options = options
44
+ @puppetfile_name = options[:puppetfile_name]
39
45
 
40
46
  @full_path = File.join(@basedir, @dirname)
41
47
  @path = Pathname.new(File.join(@basedir, @dirname))
42
48
 
43
- @puppetfile = R10K::Puppetfile.new(@full_path)
49
+ @puppetfile = R10K::Puppetfile.new(@full_path, nil, nil, @puppetfile_name)
44
50
  @puppetfile.environment = self
45
51
  end
46
52