Skip to content

Commit 8805b61

Browse files
authored
Merge pull request #95 from github/kpaulisse-1-0-4
Version 1.0.4 release
2 parents b024941 + 7cf9dfe commit 8805b61

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.0.3
1+
1.0.4

doc/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@
88
</tr>
99
</thead><tbody>
1010
<tr valign=top>
11+
<td>1.0.4</td>
12+
<td>2017-03-17</td>
13+
<td>
14+
<li><a href="https://github.com/github/octocatalog-diff/pull/94">#94</a>: Make Puppet version check respect env vars</li>
15+
</td>
16+
</tr>
17+
<tr valign=top>
1118
<td>1.0.3</td>
1219
<td>2017-03-15</td>
1320
<td>

lib/octocatalog-diff/catalog/computed.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def build(logger = Logger.new(StringIO.new))
6868
# @return [String] Puppet version
6969
def puppet_version
7070
raise ArgumentError, '"puppet_binary" was not passed to OctocatalogDiff::Catalog::Computed' unless @puppet_binary
71-
@puppet_version ||= OctocatalogDiff::Util::PuppetVersion.puppet_version(@puppet_binary)
71+
@puppet_version ||= OctocatalogDiff::Util::PuppetVersion.puppet_version(@puppet_binary, @opts)
7272
end
7373

7474
# Compilation directory

lib/octocatalog-diff/util/puppetversion.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ module Util
1212
class PuppetVersion
1313
# Determine the version of Puppet.
1414
# @param puppet [String] Path to Puppet binary
15+
# @param options [Hash] Options hash as defined in OctocatalogDiff::Catalog::Computed
1516
# @return [String] Puppet version number
16-
def self.puppet_version(puppet)
17+
def self.puppet_version(puppet, options = {})
1718
raise ArgumentError, 'Puppet binary was not supplied' if puppet.nil?
1819
raise Errno::ENOENT, "Puppet binary #{puppet} doesn't exist" unless File.file?(puppet)
1920
cmdline = [Shellwords.escape(puppet), '--version'].join(' ')
@@ -24,6 +25,8 @@ def self.puppet_version(puppet)
2425
'PATH' => ENV['PATH'],
2526
'PWD' => File.dirname(puppet)
2627
}
28+
pass_env_vars = options.fetch(:pass_env_vars, [])
29+
pass_env_vars.each { |var| env[var] ||= ENV[var] }
2730
out, err, _status = Open3.capture3(env, cmdline, unsetenv_others: true, chdir: env['PWD'])
2831
return Regexp.last_match(1) if out =~ /^([\d\.]+)\s*$/
2932
raise "Unable to determine Puppet version: #{out} #{err}"

0 commit comments

Comments
 (0)