kafo_parsers 1.1.2 → 1.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e59aa9f14c8c8c6888b69b88521c9fcd589dfe122d7dc0a1bc9d3df32262969a
4
- data.tar.gz: 99682f87e85a3c3994313f50d4942ae1f4f51a22564532af2e78c0ee48bf869a
3
+ metadata.gz: f510d851fccf71e96f9fd835195990a4e669fd5722592f1673823a4a651eeb77
4
+ data.tar.gz: e98e7f725fd65d900371fef825db343b25fedd70ac9aee21edaeeaef25ca7d98
5
5
  SHA512:
6
- metadata.gz: 04e1546703475de823ed9a40fa9e05515c9bdc7a39c20e7cddfaf180f64a6771813539f9264f145664ae0d50a653e2474cc9313dcd76ab1bd573fa68fd377813
7
- data.tar.gz: ea384ebd11d468bfc8e8c81f126483481273a34abdb9acec94f6cfe9a5bfeb535eb84ed323a4fa0a55ac5e90a2cdc742a4379f6c88d4abb3d22751946b13ba82
6
+ metadata.gz: cdbe4e4c5ebab2e4e41f29209c4b84f8c595e7585f0deb1d8f94ae2c90519810874b76458a96acf98255de9721c3502cbbd97390829180caa125bcda0673778b
7
+ data.tar.gz: da851240e0bde3e0fe253b9c3e9e6953fb83e21eea8c15740f28df6065192b0d446c4dcc7825d0d8204ebcdfb4368c69238e0d978a3cf598d10115e21fd5485e
@@ -133,10 +133,30 @@ module KafoParsers
133
133
 
134
134
  private
135
135
 
136
+ def self.search_puppet_path(bin_name)
137
+ # Find the location of the puppet executable and use that to
138
+ # determine the path of all executables
139
+ bin_path = (::ENV['PATH'].split(File::PATH_SEPARATOR) + ['/opt/puppetlabs/bin']).find do |path|
140
+ File.executable?(File.join(path, 'puppet')) && File.executable?(File.join(path, bin_name))
141
+ end
142
+ File.join([bin_path, bin_name].compact)
143
+ end
144
+
145
+ def self.is_aio_puppet?
146
+ puppet_command = search_puppet_path('puppet')
147
+ File.realpath(puppet_command).start_with?('/opt/puppetlabs')
148
+ rescue Errno::ENOENT
149
+ false
150
+ end
151
+
136
152
  def self.run_puppet(command)
137
- env_vars = self.puppet_bin.start_with?('/opt/puppetlabs') ? clean_env_vars : ::ENV
138
153
  command = command.unshift(self.puppet_bin)
139
- Open3.capture3(env_vars, *command, :unsetenv_others => true)
154
+
155
+ if is_aio_puppet?
156
+ Open3.capture3(clean_env_vars, *command, :unsetenv_others => true)
157
+ else
158
+ Open3.capture3(::ENV, *command, :unsetenv_others => false)
159
+ end
140
160
  end
141
161
 
142
162
  def self.clean_env_vars
@@ -1,3 +1,3 @@
1
1
  module KafoParsers
2
- VERSION = "1.1.2"
2
+ VERSION = "1.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kafo_parsers
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marek Hulan
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-10 00:00:00.000000000 Z
11
+ date: 2021-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -130,7 +130,7 @@ homepage: https://github.com/theforeman/kafo_parsers
130
130
  licenses:
131
131
  - GPL-3.0+
132
132
  metadata: {}
133
- post_install_message:
133
+ post_install_message:
134
134
  rdoc_options: []
135
135
  require_paths:
136
136
  - lib
@@ -145,8 +145,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
145
  - !ruby/object:Gem::Version
146
146
  version: '0'
147
147
  requirements: []
148
- rubygems_version: 3.1.2
149
- signing_key:
148
+ rubygems_version: 3.1.4
149
+ signing_key:
150
150
  specification_version: 4
151
151
  summary: Puppet module parsers
152
152
  test_files: []