facter 4.2.11 → 4.2.13

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b94d35e70448fb5efde799119e0bcfe508e4097133b44939c453fcbd0f39983a
4
- data.tar.gz: 6f97201f2619f853c2a66ff15cb4538b67dc3d843ff48629ca65d7b0bfc626d3
3
+ metadata.gz: deba395892bb9b2ded975e2c3a1ea31668e63a0e4229fcf77a2f711cfc1bb9ef
4
+ data.tar.gz: 73d37ac458df2e0d19a48000b7340bb63eb54b184a6cb564c461257e05a3a893
5
5
  SHA512:
6
- metadata.gz: 3ad5f88e1d7e8517c6cae2687fbf74a05ebcd2a92e54baef7276b08d6e0bee0e4af77e4f908951acf2e956d9e9ff9ced4773fff260639e2e1db3b230da75700a
7
- data.tar.gz: 6a3e65102fd483807f3d67fa17eda71f7cdce61f59cc7e512c81990d9b02a29389c2c582ae3ccf187d3450918c28f9efc0a7a50c31314950f4109d3492e9c21d
6
+ metadata.gz: acccf421fa6ed4b819120e8b8baf643188871216ade1c7484cf01ec4f19b93e397d55e3338f776de35d04120ed86dfcd6ca12318965819d023ff55fb7ad0e515
7
+ data.tar.gz: b31c2ea4220672766d4f4a3a3c615105395b2680fec1c60449b506b398345d4f8678dd9ef88a89ab1956ceb395bd225f9a4695cb6fe4c54d943464d3b943a01f
data/lib/facter/config.rb CHANGED
@@ -39,7 +39,8 @@ module Facter
39
39
  'Photon',
40
40
  'Slackware',
41
41
  'Mageia',
42
- 'Openwrt'
42
+ 'Openwrt',
43
+ 'Mariner'
43
44
  ]
44
45
  },
