facter 4.0.17 → 4.0.18

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: 5045cd46bc46b826aee23e2da1e62dc583e5daf0216a3ca31098970f55bd3d77
4
- data.tar.gz: 6ebd3870b201a82fad831783ee0d3b2cc84fa0bce81e4600b56f6d2ec8ecdc4b
3
+ metadata.gz: 2fd059e5d95e07714eaeefb1191e20b343e11105516a1d6ce963d583783a0409
4
+ data.tar.gz: d5835d1a4a8757f2d75380c988d9e2f23865dbb769a1eb5c3e191b17ea16dbb6
5
5
  SHA512:
6
- metadata.gz: 61874498a45ac854b2da205e441bed65880f9cf92ff094c7c04ad3d984189873bfb25be34ac9221f3266839a7f977eda610323fb1db033eafc58a918d71eaf02
7
- data.tar.gz: 5ee49a1e8742b4ba9f63a6436a637366d316c170f43c5da677130ad9a6036442c81456265b37935d5c527feb82df78bfaa2e69c05918fd1fb70e55c442e51fbc
6
+ metadata.gz: 4e97ff1b61c5b8fff096a36c2597b756cde59d5a5c5242bd09b755325771996640da315e286f8df3e4ae3244be344f1da7d4195a086d3510363e943a4b9ec0c3
7
+ data.tar.gz: f57576178ae1e3b13cd760adf77dbbf5c0c1cb79d609dbcecd64ddfdfececb98c1b5ae02927bcace7e223c378434f11dfbcc7f216e09ab28bf3b69ccb37d6a26
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config --exclude-limit 1000`
3
- # on 2020-04-15 10:09:42 +0300 using RuboCop version 0.74.0.
3
+ # on 2020-04-16 12:37:29 +0300 using RuboCop version 0.74.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -190,7 +190,7 @@ RSpec/SubjectStub:
190
190
  - 'spec/custom_facts/util/fact_spec.rb'
191
191
  - 'spec/custom_facts/util/resolution_spec.rb'
192
192
 
193
- # Offense count: 179
193
+ # Offense count: 172
194
194
  # Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
195
195
  RSpec/VerifiedDoubles:
196
196
  Exclude:
@@ -254,6 +254,4 @@ RSpec/VerifiedDoubles:
254
254
  - 'spec/framework/core/session_cache_spec.rb'
255
255
  - 'spec/framework/formatters/hocon_fact_formatter_spec.rb'
256
256
  - 'spec/framework/formatters/json_fact_formatter_spec.rb'
257
- - 'spec/framework/formatters/legacy_fact_formatter_spec.rb'
258
- - 'spec/framework/formatters/yaml_fact_formatter_spec.rb'
259
257
  - 'spec/mocks/util.rb'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.0.17
1
+ 4.0.18
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Facts
4
+ module Solaris
5
+ class ZpoolFeatureflags
6
+ FACT_NAME = 'zpool_featureflags'
7
+
8
+ def call_the_resolver
9
+ fact_value = Facter::Resolvers::Solaris::ZPool.resolve(:zpool_featureflags)
10
+ Facter::ResolvedFact.new(FACT_NAME, fact_value)
11
+ end
12
+ end
13
+ end
14
+ end
@@ -65,7 +65,8 @@ module Facter
65
65
  @log.debug('Remove quotes from parent nodes')
66
66
  pretty_json.gsub!(/\"(.*)\"\ =>/, '\1 =>')
67
67
 
68
- pretty_json
68
+ @log.debug('Remove double backslashes from paths')
69
+ pretty_json.gsub(/\\\\/, '\\')
69
70
  end
70
71
 
71
72
  def remove_enclosing_accolades(pretty_fact_json)
@@ -9,6 +9,8 @@ module Facter
9
9
  def format(fact_hash)
10
10
  yaml_pretty = YAML.dump(JSON.parse(JsonFactFormatter.new.format(fact_hash)))
11
11
 
12
+ @log.debug('Replace single backslash with double backslashes')
13
+ yaml_pretty.gsub!(/\\/, '\&\&')
12
14
  @log.debug('Replace --- from yaml beginning, to keep it compatible with C facter')
13
15
  yaml_pretty.gsub(/^---[\r\n]+/, '')
14
16
  end
@@ -65,7 +65,7 @@ module Facter
65
65
  end
66
66
 
67
67
  def debug(msg)
68
- return unless Facter.debugging?
68
+ return unless debugging_active?
69
69
 
70
70
  if msg.nil? || msg.empty?
71
71
  invoker = caller(1..1).first.slice(/.*:\d+/)
@@ -94,5 +94,13 @@ module Facter
94
94
  def colorize(msg, color)
95
95
  "\e[#{color}m#{msg}\e[0m"
96
96
  end
97
+
98
+ private
99
+
100
+ def debugging_active?
101
+ return true unless Facter.respond_to?(:debugging?)
102
+
103
+ Facter.debugging?
104
+ end
97
105
  end
98
106
  end
@@ -22,11 +22,13 @@ module Facter
22
22
  def build_zpool_facts
23
23
  output, _status = Open3.capture2('zpool upgrade -v')
24
24
  features_list = output.scan(/^\s+(\d+)/).flatten
25
+ features_flags = output.scan(/^([a-z0-9_]+)[[:blank:]]*(\(read-only compatible\))?$/).map(&:first)
25
26
 
26
27
  return if features_list.empty?
27
28
 
28
29
  @fact_list[:zpool_featurenumbers] = features_list.join(',')
29
- @fact_list[:zpool_version] = features_list.last
30
+ @fact_list[:zpool_featureflags] = features_flags.join(',')
31
+ @fact_list[:zpool_version] = features_flags.any? ? '5000' : features_list.last
30
32
  end
31
33
  end
32
34
  end
@@ -4,19 +4,28 @@ module Facter
4
4
  module Util
5
5
  class FileHelper
6
6
  @log = Log.new(self)
7
+
7
8
  class << self
8
9
  DEBUG_MESSAGE = 'File at: %s is not accessible.'
9
10
 
10
- def safe_read(path, result_if_not_readable = '')
11
+ def safe_read(path, default_return = '')
11
12
  return File.read(path) if File.readable?(path)
12
13
 
13
- result_if_not_readable
14
+ log_failed_to_read(path)
15
+ default_return
14
16
  end
15
17
 
16
- def safe_readlines(path, result_if_not_readable = [])
18
+ def safe_readlines(path, default_return = [])
17
19
  return File.readlines(path) if File.readable?(path)
18
20
 
19
- result_if_not_readable
21
+ log_failed_to_read(path)
22
+ default_return
23
+ end
24
+
25
+ private
26
+
27
+ def log_failed_to_read(path)
28
+ @log.debug(DEBUG_MESSAGE % path)
20
29
  end
21
30
  end
22
31
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: facter
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.17
4
+ version: 4.0.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-21 00:00:00.000000000 Z
11
+ date: 2020-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -663,6 +663,7 @@ files:
663
663
  - lib/facts/solaris/timezone.rb
664
664
  - lib/facts/solaris/zfs_featurenumbers.rb
665
665
  - lib/facts/solaris/zfs_version.rb
666
+ - lib/facts/solaris/zpool_featureflags.rb
666
667
  - lib/facts/solaris/zpool_featurenumbers.rb
667
668
  - lib/facts/solaris/zpool_version.rb
668
669
  - lib/facts/windows/augeas/version.rb