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 +4 -4
- data/.rubocop_todo.yml +2 -4
- data/VERSION +1 -1
- data/lib/facts/solaris/zpool_featureflags.rb +14 -0
- data/lib/framework/formatters/legacy_fact_formatter.rb +2 -1
- data/lib/framework/formatters/yaml_fact_formatter.rb +2 -0
- data/lib/framework/logging/logger.rb +9 -1
- data/lib/resolvers/solaris/zpool_resolver.rb +3 -1
- data/lib/util/file_helper.rb +13 -4
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2fd059e5d95e07714eaeefb1191e20b343e11105516a1d6ce963d583783a0409
|
4
|
+
data.tar.gz: d5835d1a4a8757f2d75380c988d9e2f23865dbb769a1eb5c3e191b17ea16dbb6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e97ff1b61c5b8fff096a36c2597b756cde59d5a5c5242bd09b755325771996640da315e286f8df3e4ae3244be344f1da7d4195a086d3510363e943a4b9ec0c3
|
7
|
+
data.tar.gz: f57576178ae1e3b13cd760adf77dbbf5c0c1cb79d609dbcecd64ddfdfececb98c1b5ae02927bcace7e223c378434f11dfbcc7f216e09ab28bf3b69ccb37d6a26
|
data/.rubocop_todo.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config --exclude-limit 1000`
|
3
|
-
# on 2020-04-
|
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:
|
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.
|
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
|
-
|
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
|
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[:
|
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
|
data/lib/util/file_helper.rb
CHANGED
@@ -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,
|
11
|
+
def safe_read(path, default_return = '')
|
11
12
|
return File.read(path) if File.readable?(path)
|
12
13
|
|
13
|
-
|
14
|
+
log_failed_to_read(path)
|
15
|
+
default_return
|
14
16
|
end
|
15
17
|
|
16
|
-
def safe_readlines(path,
|
18
|
+
def safe_readlines(path, default_return = [])
|
17
19
|
return File.readlines(path) if File.readable?(path)
|
18
20
|
|
19
|
-
|
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.
|
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-
|
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
|