45
46
  {
@@ -9,6 +9,10 @@ module Facter
9
9
  DEFAULT_COMMAND_EXTENSIONS = %w[.COM .EXE .BAT .CMD].freeze
10
10
 
11
11
  def which(bin)
12
+ # `echo` is allowed for facter 3.x compatibility, otherwise
13
+ # all commands much be found on the PATH or absolute.
14
+ return bin if /^echo$/i =~ bin
15
+
12
16
  if absolute_path?(bin)
13
17
  return bin if File.executable?(bin)
14
18
  else
@@ -59,9 +59,6 @@ module LegacyFacter
59
59
  # 2. ENV['FACTERLIB'] is split and used verbatim
60
60
  # 3. Entries from Facter.search_path are used verbatim
61
61
  #
62
- # A warning will be generated for paths in Facter.search_path that are not
63
- # absolute directories.
64
- #
65
62
  # @api public
66
63
  # @return [Array<String>]
67
64
  def search_path
@@ -72,14 +69,8 @@ module LegacyFacter
72
69
  search_paths += @environment_vars['FACTERLIB'].split(File::PATH_SEPARATOR)
73
70
  end
74
71
 
75
- search_paths.delete_if { |path| !valid_search_path?(path) }
76
-
77
72
  Facter::Options.custom_dir.each do |path|
78
- if valid_search_path?(path)
79
- search_paths << path
80
- else
81
- log.debug "Excluding #{path} from search path. Fact file paths must be an absolute directory"
82
- end
73
+ search_paths << path
83
74
  end
84
75
 
85
76
  search_paths.delete_if { |path| !File.directory?(path) }
@@ -93,15 +84,6 @@ module LegacyFacter
93
84
  @log ||= Facter::Log.new(self)
94
85
  end
95
86
 
96
- # Validate that the given path is valid, ie it is an absolute path.
97
- #
98
- # @api private
99
- # @param path [String]
100
- # @return [Boolean]
101
- def valid_search_path?(path)
102
- Pathname.new(path).absolute?
103
- end
104
-
105
87
  # Load a file and record is paths to prevent duplicate loads.
106
88
  #
107
89
  # @api private
@@ -70,7 +70,11 @@ module LegacyFacter
70
70
  def parse_executable_output(output)
71
71
  res = nil
72
72
  begin
73
- res = YAML.safe_load(output, [Symbol, Time])
73
+ res = if Gem::Version.new(Psych::VERSION) >= Gem::Version.new('3.1.0') # Ruby 2.6+
74
+ YAML.safe_load(output, permitted_classes: [Symbol, Time])
75
+ else
76
+ YAML.safe_load(output, [Symbol, Time])
77
+ end
74
78
  rescue StandardError => e
75
79
  Facter.debug("Could not parse executable fact output as YAML or JSON (#{e.message})")
76
80
  end
@@ -114,7 +118,11 @@ module LegacyFacter
114
118
  # Add quotes to Yaml time
115
119
  cont = content.gsub(TIME, '"\1"')
116
120
 
117
- YAML.safe_load(cont, [Date])
121
+ if Gem::Version.new(Psych::VERSION) >= Gem::Version.new('3.1.0') # Ruby 2.6+
122
+ YAML.safe_load(cont, permitted_classes: [Date], aliases: true)
123
+ else
124
+ YAML.safe_load(cont, [Date], [], [], true)
125
+ end
118
126
  end
119
127
  end
120
128
 
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Facts
4
+ module Freebsd
5
+ class Ec2Metadata
6
+ FACT_NAME = 'ec2_metadata'
7
+
8
+ def call_the_resolver
9
+ return Facter::ResolvedFact.new(FACT_NAME, nil) unless aws_hypervisors?
10
+
11
+ fact_value = Facter::Resolvers::Ec2.resolve(:metadata)
12
+
13
+ Facter::ResolvedFact.new(FACT_NAME, fact_value&.empty? ? nil : fact_value)
14
+ end
15
+
16
+ private
17
+
18
+ def aws_hypervisors?
19
+ Facter::Util::Facts::Posix::VirtualDetector.platform =~ /kvm|xen|aws/
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Facts
4
+ module Freebsd
5
+ class Ec2Userdata
6
+ FACT_NAME = 'ec2_userdata'
7
+
8
+ def call_the_resolver
9
+ return Facter::ResolvedFact.new(FACT_NAME, nil) unless aws_hypervisors?
10
+
11
+ fact_value = Facter::Resolvers::Ec2.resolve(:userdata)
12
+
13
+ Facter::ResolvedFact.new(FACT_NAME, fact_value&.empty? ? nil : fact_value)
14
+ end
15
+
16
+ private
17
+
18
+ def aws_hypervisors?
19
+ Facter::Util::Facts::Posix::VirtualDetector.platform =~ /kvm|xen|aws/
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Facts
4
+ module Freebsd
5
+ class Ipaddress6Interfaces
6
+ FACT_NAME = 'ipaddress6_.*'
7
+ TYPE = :legacy
8
+
9
+ def call_the_resolver
10
+ arr = []
11
+ interfaces = Facter::Resolvers::Networking.resolve(:interfaces)
12
+ interfaces&.each do |interface_name, info|
13
+ arr << Facter::ResolvedFact.new("ipaddress6_#{interface_name}", info[:ip6], :legacy) if info[:ip6]
14
+ end
15
+
16
+ arr
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Facts
4
+ module Freebsd
5
+ class IpaddressInterfaces
6
+ FACT_NAME = 'ipaddress_.*'
7
+ TYPE = :legacy
8
+
9
+ def call_the_resolver
10
+ arr = []
11
+ interfaces = Facter::Resolvers::Networking.resolve(:interfaces)
12
+ interfaces&.each do |interface_name, info|
13
+ arr << Facter::ResolvedFact.new("ipaddress_#{interface_name}", info[:ip], :legacy) if info[:ip]
14
+ end
15
+
16
+ arr
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Facts
4
+ module Mariner
5
+ module Os
6
+ class Release
7
+ FACT_NAME = 'os.release'
8
+ ALIASES = %w[operatingsystemmajrelease operatingsystemrelease].freeze
9
+
10
+ def call_the_resolver
11
+ version = from_specific_file || from_os_release
12
+
13
+ return Facter::ResolvedFact.new(FACT_NAME, nil) unless version
14
+
15
+ [Facter::ResolvedFact.new(FACT_NAME, version),
16
+ Facter::ResolvedFact.new(ALIASES.first, version['major'], :legacy),
17
+ Facter::ResolvedFact.new(ALIASES.last, version['full'], :legacy)]
18
+ end
19
+
20
+ def from_specific_file
21
+ version = Facter::Resolvers::SpecificReleaseFile.resolve(:release,
22
+ { release_file: '/etc/mariner-release',
23
+ regex: /CBL\-Mariner ([0-9.]+)/ })
24
+ Facter::Util::Facts.release_hash_from_matchdata(version)
25
+ end
26
+
27
+ def from_os_release
28
+ version = Facter::Resolvers::OsRelease.resolve(:version_id)
29
+
30
+ Facter::Util::Facts.release_hash_from_string(version)
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -85,6 +85,8 @@ module Facter
85
85
  @fact_list[:name] = if os_name.downcase.start_with?('red', 'oracle', 'arch', 'manjaro')
86
86
  os_name = os_name.split(' ')[0..1].join
87
87
  os_name
88
+ elsif os_name.downcase.end_with?('mariner')
89
+ os_name.split(' ')[-1].strip
88
90
  else
89
91
  os_name.split(' ')[0].strip
90
92
  end
@@ -137,10 +137,11 @@ module Facter
137
137
  end
138
138
 
139
139
  def retrieve_domain_from_registry
140
- ::Win32::Registry::HKEY_LOCAL_MACHINE.open('SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters') do |rg|
141
- rg.each do |name, _value|
142
- @fact_list[:domain] = rg[name] if name == 'Domain'
143
- end
140
+ ::Win32::Registry::HKEY_LOCAL_MACHINE.open(
141
+ 'SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters'
142
+ ) do |key|
143
+ domain = key['Domain']
144
+ @fact_list[:domain] = domain if domain
144
145
  end
145
146
  rescue Win32::Registry::Error
146
147
  @log.debug('Could not read TCPIP Parameters from registry')
@@ -10,7 +10,7 @@ module Facter
10
10
 
11
11
  PHYSICAL_HYPERVISORS = %w[physical xen0 vmware_server vmware_workstation openvzhn vserver_host].freeze
12
12
  REDHAT_FAMILY = %w[redhat rhel fedora centos scientific ascendos cloudlinux psbm
13
- oraclelinux ovs oel amazon xenserver xcp-ng virtuozzo photon].freeze
13
+ oraclelinux ovs oel amazon xenserver xcp-ng virtuozzo photon mariner].freeze
14
14
  DEBIAN_FAMILY = %w[debian ubuntu huaweios linuxmint devuan kde].freeze
