r10k 3.2.0 → 3.2.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4e4eadf9d07ce0163d2ec4a20c748956fda46c7c
4
- data.tar.gz: c89ec234651cb578c26df88d02ee0196406abf0a
3
+ metadata.gz: 975a72d1fc4846986b4cb47f8f3a1b2e1a74d69e
4
+ data.tar.gz: 2ff84a7c70d6282b83b48400299507532f57c520
5
5
  SHA512:
6
- metadata.gz: 5be4326a9c9fddc77c1c84daa5deb557059b2f876beb278c97d7f8c36e3c742ec39aeeed6231b3087490b696b7655de39569524b18acf0103c29f3ab41ba17a1
7
- data.tar.gz: 7ee4a185142460a472ceb7f7b09c66bf3bbe03abf5de5a99e66a6cf62476b18ffc870e4fafb020c8146a8f854330979baee3b9b4e1da56237e028cd995a6bfef
6
+ metadata.gz: 64e6faee87cc61490d08d197c2f96b5c2f700027e83de9383c628b2fe77fa12fc2717d6b9dfa8c1e239c89ad2530d88e675bb421efaff308f384a499fb11cb28
7
+ data.tar.gz: a74bc080bfe5e61eb0f36ee5da57937fd667ef909a35f582bab5d101ae1b252abf1241d0f23957690277ec7200b037f27f2de72800ee26eb0ee08c47a7bb8c01
@@ -1,14 +1,12 @@
1
1
  ---
2
2
  language: ruby
3
- services:
4
- - docker
5
3
  bundler_args: "--without system"
6
4
  script: "bundle exec rspec --color --format documentation spec/unit"
7
5
  notifications:
8
6
  email: false
9
7
  sudo: false
10
8
  jdk:
11
- - oraclejdk8
9
+ - openjdk8
12
10
  before_install: gem install bundler -v '< 2' --no-document
13
11
  matrix:
14
12
  include:
@@ -20,7 +18,3 @@ matrix:
20
18
  rvm: 2.3.0
21
19
  - stage: r10k tests
22
20
  rvm: jruby
23
- - stage: r10k container tests
24
- language: generic
25
- script:
26
- - cd docker && make lint && make build && make test
@@ -1,86 +1,101 @@
1
1
  CHANGELOG
2
2
  =========
3
3
 
4
+ 3.2.1
5
+ ----
6
+
7
+ ### Changes
8
+ - Flag for overriding default branch configuration in Puppetfile
9
+ - Plumbing for internationalization
10
+ - Numerous test fixes and legacy docker work
11
+
4
12
  3.2.0
5
13
  -----
6
14
 
7
- ## New Feature
15
+ ### Changes
8
16
 
9
- Add support for running `puppet generate types`
17
+ - Add support for running `puppet generate types`
10
18
 
11
19
  3.1.1
12
20
  -----
13
21
 
14
- ## Bug Fixes
22
+ ### Changes
15
23
 
16
- (RK-335) Postrun `modifiedenvs` doesn't include environment prefixes
24
+ - (RK-335) Postrun `modifiedenvs` doesn't include environment prefixes
17
25
 
18
26
  3.1.0
19
27
  -----
20
28
 
21
- ## New Feature
29
+ ### Changes
22
30
 
23
- Substitute environments acted on in postrun command.
31
+ - Substitute environments acted on in postrun command.
24
32
 
25
- Now post run commands that contain the string "$modifiedenvs"
26
- (eg. ["/usr/local/bin/my-postrun-cmd", "--verbose", "$modifiedenvs"])
27
- will have the string substituted with a space separated list
28
- of environments acted upon (either a single environment if
29
- specified on the command line or all environments).
33
+ Now post run commands that contain the string "$modifiedenvs"
34
+ (eg. ["/usr/local/bin/my-postrun-cmd", "--verbose", "$modifiedenvs"])
35
+ will have the string substituted with a space separated list
36
+ of environments acted upon (either a single environment if
37
+ specified on the command line or all environments).
30
38
 
31
- Specifically this should allow users to easily wrap
32
- `puppet generate types` and matches the terminology used
33
- in g10k.
39
+ Specifically this should allow users to easily wrap
40
+ `puppet generate types` and matches the terminology used
41
+ in g10k.
34
42
 
35
- Many thanks to @raphink for the contribution.
43
+ Many thanks to @raphink for the contribution.
36
44
 
