openfact 6.2.0 → 6.2.2
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d6abc7bb997faa4bef38adcfe94b44215a33c7c90abef73364980446765c8aa5
|
|
4
|
+
data.tar.gz: 627301bef10445b49b513b8ed60e175fa1f7d62a39763edd899d9d61d9e95a59
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '03408be381d6f7ebe5371d866e167af5056e81393bddea1d942db8c57ce6d87af962569857546387e6af424806dd6a95cbfd703cdf98a5cb4d6a66b8f3fb9459'
|
|
7
|
+
data.tar.gz: 5346ddb96b985b96cef97b8945515e8768b3db1982e66290e81ee667e33ca4a6b07e5e9f1ed4f60956b3d87bf86263b80963fbcabbf773d9d79436ede3c842aa
|
|
@@ -44,8 +44,13 @@ module Facter
|
|
|
44
44
|
def execute(command, options = {})
|
|
45
45
|
on_fail, expand, logger, timeout = extract_options(options)
|
|
46
46
|
|
|
47
|
-
expanded_command = if
|
|
47
|
+
expanded_command = if !expand && builtin_command?(command)
|
|
48
48
|
command
|
|
49
|
+
elsif logger
|
|
50
|
+
# Internal resolvers rely on search_paths to find commands
|
|
51
|
+
# outside of PATH (e.g. /usr/sbin/zpool on Solaris). Fall back
|
|
52
|
+
# to the command as given so failures are logged, not raised.
|
|
53
|
+
expand_command(command) || command
|
|
49
54
|
else
|
|
50
55
|
expand_command(command)
|
|
51
56
|
end
|
data/lib/facter/resolvers/ec2.rb
CHANGED
|
@@ -19,9 +19,7 @@ module Facter
|
|
|
19
19
|
|
|
20
20
|
def read_facts(fact_name)
|
|
21
21
|
if fact_name == :metadata
|
|
22
|
-
metadata =
|
|
23
|
-
query_for_metadata(EC2_METADATA_ROOT_URL, metadata)
|
|
24
|
-
@fact_list[:metadata] = metadata
|
|
22
|
+
@fact_list[:metadata] = read_metadata
|
|
25
23
|
else
|
|
26
24
|
@fact_list[:userdata] = get_data_from(EC2_USERDATA_ROOT_URL).strip.force_encoding('UTF-8')
|
|
27
25
|
end
|
|
@@ -29,9 +27,29 @@ module Facter
|
|
|
29
27
|
@fact_list[fact_name]
|
|
30
28
|
end
|
|
31
29
|
|
|
30
|
+
# A failed root listing means no EC2-compatible metadata service is
|
|
31
|
+
# available, so there is no metadata to report. Once the root listing
|
|
32
|
+
# succeeds, any failed child request rejects the whole result.
|
|
33
|
+
def read_metadata
|
|
34
|
+
root_listing = root_metadata_listing
|
|
35
|
+
return {} unless root_listing
|
|
36
|
+
|
|
37
|
+
add_metadata_entries(EC2_METADATA_ROOT_URL, root_listing, {})
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def root_metadata_listing
|
|
41
|
+
get_metadata_from(EC2_METADATA_ROOT_URL)
|
|
42
|
+
rescue StandardError => e
|
|
43
|
+
log.debug("EC2 metadata is not available: #{e.message}")
|
|
44
|
+
nil
|
|
45
|
+
end
|
|
46
|
+
|
|
32
47
|
def query_for_metadata(url, container)
|
|
33
|
-
|
|
34
|
-
|
|
48
|
+
add_metadata_entries(url, get_metadata_from(url), container)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def add_metadata_entries(url, listing, container)
|
|
52
|
+
listing.each_line do |line|
|
|
35
53
|
next if line.empty?
|
|
36
54
|
|
|
37
55
|
http_path_component = build_path_component(line)
|
|
@@ -14,13 +14,12 @@ module Facter
|
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
def read_ipaddress(fact_name)
|
|
17
|
-
ip = nil
|
|
18
17
|
primary_interface = read_primary_interface
|
|
19
18
|
unless primary_interface.nil?
|
|
20
19
|
output = Facter::Core::Execution.execute("ifconfig #{primary_interface}", logger: log)
|
|
21
20
|
output.each_line do |str|
|
|
22
21
|
if str.strip =~ /inet\s(\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3}) .+/
|
|
23
|
-
@fact_list[:ip] =
|
|
22
|
+
@fact_list[:ip] = Regexp.last_match(1)
|
|
24
23
|
break
|
|
25
24
|
end
|
|
26
25
|
end
|
data/lib/facter/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: openfact
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 6.2.
|
|
4
|
+
version: 6.2.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- OpenVox Project
|
|
@@ -87,14 +87,14 @@ dependencies:
|
|
|
87
87
|
requirements:
|
|
88
88
|
- - "~>"
|
|
89
89
|
- !ruby/object:Gem::Version
|
|
90
|
-
version: 1.
|
|
90
|
+
version: 1.92.0
|
|
91
91
|
type: :development
|
|
92
92
|
prerelease: false
|
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
|
94
94
|
requirements:
|
|
95
95
|
- - "~>"
|
|
96
96
|
- !ruby/object:Gem::Version
|
|
97
|
-
version: 1.
|
|
97
|
+
version: 1.92.0
|
|
98
98
|
- !ruby/object:Gem::Dependency
|
|
99
99
|
name: rubocop-performance
|
|
100
100
|
requirement: !ruby/object:Gem::Requirement
|