15
15
  SUSE_FAMILY = %w[sles sled suse].freeze
16
16
  GENTOO_FAMILY = ['gentoo'].freeze
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Facter
4
- VERSION = '4.2.11' unless defined?(VERSION)
4
+ VERSION = '4.2.13' unless defined?(VERSION)
5
5
  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.2.11
4
+ version: 4.2.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-22 00:00:00.000000000 Z
11
+ date: 2022-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -349,12 +349,16 @@ files:
349
349
  - lib/facter/facts/freebsd/dmi/product/name.rb
350
350
  - lib/facter/facts/freebsd/dmi/product/serial_number.rb
351
351
  - lib/facter/facts/freebsd/dmi/product/uuid.rb
352
+ - lib/facter/facts/freebsd/ec2_metadata.rb
353
+ - lib/facter/facts/freebsd/ec2_userdata.rb
352
354
  - lib/facter/facts/freebsd/facterversion.rb
353
355
  - lib/facter/facts/freebsd/identity/gid.rb
354
356
  - lib/facter/facts/freebsd/identity/group.rb
355
357
  - lib/facter/facts/freebsd/identity/privileged.rb
356
358
  - lib/facter/facts/freebsd/identity/uid.rb
357
359
  - lib/facter/facts/freebsd/identity/user.rb
360
+ - lib/facter/facts/freebsd/ipaddress6_interfaces.rb
361
+ - lib/facter/facts/freebsd/ipaddress_interfaces.rb
358
362
  - lib/facter/facts/freebsd/is_virtual.rb
359
363
  - lib/facter/facts/freebsd/kernel.rb
360
364
  - lib/facter/facts/freebsd/kernelrelease.rb
@@ -656,6 +660,7 @@ files:
656
660
  - lib/facter/facts/macosx/timezone.rb
657
661
  - lib/facter/facts/macosx/virtual.rb
658
662
  - lib/facter/facts/mageia/os/release.rb
663
+ - lib/facter/facts/mariner/os/release.rb
659
664
  - lib/facter/facts/meego/os/release.rb
660
665
  - lib/facter/facts/oel/os/release.rb
661
666
  - lib/facter/facts/ol/os/release.rb