45
+ 3.0.4
46
+ ----
47
+
48
+ ### Changes
49
+ - Flag for overriding default branch configuration in Puppetfile
50
+ - Plumbing for internationalization
51
+ - Numerous test fixes and legacy docker work
37
52
 
38
53
  3.0.3
39
54
  ----
40
55
 
41
- ## Bug Fixes
56
+ ### Changes
42
57
 
43
- (RK-324) Fix Ruby pipe bug affecting Ubuntu
58
+ - (RK-324) Fix Ruby pipe bug affecting Ubuntu
44
59
 
45
60
  3.0.2
46
61
  ----
47
62
 
48
- ## Changes
63
+ ### Changes
49
64
 
50
- Minor test fixes.
65
+ - Minor test fixes.
51
66
 
52
67
  3.0.1
53
68
  ----
54
69
 
55
- ## Changes
70
+ ### Changes
56
71
 
57
72
  Because of dependency issues R10K 3.0.0 required Ruby >= 2.3
58
73
  rather than the reported 2.0. This release makes the requirement of
59
74
  Ruby >= 2.3 official and documented.
60
75
 
61
- (#853) ([RK-327](https://tickets.puppetlabs.com/browse/RK-327) Uninitialized Constant Cri::Error
62
- When resolving the Cri dependency >= 2.13 R10K would fail with an
63
- uninitialized constant error. Thanks to @ostavnaas for the bug report,
64
- @ddfreyne for the fix, and @baurmatt for the review.
76
+ - (#853) ([RK-327](https://tickets.puppetlabs.com/browse/RK-327) Uninitialized Constant Cri::Error
77
+ When resolving the Cri dependency >= 2.13 R10K would fail with an
78
+ uninitialized constant error. Thanks to @ostavnaas for the bug report,
79
+ @ddfreyne for the fix, and @baurmatt for the review.
65
80
 
66
81
 
67
82
  3.0.0
68
83
  ----
69
84
 
70
- ## Changes
85
+ ### Changes
71
86
 
72
- ### Known issues
87
+ #### Known issues
73
88
  - Child processes may die unexpectedly when deploying many environments
74
89
  on Ubuntu Bionic. See
75
90
  [RK-324](https://tickets.puppetlabs.com/browse/RK-324).
76
91
 
77
- ### Backwards breaking changes
92
+ #### Backwards breaking changes
78
93
  - Drop support for Ruby < 2.0
79
94
  - Remove support for PUPPETFILE and PUPPETFILE_DIR environment variables
80
95
  when running the `puppetfile` action, please use flags instead.
81
96
  - Fail when duplicate module definitions in Puppetfile
82
97
 
83
- ### Bug fixes
98
+ #### Bug fixes
84
99
  - More reliable pruning of refs on fetch
85
100
  - Improved error messaging when:
86
101
  - Unable to connect to a proxy
@@ -88,24 +103,32 @@ Ruby >= 2.3 official and documented.
88
103
  - Unable to parse Puppetfile
89
104
  - Various perfomance improvements
90
105
 
106
+ 2.6.6
107
+ ----
108
+
109
+ ### Changes
110
+ - Flag for overriding default branch configuration in Puppetfile
111
+ - Plumbing for internationalization
112
+ - Numerous test fixes and legacy docker work
91
113
 
92
114
  2.6.5
93
115
  ----
94
116
 
95
- ## Bug Fix
117
+ ### Bug Fix
96
118
 
97
119
  (RK-324) Fix Ruby pipe bug affecting Ubuntu
98
120
 
99
121
  2.6.4
100
122
  ----
101
123
 
102
- ## Changes
124
+ ### Changes
103
125
 
104
126
  Numerous test fixes.
105
127
 
106
128
  2.6.3
107
129
  ----
108
- ## Changes
130
+
131
+ ### Changes
109
132
 
110
133
  Update specs with new error string.
111
134
 
@@ -114,6 +137,7 @@ when a release is made on that branch.
114
137
 
115
138
  2.6.2
116
139
  -----
140
+
117
141
  ### Changes
118
142
 
119
143
  (RK-311) Yard dependency updated for security fix.
@@ -73,6 +73,13 @@ proxy: 'http://user:password@proxy.example.com:3128'
73
73
 
74
74
  The proxy server being used will be logged at the "debug" level when r10k runs.
75
75
 
76
+ ### pool_size
77
+
78
+ The pool_size setting is a number to determine how many threads should be spawn
79
+ while updating modules. The default value is 1, which means the default behaviour
80
+ is to update modules in a serial manner. Increasing this number should bring
81
+ some performance gains.
82
+
76
83
  ### git
77
84
 
78
85
  The 'git' setting is a hash that contains Git specific settings.
@@ -60,6 +60,18 @@ Update a single environment and force an update of modules:
60
60
  This will update the given environment and update all contained modules. This is
61
61
  useful if you want to make sure that a given environment is fully up to date.
62
62
 
63
+ - - -
64
+
65
+ Update a single environment and specify a default branch override:
66
+
67
+ r10k deploy environment my_working_environment --puppetfile --default-branch-override default_branch_override
68
+
69
+ This will update the given environment and update all contained modules, overrideing
70
+ the :default_branch entry in the Puppetfile of each module. This is used primarily to allow
71
+ automated r10k solutions using the control_branch pattern with a temporary branch deployment to
72
+ ensure the deployment is pushed to the correct module repository branch. Note that the :default_branch
73
+ is only ever utilized if the desired ref cannot be located.
74
+
63
75
  ### Deploying modules
64
76
 
65
77
  Update a single module across all environments:
@@ -24,7 +24,6 @@ pre-suite/00_pe_install.rb,
24
24
  component/pre-suite/05_install_dev_r10k.rb,
25
25
  pre-suite/10_git_config.rb,
26
26
  pre-suite/20_pe_r10k.rb,
27
- pre-suite/30_test_utils.rb,
28
27
  EOS
29
28
  common_setup.gsub!("\n", '')
30
29
 
@@ -20,17 +20,6 @@ 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
-
34
23
  test_files_path = File.join(git_environments_path, 'test_files')
35
24
 
36
25
  #In-line files
@@ -73,7 +62,8 @@ on(master, "mount -osize=10m tmpfs #{tmpfs_path} -t tmpfs")
73
62
  step 'Create Large Binary File'
74
63
  create_remote_file(master, File.join(git_environments_path, '.gitattributes'), '*.file binary')
75
64
  on(master, "mkdir -p #{test_files_path}")
76
- on(master, "#{file_bucket_command} -s 11 -f #{test_files_path}/test.file -d #{pattern_file_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")
77
67
 
78
68
  step 'Push Changes'
79
69
  git_add_commit_push(master, 'production', 'Add large file.', git_environments_path)
@@ -21,16 +21,6 @@ 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
-
34
24
  #Manifest
35
25
  site_pp_path = File.join(git_environments_path, 'manifests', 'site.pp')
36
26
  site_pp = create_site_pp(master_certname, ' include helloworld')
@@ -60,7 +50,8 @@ inject_site_pp(master, site_pp_path, site_pp)
60
50
  step 'Create 10,000 Files'
61
51
  create_remote_file(master, File.join(git_environments_path, '.gitattributes'), '*.file binary')
62
52
  on(master, "mkdir -p #{test_files_path}")
63
- on(master, "#{file_bucket_command} -k -c 10000 -p #{test_files_path}/test -u .file")
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")
64
55
 
65
56
  step 'Create MD5 Checksum of Files'
66
57
  on(master, "cd #{test_files_path};md5sum *.file > #{checksum_file_name}")
@@ -21,17 +21,6 @@ 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
-
35
24
  #Manifest
36
25
  site_pp_path = File.join(git_environments_path, 'manifests', 'site.pp')
37
26
  site_pp = create_site_pp(master_certname, ' include helloworld')
@@ -61,7 +50,8 @@ inject_site_pp(master, site_pp_path, site_pp)
61
50
  step 'Create Large Binary Files'
62
51
  create_remote_file(master, File.join(git_environments_path, '.gitattributes'), '*.file binary')
63
52
  on(master, "mkdir -p #{test_files_path}")
64
- on(master, "#{file_bucket_command} -c 10 -s 25 -p #{test_files_path}/test -u .file -d #{pattern_file_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")
65
55
 
66
56
  step 'Create MD5 Checksum of Files'
67
57
  on(master, "cd #{test_files_path};md5sum *.file > #{checksum_file_name}")
@@ -129,7 +129,7 @@ module R10K
129
129
  end
130
130
 
131
131
  def visit_puppetfile(puppetfile)
132
- puppetfile.load
132
+ puppetfile.load(@opts[:'default-branch-override'])
133
133
 
134
134
  yield
135
135
 
@@ -166,7 +166,12 @@ module R10K
166
166
  end
167
167
 
168
168
  def allowed_initialize_opts
169
- super.merge(puppetfile: :self, cachedir: :self, 'no-force': :self, 'generate-types': :self, 'puppet-path': :self)
169
+ super.merge(puppetfile: :self,
170
+ cachedir: :self,
171
+ 'no-force': :self,
172
+ 'generate-types': :self,
173
+ 'puppet-path': :self,
174
+ 'default-branch-override': :self)
170
175
  end
171
176
  end
172
177
  end
@@ -61,6 +61,7 @@ scheduled. On subsequent deployments, Puppetfile deployment will default to off.
61
61
  DESCRIPTION
62
62
 
63
63
  flag :p, :puppetfile, 'Deploy modules from a puppetfile'
64
+ required nil, :'default-branch-override', 'Specify a branchname to override the default branch in the puppetfile'
64
65
 
65
66
  runner R10K::Action::CriRunner.wrap(R10K::Action::Deploy::Environment)
66
67
  end
@@ -34,6 +34,7 @@ module R10K
34
34
 
35
35
  with_setting(:cachedir) { |value| R10K::Git::Cache.settings[:cache_root] = value }
36
36
  with_setting(:cachedir) { |value| R10K::Forge::ModuleRelease.settings[:cache_root] = value }
37
+ with_setting(:pool_size) { |value| R10K::Puppetfile.settings[:pool_size] = value }
37
38
 
38
39
  with_setting(:git) { |value| GitInitializer.new(value).call }
39
40
  with_setting(:forge) { |value| ForgeInitializer.new(value).call }
@@ -23,6 +23,11 @@ class R10K::Module::Git < R10K::Module::Base
23
23
  # @return [String]
24
24
  attr_reader :desired_ref
25
25
 
26
+ # @!attribute [r] default_ref
27
+ # @api private
28
+ # @return [String]
29
+ attr_reader :default_ref
30
+
26
31
  def initialize(title, dirname, args, environment=nil)
27
32
  super
28
33
 
@@ -1,3 +1,4 @@
1
+ require 'thread'
1
2
  require 'pathname'
2
3
  require 'r10k/module'
3
4
  require 'r10k/util/purgeable'
@@ -7,6 +8,10 @@ module R10K
7
8
  class Puppetfile
8
9
  # Defines the data members of a Puppetfile
9
10
 
11
+ include R10K::Settings::Mixin
12
+
13
+ def_setting_attr :pool_size, 1
14
+
10
15
  include R10K::Logging
11
16
 
12
17
  # @!attribute [r] forge
@@ -58,17 +63,20 @@ class Puppetfile
58
63
  @loaded = false
59
64
  end
60
65
 
61
- def load
66
+ def load(default_branch_override = nil)
62
67
  if File.readable? @puppetfile_path
63
- self.load!
68
+ self.load!(default_branch_override)
64
69
  else
65
70
  logger.debug _("Puppetfile %{path} missing or unreadable") % {path: @puppetfile_path.inspect}
66
71
  end
67
72
  end
68
73
 
69
- def load!
74
+ def load!(default_branch_override = nil)
75
+ @default_branch_override = default_branch_override
76
+
70
77
  dsl = R10K::Puppetfile::DSL.new(self)
71
78
  dsl.instance_eval(puppetfile_contents, @puppetfile_path)
79
+
72
80
  validate_no_duplicate_names(@modules)
73
81
  @loaded = true
74
82
  rescue SyntaxError, LoadError, ArgumentError, NameError => e
@@ -113,6 +121,10 @@ class Puppetfile
113
121
  install_path = @moduledir
114
122
  end
115
123
 
124
+ if args.is_a?(Hash) && @default_branch_override != nil
125
+ args[:default_branch] = @default_branch_override
126
+ end
127
+
116
128
  # Keep track of all the content this Puppetfile is managing to enable purging.
117
129
  @managed_content[install_path] = Array.new unless @managed_content.has_key?(install_path)
118
130
 
@@ -152,6 +164,17 @@ class Puppetfile
152
164
  end
153
165
 
154
166
  def accept(visitor)
167
+ pool_size = self.settings[:pool_size]
168
+ if pool_size > 1
169
+ concurrent_accept(visitor, pool_size)
170
+ else
171
+ serial_accept(visitor)
172
+ end
173
+ end
174
+
175
+ private
176
+
177
+ def serial_accept(visitor)
155
178
  visitor.visit(:puppetfile, self) do
156
179
  modules.each do |mod|
157
180
  mod.accept(visitor)
@@ -159,7 +182,31 @@ class Puppetfile
159
182
  end
160
183
  end
161
184
 
162
- private
185
+ def concurrent_accept(visitor, pool_size)
186
+ logger.debug _("Updating modules with %{pool_size} threads") % {pool_size: pool_size}
187
+ mods_queue = modules_queue(visitor)
188
+ thread_pool = pool_size.times.map { visitor_thread(visitor, mods_queue) }
189
+ thread_pool.each(&:join)
190
+ end
191
+
192
+ def modules_queue(visitor)
193
+ Queue.new.tap do |queue|
194
+ visitor.visit(:puppetfile, self) do
195
+ modules.each { |mod| queue << mod }
196
+ end
197
+ end
198
+ end
199
+
200
+ def visitor_thread(visitor, mods_queue)
201
+ Thread.new do
202
+ begin
203
+ while mod = mods_queue.pop(true) do mod.accept(visitor) end
204
+ rescue ThreadError => e
205
+ logger.error _("Thread error during concurrent module deploy: %{message}") % {message: e.message}
206
+ Thread.exit
207
+ end
208
+ end
209
+ end
163
210
 
164
211
  def puppetfile_contents
165
212
  File.read(@puppetfile_path)
@@ -158,6 +158,19 @@ module R10K
158
158
  end
159
159
  }),
160
160
 
161
+ Definition.new(:pool_size, {
162
+ :desc => "The amount of threads used to concurrently install modules. The default value is 1: install one module at a time.",
163
+ :default => 1,
164
+ :validate => lambda do |value|
165
+ if !value.is_a?(Integer)
166
+ raise ArgumentError, "The pool_size setting should be an integer, not a #{value.class}"
167
+ end
168
+ if !(value > 0)
169
+ raise ArgumentError, "The pool_size setting should be greater than zero."
170
+ end
171
+ end
172
+ }),
173
+
161
174
  URIDefinition.new(:proxy, {
162
175
  :desc => "Proxy to use for all r10k operations which occur over HTTP(S).",
163
176
  :default => lambda {
@@ -32,7 +32,11 @@ class R10K::Settings::Container
32
32
  if @settings[key]
33
33
  @settings[key]
34
34
  elsif @parent && (pkey = @parent[key])
35
- @settings[key] = pkey.dup
35
+ begin
36
+ @settings[key] = pkey.dup
37
+ rescue TypeError
38
+ @settings[key] = pkey
39
+ end
36
40
  @settings[key]
37
41
  end
38
42
  end
@@ -1,3 +1,3 @@
1
1
  module R10K
2
- VERSION = '3.2.0'
2
+ VERSION = '3.2.1'
3
3
  end
@@ -1,16 +1,16 @@
1
1
  # SOME DESCRIPTIVE TITLE.
2
- # Copyright (C) 2018 Puppet, Inc.
2
+ # Copyright (C) 2019 Puppet, Inc.
3
3
  # This file is distributed under the same license as the r10k package.
4
- # FIRST AUTHOR <EMAIL@ADDRESS>, 2018.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, 2019.
5
5
  #
6
6
  #, fuzzy
7
7
  msgid ""
8
8
  msgstr ""
9
- "Project-Id-Version: r10k 3.0.3-15-gfa546f5\n"
9
+ "Project-Id-Version: r10k 3.2.0-7-g213f14b\n"
10
10
  "\n"
11
11
  "Report-Msgid-Bugs-To: docs@puppetlabs.com\n"
12
- "POT-Creation-Date: 2018-12-05 22:18+0000\n"
13
- "PO-Revision-Date: 2018-12-05 22:18+0000\n"
12
+ "POT-Creation-Date: 2019-04-18 21:10+0000\n"
13
+ "PO-Revision-Date: 2019-04-18 21:10+0000\n"
14
14
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
15
15
  "Language-Team: LANGUAGE <LL@li.org>\n"
16
16
  "Language: \n"
@@ -31,27 +31,27 @@ msgstr ""
31
31
  msgid "Reason: %{write_lock}"
32
32
  msgstr ""
33
33
 
34
- #: ../lib/r10k/action/deploy/environment.rb:56
34
+ #: ../lib/r10k/action/deploy/environment.rb:57
35
35
  msgid "Environment(s) \\'%{environments}\\' cannot be found in any source and will not be deployed."
36
36
  msgstr ""
37
37
 
38
- #: ../lib/r10k/action/deploy/environment.rb:79
38
+ #: ../lib/r10k/action/deploy/environment.rb:85
39
39
  msgid "Environment %{env_dir} does not match environment name filter, skipping"
40
40
  msgstr ""
41
41
 
42
- #: ../lib/r10k/action/deploy/environment.rb:86
42
+ #: ../lib/r10k/action/deploy/environment.rb:93
43
43
  msgid "Deploying environment %{env_path}"
44
44
  msgstr ""
45
45
 
46
- #: ../lib/r10k/action/deploy/environment.rb:89
46
+ #: ../lib/r10k/action/deploy/environment.rb:96
47
47
  msgid "Environment %{env_dir} is now at %{env_signature}"
48
48
  msgstr ""
49
49
 
50
- #: ../lib/r10k/action/deploy/environment.rb:93
50
+ #: ../lib/r10k/action/deploy/environment.rb:100
51
51
  msgid "Environment %{env_dir} is new, updating all modules"
52
52
  msgstr ""
53
53
 
54
- #: ../lib/r10k/action/deploy/environment.rb:123
54
+ #: ../lib/r10k/action/deploy/environment.rb:143
55
55
  msgid "Deploying Puppetfile content %{mod_path}"
56
56
  msgstr ""
57
57
 
@@ -67,7 +67,7 @@ msgstr ""
67
67
  msgid "Deploying module %{mod_path}"
68
68
  msgstr ""
69
69
 
70
- #: ../lib/r10k/action/deploy/module.rb:66
70
+ #: ../lib/r10k/action/deploy/module.rb:70
71
71
  msgid "Only updating modules %{modules}, skipping module %{mod_name}"
72
72
  msgstr ""
73
73
 
@@ -83,15 +83,15 @@ msgstr ""
83
83
  msgid "Cannot track control repo branch for content '%{name}' when not part of a 'deploy' action, will use default if available."
84
84
  msgstr ""
85
85
 
86
- #: ../lib/r10k/action/runner.rb:49 ../lib/r10k/deployment/config.rb:42
86
+ #: ../lib/r10k/action/runner.rb:53 ../lib/r10k/deployment/config.rb:42
87
87
  msgid "Overriding config file setting '%{key}': '%{old_val}' -> '%{new_val}'"
88
88
  msgstr ""
89
89
 
90
- #: ../lib/r10k/action/runner.rb:82
90
+ #: ../lib/r10k/action/runner.rb:86
91
91
  msgid "Reading configuration from %{config_path}"
92
92
  msgstr ""
93
93
 
94
- #: ../lib/r10k/action/runner.rb:85
94
+ #: ../lib/r10k/action/runner.rb:89
95
95
  msgid "No config file explicitly given and no default config file could be found, default settings will be used."
96
96
  msgstr ""
97
97
 
@@ -103,7 +103,7 @@ msgstr ""
103
103
  msgid "Unable to load sources; the supplied configuration does not define the 'sources' key"
104
104
  msgstr ""
105
105
 
106
- #: ../lib/r10k/environment/base.rb:59 ../lib/r10k/environment/base.rb:75 ../lib/r10k/environment/base.rb:84 ../lib/r10k/source/base.rb:64
106
+ #: ../lib/r10k/environment/base.rb:61 ../lib/r10k/environment/base.rb:77 ../lib/r10k/environment/base.rb:86 ../lib/r10k/source/base.rb:64
107
107
  msgid "%{class} has not implemented method %{method}"
108
108
  msgstr ""
109
109
 
@@ -295,7 +295,7 @@ msgstr ""
295
295
  msgid "Module %{name} with args %{args} doesn't have an implementation. (Are you using the right arguments?)"
296
296
  msgstr ""
297
297
 
298
- #: ../lib/r10k/module/base.rb:101
298
+ #: ../lib/r10k/module/base.rb:105
299
299
  msgid "Module name (%{title}) must match either 'modulename' or 'owner/modulename'"
300
300
  msgstr ""
301
301
 
@@ -319,27 +319,35 @@ msgstr ""
319
319
  msgid "Could not read metadata.json"
320
320
  msgstr ""
321
321
 
322
- #: ../lib/r10k/puppetfile.rb:52
322
+ #: ../lib/r10k/puppetfile.rb:57
323
323
  msgid "Using Puppetfile '%{puppetfile}'"
324
324
  msgstr ""
325
325
 
326
- #: ../lib/r10k/puppetfile.rb:65
326
+ #: ../lib/r10k/puppetfile.rb:70
327
327
  msgid "Puppetfile %{path} missing or unreadable"
328
328
  msgstr ""
329
329
 
330
- #: ../lib/r10k/puppetfile.rb:75
330
+ #: ../lib/r10k/puppetfile.rb:80
331
331
  msgid "Failed to evaluate %{path}"
332
332
  msgstr ""
333
333
 
334
- #: ../lib/r10k/puppetfile.rb:85
334
+ #: ../lib/r10k/puppetfile.rb:90
335
335
  msgid "Puppetfiles cannot contain duplicate module names."
336
336
  msgstr ""
337
337
 
338
- #: ../lib/r10k/puppetfile.rb:87
338
+ #: ../lib/r10k/puppetfile.rb:92
339
339
  msgid "Remove the duplicates of the following modules: %{dupes}"
340
340
  msgstr ""
341
341
 
342
- #: ../lib/r10k/puppetfile.rb:213
342
+ #: ../lib/r10k/puppetfile.rb:179
343
+ msgid "Updating modules with %{pool_size} threads"
344
+ msgstr ""
345
+
346
+ #: ../lib/r10k/puppetfile.rb:198
347
+ msgid "Thread error during concurrent module deploy: %{message}"
348
+ msgstr ""
349
+
350
+ #: ../lib/r10k/puppetfile.rb:253
343
351
  msgid "unrecognized declaration '%{method}'"
344
352
  msgstr ""
345
353
 
@@ -351,7 +359,7 @@ msgstr ""
351
359
  msgid "Validation failed for settings group"
352
360
  msgstr ""
353
361
 
354
- #: ../lib/r10k/settings/container.rb:87
362
+ #: ../lib/r10k/settings/container.rb:91
355
363
  msgid "Key %{key} is not a valid key"
356
364
  msgstr ""
357
365
 
@@ -0,0 +1,5 @@
1
+ mod 'cd4pe',
2
+ :git => 'test@randomurl.com:something/some_module.git',
3
+ :ref => 'expected_ref',
4
+ :default_branch => 'here_lies_the_default_branch'
5
+
@@ -19,6 +19,10 @@ describe R10K::Action::Deploy::Environment do
19
19
  described_class.new({puppetfile: true}, [])
20
20
  end
21
21
 
22
+ it "can accept a default_branch_override option" do
23
+ described_class.new({:'default-branch-override' => 'default_branch_override_name'}, [])
24
+ end
25
+
22
26
  it "can accept a no-force option" do
23
27
  described_class.new({:'no-force' => true}, [])
24
28
  end
@@ -227,6 +227,25 @@ describe R10K::Puppetfile do
227
227
  subject = described_class.new(path)
228
228
  expect { subject.load! }.not_to raise_error
229
229
  end
230
+
231
+ it "creates a git module and applies the default branch sepcified in the Puppetfile" do
232
+ path = File.join(PROJECT_ROOT, 'spec', 'fixtures', 'unit', 'puppetfile', 'default-branch-override')
233
+ pf_path = File.join(path, 'Puppetfile')
234
+ subject = described_class.new(path)
235
+ expect { subject.load! }.not_to raise_error
236
+ git_module = subject.modules[0]
237
+ expect(git_module.default_ref).to eq 'here_lies_the_default_branch'
238
+ end
239
+
240
+ it "creates a git module and applies the provided default_branch_override" do
241
+ path = File.join(PROJECT_ROOT, 'spec', 'fixtures', 'unit', 'puppetfile', 'default-branch-override')
242
+ pf_path = File.join(path, 'Puppetfile')
243
+ subject = described_class.new(path)
244
+ default_branch_override = 'default_branch_override_name'
245
+ expect { subject.load!(default_branch_override) }.not_to raise_error
246
+ git_module = subject.modules[0]
247
+ expect(git_module.default_ref).to eq default_branch_override
248
+ end
230
249
  end
231
250
 
232
251
  describe "accepting a visitor" do
@@ -252,5 +271,30 @@ describe R10K::Puppetfile do
252
271
  expect(subject).to receive(:modules).and_return([mod1, mod2])
253
272
  subject.accept(visitor)
254
273
  end
274
+
275
+ it "creates a thread pool to visit concurrently if pool_size setting is greater than one" do
276
+ pool_size = 3
277
+
278
+ subject.settings[:pool_size] = pool_size
279
+
280
+ visitor = spy('visitor')
281
+ expect(visitor).to receive(:visit) do |type, other, &block|
282
+ expect(type).to eq :puppetfile
283
+ expect(other).to eq subject
284
+ block.call
285
+ end
286
+
287
+ mod1 = spy('module')
288
+ expect(mod1).to receive(:accept).with(visitor)
289
+ mod2 = spy('module')
290
+ expect(mod2).to receive(:accept).with(visitor)
291
+
292
+ expect(subject).to receive(:modules).and_return([mod1, mod2])
293
+
294
+ expect(Thread).to receive(:new).exactly(pool_size).and_call_original
295
+ expect(Queue).to receive(:new).and_call_original
296
+
297
+ subject.accept(visitor)
298
+ end
255
299
  end
256
300
  end
@@ -165,6 +165,41 @@ describe R10K::Settings do
165
165
  end
166
166
  end
167
167
 
168
+ describe "pool_size" do
169
+ it "accepts integers greater than zero" do
170
+ output = subject.evaluate("pool_size" => 5)
171
+ expect(output[:pool_size]).to eq 5
172
+ end
173
+
174
+ it "rejects non integer values" do
175
+ expect {
176
+ subject.evaluate("pool_size" => "5")
177
+ }.to raise_error do |err|
178
+ expect(err.errors.size).to eq 1
179
+ expect(err.errors[:pool_size]).to be_a_kind_of(ArgumentError)
180
+ expect(err.errors[:pool_size].message).to match(/The pool_size setting should be an integer/)
181
+ end
182
+ end
183
+
184
+ it "rejects integers smaller than one" do
185
+ expect {
186
+ subject.evaluate("pool_size" => 0)
187
+ }.to raise_error do |err|
188
+ expect(err.errors.size).to eq 1
189
+ expect(err.errors[:pool_size]).to be_a_kind_of(ArgumentError)
190
+ expect(err.errors[:pool_size].message).to match(/The pool_size setting should be greater than zero/)
191
+ end
192
+
193
+ expect {
194
+ subject.evaluate("pool_size" => -3)
195
+ }.to raise_error do |err|
196
+ expect(err.errors.size).to eq 1
197
+ expect(err.errors[:pool_size]).to be_a_kind_of(ArgumentError)
198
+ expect(err.errors[:pool_size].message).to match(/The pool_size setting should be greater than zero/)
199
+ end
200
+ end
201
+ end
202
+
168
203
  describe "proxy" do
169
204
  it "accepts valid URIs" do
170
205
  output = subject.evaluate("proxy" => "http://proxy.tessier-ashpool.freeside:3128")
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: 3.2.0
4
+ version: 3.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrien Thebo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-16 00:00:00.000000000 Z
11
+ date: 2019-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colored
@@ -221,7 +221,6 @@ files:
221
221
  - integration/pre-suite/00_pe_install.rb
222
222
  - integration/pre-suite/10_git_config.rb
223
223
  - integration/pre-suite/20_pe_r10k.rb
224
- - integration/pre-suite/30_test_utils.rb
225
224
  - integration/pre-suite/README.mkd
226
225
  - integration/scripts/README.mkd
227
226
  - integration/scripts/setup_r10k_env_centos5.sh
@@ -412,6 +411,7 @@ files:
412
411
  - spec/fixtures/unit/action/r10k_generate_types.yaml
413
412
  - spec/fixtures/unit/action/r10k_puppet_path.yaml
414
413
  - spec/fixtures/unit/puppetfile/argument-error/Puppetfile
414
+ - spec/fixtures/unit/puppetfile/default-branch-override/Puppetfile
415
415
  - spec/fixtures/unit/puppetfile/duplicate-module-error/Puppetfile
416
416
  - spec/fixtures/unit/puppetfile/invalid-syntax/Puppetfile
417
417
  - spec/fixtures/unit/puppetfile/load-error/Puppetfile
@@ -1,17 +0,0 @@
1
- test_name 'CODEMGMT-62 - C63199 - Install Utilities for r10k Integration Testing'
2
-
3
- #Init
4
- filebucket_path = '/opt/filebucket'
5
- filebucket_script_path = '/etc/profile.d/filebucket_path.sh'
6
-
7
- filebucket_script = <<-SCRIPT
8
- #!/bin/bash
9
- export PATH="${PATH}:#{filebucket_path}"
10
- SCRIPT
11
-
12
- step 'Install "filebucket" File Generator'
13
- create_remote_file(master, filebucket_script_path, filebucket_script)
14
- on(master, "git clone git://github.com/puppetlabs/filebucket.git #{filebucket_path}")
15
-
16
- on(master, "chmod 755 #{filebucket_script_path}")
17
- on(master, "chmod 755 #{filebucket_path}/filebucketapp.py")