pupistry 1.3.0 → 1.3.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: 8c94c39eb6f50371e99762aee5b7546f60f9897d
4
- data.tar.gz: 3d23604c96dd8e1a1991e71347ef2481428bf00e
3
+ metadata.gz: b194966f9998c32e6272e2d31c7cecded4d58c95
4
+ data.tar.gz: 824e9e3d6e695ede6524c805e12d3b8376521815
5
5
  SHA512:
6
- metadata.gz: 0095ac651397af41960be834d5ed202265920dc1315f3b974b057f5aa5a32a7b132dbb5fd323299f3cfcba6b9b128bc4131bb463e4028d3b4653e1ff19b0746e
7
- data.tar.gz: 2552da2af903929b92f115ee24e017be6e2c39af8b27eab850c1f92159ef5165704ff88421fc52f46ef5e34fc88dbbe053864261ddf0f18205220d729bc167cc
6
+ metadata.gz: e17bd516928ec6db3ddca4e65dc515a3273ddce0dd021622efa574244dd7721d27d3040961d885499b3760112729ed05f088e4c43c4ad700b3958c07514b639e
7
+ data.tar.gz: 0a0f8384d7260a0b1123c094a32cf49f35658361acc7eeb92e57905e7001bf9c033ebcd5553a7af7926eb7738c6b7eeafef171ff170a5117a70eacb8324fb966
@@ -142,7 +142,7 @@ module Pupistry
142
142
  puppet_cmd += " --environment #{environment}"
143
143
  puppet_cmd += " --confdir #{$config['agent']['puppetcode']}"
144
144
  puppet_cmd += " --environmentpath #{$config['agent']['puppetcode']}"
145
- puppet_cmd += " --modulepath #{$config['agent']['puppetcode']}/#{environment}/modules/"
145
+ puppet_cmd += " --modulepath #{build_modulepath(environment)}"
146
146
  puppet_cmd += " --hiera_config #{$config['agent']['puppetcode']}/#{environment}/hiera.yaml"
147
147
  puppet_cmd += " #{$config['agent']['puppetcode']}/#{environment}/manifests/site.pp"
148
148
 
@@ -151,6 +151,33 @@ module Pupistry
151
151
 
152
152
  $logger.error 'An unexpected issue occured when running puppet' unless system puppet_cmd
153
153
  end
154
+
155
+ def self.build_modulepath(environment)
156
+
157
+ environment_path = "#{$config['agent']['puppetcode']}/#{environment}"
158
+ environment_conf = "#{environment_path}/environment.conf"
159
+
160
+ configured_paths = []
161
+
162
+ if File.exist?(environment_conf)
163
+ $logger.debug "Adding modulepath config from '#{environment_path}'"
164
+
165
+ File.open(environment_conf, 'r').readlines.each do |line|
166
+ if line !~ /^\s*#/ && /^(.*)=(.*)/ =~ line
167
+ key, val = $1.strip, $2.strip
168
+ configured_paths = val.split(':') if key == 'modulepath'
169
+ end
170
+ end
171
+ end
172
+
173
+ modulepaths = configured_paths.map { |path| File.expand_path(path, environment_path) }
174
+
175
+ # Ensure '<environment_path>/modules' in modulepath.
176
+ ensure_path = File.expand_path('modules', environment_path)
177
+ modulepaths.insert(0, ensure_path) unless modulepaths.include? ensure_path
178
+
179
+ modulepaths.join(File::PATH_SEPARATOR)
180
+ end
154
181
  end
155
182
  end
156
183
 
@@ -1,3 +1,3 @@
1
1
  module Pupistry
2
- VERSION = '1.3.0'
2
+ VERSION = '1.3.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pupistry
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jethro Carr
@@ -237,3 +237,4 @@ signing_key:
237
237
  specification_version: 4
238
238
  summary: A workflow tool for Puppet Masterless Deployments
239
239
  test_files: []
240
+ has_rdoc: