facter 4.7.0 → 4.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/facter/custom_facts/core/aggregate.rb +5 -1
- data/lib/facter/custom_facts/util/confine.rb +4 -2
- data/lib/facter/framework/logging/logger.rb +3 -2
- data/lib/facter/resolvers/az.rb +1 -1
- data/lib/facter/resolvers/base_resolver.rb +3 -2
- data/lib/facter/resolvers/bsd/processors.rb +0 -1
- data/lib/facter/resolvers/disks.rb +0 -2
- data/lib/facter/resolvers/dmi.rb +0 -2
- data/lib/facter/resolvers/ec2.rb +1 -1
- data/lib/facter/resolvers/filesystems.rb +0 -2
- data/lib/facter/resolvers/fips_enabled.rb +0 -2
- data/lib/facter/resolvers/freebsd/processors.rb +0 -1
- data/lib/facter/resolvers/gce.rb +1 -1
- data/lib/facter/resolvers/hostname.rb +5 -0
- data/lib/facter/resolvers/identity.rb +0 -2
- data/lib/facter/resolvers/macosx/mountpoints.rb +0 -2
- data/lib/facter/resolvers/memory.rb +0 -2
- data/lib/facter/resolvers/mountpoints.rb +0 -2
- data/lib/facter/resolvers/processors.rb +0 -2
- data/lib/facter/resolvers/solaris/mountpoints.rb +0 -2
- data/lib/facter/resolvers/solaris/networking.rb +0 -1
- data/lib/facter/resolvers/ssh.rb +0 -2
- data/lib/facter/resolvers/windows/dmi_bios.rb +0 -1
- data/lib/facter/resolvers/windows/dmi_computersystem.rb +0 -1
- data/lib/facter/resolvers/windows/hardware_architecture.rb +0 -1
- data/lib/facter/resolvers/windows/identity.rb +0 -1
- data/lib/facter/resolvers/windows/kernel.rb +0 -2
- data/lib/facter/resolvers/windows/memory.rb +0 -2
- data/lib/facter/resolvers/windows/networking.rb +0 -1
- data/lib/facter/resolvers/windows/ssh.rb +0 -2
- data/lib/facter/resolvers/windows/system32.rb +0 -2
- data/lib/facter/resolvers/windows/timezone.rb +0 -1
- data/lib/facter/resolvers/windows/uptime.rb +0 -2
- data/lib/facter/resolvers/windows/virtualization.rb +9 -4
- data/lib/facter/resolvers/windows/win_os_description.rb +0 -2
- data/lib/facter/resolvers/xen.rb +2 -0
- data/lib/facter/templates/man.erb +5 -2
- data/lib/facter/util/resolvers/http.rb +31 -20
- data/lib/facter/version.rb +1 -1
- metadata +28 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 512cdd220f22069dbf686592dfc08d3b4ecccf97702313117b333d5e568ebe8e
|
4
|
+
data.tar.gz: 373406fac7fe5ec363b13e6afa26acabfb6bb62716d9f0b977b1f2e768e6381d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed2f2ac6dcec58364ba37df4acee50fb44f90f46f6de28f8f2524aa89d8d5634e7499be547234e65e4930126e59652b0d6b56f2d602e74598227d7808c504bf7
|
7
|
+
data.tar.gz: ef408018f71cd5884a56cf0dc3aab243fe119978e45c99e4b8069242d4ecf27011a3c106b53f12960665729bc0209aee452a02138e6642749f2c2b51e46a67bc
|
@@ -109,7 +109,7 @@ module Facter
|
|
109
109
|
# @api private
|
110
110
|
def evaluate(&block)
|
111
111
|
if @last_evaluated
|
112
|
-
msg = "Already evaluated #{@name}"
|
112
|
+
msg = +"Already evaluated #{@name}"
|
113
113
|
msg << " at #{@last_evaluated}" if msg.is_a? String
|
114
114
|
msg << ', reevaluating anyways'
|
115
115
|
log.warn msg
|
@@ -197,6 +197,10 @@ module Facter
|
|
197
197
|
|
198
198
|
private
|
199
199
|
|
200
|
+
def log
|
201
|
+
@log ||= Facter::Log.new(self)
|
202
|
+
end
|
203
|
+
|
200
204
|
def evaluate_params(name)
|
201
205
|
raise ArgumentError, "#{self.class.name}#chunk requires a block" unless block_given?
|
202
206
|
raise ArgumentError, "#{self.class.name}#expected chunk name to be a Symbol" unless name.is_a? Symbol
|
@@ -35,7 +35,7 @@ module LegacyFacter
|
|
35
35
|
end
|
36
36
|
|
37
37
|
# Evaluate the fact, returning true or false.
|
38
|
-
# if we have a block
|
38
|
+
# if we have a block parameter then we only evaluate that instead
|
39
39
|
def true?
|
40
40
|
if @block && !@fact
|
41
41
|
begin
|
@@ -54,9 +54,11 @@ module LegacyFacter
|
|
54
54
|
|
55
55
|
return false if value.nil?
|
56
56
|
|
57
|
+
# We call the block with both the downcased and raw fact value for
|
58
|
+
# backwards-compatibility.
|
57
59
|
if @block
|
58
60
|
begin
|
59
|
-
return !!@block.call(value)
|
61
|
+
return !!@block.call(value) || !!@block.call(fact.value) # rubocop:disable Style/DoubleNegation
|
60
62
|
rescue StandardError => e
|
61
63
|
log.debug "Confine raised #{e.class} #{e}"
|
62
64
|
return false
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'logger'
|
4
|
+
require 'set'
|
4
5
|
|
5
6
|
module Facter
|
6
7
|
RED = "\e[31m"
|
@@ -15,8 +16,8 @@ module Facter
|
|
15
16
|
@@logger = nil
|
16
17
|
@@message_callback = nil
|
17
18
|
@@has_errors = false
|
18
|
-
@@debug_messages =
|
19
|
-
@@warn_messages =
|
19
|
+
@@debug_messages = Set.new
|
20
|
+
@@warn_messages = Set.new
|
20
21
|
@@timing = false
|
21
22
|
|
22
23
|
class << self
|
data/lib/facter/resolvers/az.rb
CHANGED
@@ -26,7 +26,7 @@ module Facter
|
|
26
26
|
|
27
27
|
def get_data_from(url)
|
28
28
|
headers = { Metadata: 'true' }
|
29
|
-
Facter::Util::Resolvers::Http.get_request(url, headers, { session: determine_session_timeout })
|
29
|
+
Facter::Util::Resolvers::Http.get_request(url, headers, { session: determine_session_timeout }, false)
|
30
30
|
end
|
31
31
|
|
32
32
|
def determine_session_timeout
|
@@ -3,8 +3,8 @@
|
|
3
3
|
module Facter
|
4
4
|
module Resolvers
|
5
5
|
class BaseResolver
|
6
|
-
|
7
|
-
|
6
|
+
class << self
|
7
|
+
attr_reader :log
|
8
8
|
end
|
9
9
|
|
10
10
|
def self.invalidate_cache
|
@@ -14,6 +14,7 @@ module Facter
|
|
14
14
|
def self.init_resolver
|
15
15
|
@fact_list = {}
|
16
16
|
@semaphore = Mutex.new
|
17
|
+
@log = Log.new(self)
|
17
18
|
end
|
18
19
|
|
19
20
|
def self.subscribe_to_manager
|
data/lib/facter/resolvers/dmi.rb
CHANGED
data/lib/facter/resolvers/ec2.rb
CHANGED
@@ -52,7 +52,7 @@ module Facter
|
|
52
52
|
def get_data_from(url)
|
53
53
|
headers = {}
|
54
54
|
headers['X-aws-ec2-metadata-token'] = v2_token if v2_token
|
55
|
-
Facter::Util::Resolvers::Http.get_request(url, headers, { session: determine_session_timeout })
|
55
|
+
Facter::Util::Resolvers::Http.get_request(url, headers, { session: determine_session_timeout }, false)
|
56
56
|
end
|
57
57
|
|
58
58
|
def determine_session_timeout
|
data/lib/facter/resolvers/gce.rb
CHANGED
@@ -22,7 +22,7 @@ module Facter
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def query_for_metadata
|
25
|
-
gce_data = extract_to_hash(Facter::Util::Resolvers::Http.get_request(METADATA_URL, HEADERS))
|
25
|
+
gce_data = extract_to_hash(Facter::Util::Resolvers::Http.get_request(METADATA_URL, HEADERS, false))
|
26
26
|
parse_instance(gce_data)
|
27
27
|
|
28
28
|
gce_data.empty? ? nil : gce_data
|
@@ -19,6 +19,11 @@ module Facter
|
|
19
19
|
def retrieve_info(fact_name)
|
20
20
|
require 'socket'
|
21
21
|
output = Socket.gethostname
|
22
|
+
unless output
|
23
|
+
log.debug('Socket.gethostname failed to return hostname')
|
24
|
+
return
|
25
|
+
end
|
26
|
+
|
22
27
|
hostname, domain = retrieve_from_fqdn(output)
|
23
28
|
|
24
29
|
fqdn = retrieve_with_addrinfo(hostname) if hostname_and_no_domain?(hostname, domain)
|
data/lib/facter/resolvers/ssh.rb
CHANGED
@@ -4,16 +4,21 @@ module Facter
|
|
4
4
|
module Resolvers
|
5
5
|
module Windows
|
6
6
|
class Virtualization < BaseResolver
|
7
|
-
@log = Facter::Log.new(self)
|
8
|
-
|
9
7
|
init_resolver
|
10
8
|
|
11
9
|
class << self
|
12
10
|
# Virtual
|
13
11
|
# Is_Virtual
|
14
12
|
|
15
|
-
MODEL_HASH = {
|
16
|
-
|
13
|
+
MODEL_HASH = {
|
14
|
+
'VirtualBox' => 'virtualbox',
|
15
|
+
'VMware' => 'vmware',
|
16
|
+
'KVM' => 'kvm',
|
17
|
+
'Bochs' => 'bochs',
|
18
|
+
'Google' => 'gce',
|
19
|
+
'OpenStack' => 'openstack',
|
20
|
+
'AHV' => 'ahv'
|
21
|
+
}.freeze
|
17
22
|
|
18
23
|
private
|
19
24
|
|
data/lib/facter/resolvers/xen.rb
CHANGED
@@ -1,11 +1,14 @@
|
|
1
1
|
<%# encoding: UTF-8%>
|
2
|
+
facter - collect and display facts about the current system
|
3
|
+
===========================================================
|
4
|
+
|
2
5
|
SYNOPSIS
|
3
6
|
--------
|
4
|
-
|
7
|
+
<b>facter</b> [options] [query] [query] [...]
|
5
8
|
|
6
9
|
DESCRIPTION
|
7
10
|
-----------
|
8
|
-
|
11
|
+
<b>facter</b> is a command-line tool that gathers basic facts about nodes (systems) such as hardware details, network settings, OS type and version, and more. These facts are made available as variables in your Puppet manifests and can be used to inform conditional expressions in Puppet.
|
9
12
|
|
10
13
|
If no queries are given, then all facts will be returned.
|
11
14
|
|
@@ -10,34 +10,37 @@ module Facter
|
|
10
10
|
CONNECTION_TIMEOUT = 0.6
|
11
11
|
SESSION_TIMEOUT = 5
|
12
12
|
|
13
|
-
# Makes a GET
|
13
|
+
# Makes a GET HTTP request and returns its response.
|
14
14
|
#
|
15
|
-
#
|
16
|
-
#
|
17
|
-
#
|
18
|
-
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
26
|
-
def get_request(url, headers = {}, timeouts = {})
|
27
|
-
make_request(url, headers, timeouts, 'GET')
|
15
|
+
# @param url [String] the address to which the request will be made.
|
16
|
+
# @param headers [Hash] the headers you need to add to your request.
|
17
|
+
# Defaults to an empty hash.
|
18
|
+
# @param timeouts [Hash] Values for the session and connection
|
19
|
+
# timeouts.
|
20
|
+
# @param proxy [Boolean] Whether to use proxy settings when calling
|
21
|
+
# Net::HTTP.new. Defaults to true.
|
22
|
+
# @returns [String] the response body if the response code is 200.
|
23
|
+
# If the response code is not 200, an empty string is returned.
|
24
|
+
# @example
|
25
|
+
# get_request('https://example.com', { "Accept": 'application/json' }, { session: 2.4, connection: 5 })
|
26
|
+
def get_request(url, headers = {}, timeouts = {}, proxy = true)
|
27
|
+
make_request(url, headers, timeouts, 'GET', proxy)
|
28
28
|
end
|
29
29
|
|
30
|
-
|
31
|
-
|
30
|
+
# Makes a PUT HTTP request and returns its response
|
31
|
+
# @param (see #get_request)
|
32
|
+
# @return (see #get_request)
|
33
|
+
def put_request(url, headers = {}, timeouts = {}, proxy = true)
|
34
|
+
make_request(url, headers, timeouts, 'PUT', proxy)
|
32
35
|
end
|
33
36
|
|
34
37
|
private
|
35
38
|
|
36
|
-
def make_request(url, headers, timeouts, request_type)
|
39
|
+
def make_request(url, headers, timeouts, request_type, proxy)
|
37
40
|
require 'net/http'
|
38
41
|
|
39
42
|
uri = URI.parse(url)
|
40
|
-
http = http_obj(uri, timeouts)
|
43
|
+
http = http_obj(uri, timeouts, proxy)
|
41
44
|
request = request_obj(headers, uri, request_type)
|
42
45
|
|
43
46
|
# The Windows implementation of sockets does not respect net/http
|
@@ -56,8 +59,16 @@ module Facter
|
|
56
59
|
''
|
57
60
|
end
|
58
61
|
|
59
|
-
def http_obj(parsed_url, timeouts)
|
60
|
-
|
62
|
+
def http_obj(parsed_url, timeouts, proxy)
|
63
|
+
# If get_request or put_request are called and set proxy to false,
|
64
|
+
# manually set Net::HTTP.new's p_addr (proxy address) positional
|
65
|
+
# argument to nil to override anywhere else a proxy may be set
|
66
|
+
# (e.g. the http_proxy environment variable).
|
67
|
+
http = if proxy
|
68
|
+
Net::HTTP.new(parsed_url.host)
|
69
|
+
else
|
70
|
+
Net::HTTP.new(parsed_url.host, 80, nil)
|
71
|
+
end
|
61
72
|
http.read_timeout = timeouts[:session] || SESSION_TIMEOUT
|
62
73
|
http.open_timeout = timeouts[:connection] || CONNECTION_TIMEOUT
|
63
74
|
|
data/lib/facter/version.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,53 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: facter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.7.
|
4
|
+
version: 4.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 1.15.5
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.17.0
|
23
|
+
- - "!="
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: 1.16.0
|
26
|
+
- - "!="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: 1.16.1
|
29
|
+
- - "!="
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: 1.16.2
|
20
32
|
type: :development
|
21
33
|
prerelease: false
|
22
34
|
version_requirements: !ruby/object:Gem::Requirement
|
23
35
|
requirements:
|
24
|
-
- -
|
36
|
+
- - ">="
|
25
37
|
- !ruby/object:Gem::Version
|
26
38
|
version: 1.15.5
|
39
|
+
- - "<"
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: 1.17.0
|
42
|
+
- - "!="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: 1.16.0
|
45
|
+
- - "!="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.16.1
|
48
|
+
- - "!="
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: 1.16.2
|
27
51
|
- !ruby/object:Gem::Dependency
|
28
52
|
name: rake
|
29
53
|
requirement: !ruby/object:Gem::Requirement
|