facter 4.0.15 → 4.0.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -0
- data/.rubocop_todo.yml +5 -7
- data/CHANGELOG.md +33 -0
- data/VERSION +1 -1
- data/lib/custom_facts/util/parser.rb +1 -1
- data/lib/custom_facts/version.rb +1 -1
- data/lib/facter.rb +13 -17
- data/lib/facts/aix/partitions.rb +15 -0
- data/lib/facts/windows/ssh.rb +27 -0
- data/lib/facts_utils/uptime_parser.rb +3 -3
- data/lib/framework/cli/cli.rb +1 -1
- data/lib/framework/config/block_list.rb +1 -4
- data/lib/framework/config/config_reader.rb +29 -26
- data/lib/framework/core/fact_filter.rb +2 -2
- data/lib/framework/core/file_loader.rb +3 -3
- data/lib/framework/core/options.rb +57 -64
- data/lib/framework/core/options/config_file_options.rb +58 -48
- data/lib/framework/core/options/option_store.rb +156 -0
- data/lib/framework/core/options/options_validator.rb +42 -2
- data/lib/framework/logging/logger.rb +2 -0
- data/lib/framework/parsers/query_parser.rb +1 -1
- data/lib/models/fact_collection.rb +1 -1
- data/lib/resolvers/aix/filesystem_resolver.rb +3 -2
- data/lib/resolvers/aix/partitions.rb +86 -0
- data/lib/resolvers/aix/utils/odm_query.rb +2 -2
- data/lib/resolvers/debian_version.rb +2 -5
- data/lib/resolvers/disk_resolver.rb +2 -3
- data/lib/resolvers/dmi_resolver.rb +3 -3
- data/lib/resolvers/filesystems_resolver.rb +3 -3
- data/lib/resolvers/fips_enabled_resolver.rb +1 -4
- data/lib/resolvers/hostname_resolver.rb +4 -4
- data/lib/resolvers/load_averages_resolver.rb +1 -3
- data/lib/resolvers/memory_resolver.rb +2 -2
- data/lib/resolvers/mountpoints_resolver.rb +1 -3
- data/lib/resolvers/os_release_resolver.rb +3 -6
- data/lib/resolvers/partitions.rb +11 -6
- data/lib/resolvers/processors_resolver.rb +3 -3
- data/lib/resolvers/selinux_resolver.rb +9 -9
- data/lib/resolvers/solaris/filesystems_resolver.rb +1 -1
- data/lib/resolvers/ssh_resolver.rb +4 -43
- data/lib/resolvers/utils/ssh_helper.rb +27 -0
- data/lib/resolvers/windows/ssh.rb +47 -0
- data/lib/util/file_helper.rb +24 -0
- metadata +9 -6
- data/lib/framework/core/options/default_options.rb +0 -35
- data/lib/framework/core/options/helper_options.rb +0 -52
- data/lib/framework/core/options/priority_options.rb +0 -12
- data/lib/framework/core/options/validate_options.rb +0 -49
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.16
|
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-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -273,6 +273,7 @@ files:
|
|
273
273
|
- lib/facts/aix/os/hardware.rb
|
274
274
|
- lib/facts/aix/os/name.rb
|
275
275
|
- lib/facts/aix/os/release.rb
|
276
|
+
- lib/facts/aix/partitions.rb
|
276
277
|
- lib/facts/aix/path.rb
|
277
278
|
- lib/facts/aix/puppet_version.rb
|
278
279
|
- lib/facts/aix/ruby/platform.rb
|
@@ -734,6 +735,7 @@ files:
|
|
734
735
|
- lib/facts/windows/ruby/sitedir.rb
|
735
736
|
- lib/facts/windows/ruby/version.rb
|
736
737
|
- lib/facts/windows/scope6_interfaces.rb
|
738
|
+
- lib/facts/windows/ssh.rb
|
737
739
|
- lib/facts/windows/system_uptime/days.rb
|
738
740
|
- lib/facts/windows/system_uptime/hours.rb
|
739
741
|
- lib/facts/windows/system_uptime/seconds.rb
|
@@ -762,11 +764,8 @@ files:
|
|
762
764
|
- lib/framework/core/file_loader.rb
|
763
765
|
- lib/framework/core/options.rb
|
764
766
|
- lib/framework/core/options/config_file_options.rb
|
765
|
-
- lib/framework/core/options/
|
766
|
-
- lib/framework/core/options/helper_options.rb
|
767
|
+
- lib/framework/core/options/option_store.rb
|
767
768
|
- lib/framework/core/options/options_validator.rb
|
768
|
-
- lib/framework/core/options/priority_options.rb
|
769
|
-
- lib/framework/core/options/validate_options.rb
|
770
769
|
- lib/framework/core/session_cache.rb
|
771
770
|
- lib/framework/detector/os_detector.rb
|
772
771
|
- lib/framework/formatters/formatter_factory.rb
|
@@ -792,6 +791,7 @@ files:
|
|
792
791
|
- lib/resolvers/aix/mountpoints.rb
|
793
792
|
- lib/resolvers/aix/networking_resolver.rb
|
794
793
|
- lib/resolvers/aix/os_level_resolver.rb
|
794
|
+
- lib/resolvers/aix/partitions.rb
|
795
795
|
- lib/resolvers/aix/utils/odm_query.rb
|
796
796
|
- lib/resolvers/augeas_resolver.rb
|
797
797
|
- lib/resolvers/base_resolver.rb
|
@@ -844,6 +844,7 @@ files:
|
|
844
844
|
- lib/resolvers/utils/filesystem_helper.rb
|
845
845
|
- lib/resolvers/utils/fingerprint.rb
|
846
846
|
- lib/resolvers/utils/ssh.rb
|
847
|
+
- lib/resolvers/utils/ssh_helper.rb
|
847
848
|
- lib/resolvers/windows/dmi_bios_resolver.rb
|
848
849
|
- lib/resolvers/windows/dmi_computersystem_resolver.rb
|
849
850
|
- lib/resolvers/windows/ffi/ffi.rb
|
@@ -867,6 +868,7 @@ files:
|
|
867
868
|
- lib/resolvers/windows/networking_resolver.rb
|
868
869
|
- lib/resolvers/windows/processors_resolver.rb
|
869
870
|
- lib/resolvers/windows/product_release_resolver.rb
|
871
|
+
- lib/resolvers/windows/ssh.rb
|
870
872
|
- lib/resolvers/windows/system32_resolver.rb
|
871
873
|
- lib/resolvers/windows/uptime_resolver.rb
|
872
874
|
- lib/resolvers/windows/utils/win32ole.rb
|
@@ -874,6 +876,7 @@ files:
|
|
874
876
|
- lib/resolvers/windows/win_os_description_resolver.rb
|
875
877
|
- lib/resolvers/wpar_resolver.rb
|
876
878
|
- lib/util/api_debugger.rb
|
879
|
+
- lib/util/file_helper.rb
|
877
880
|
- tasks/create_fact.rake
|
878
881
|
- tasks/fact_generator/fact.erb
|
879
882
|
- tasks/fact_generator/fact_creator.rb
|
@@ -1,35 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Facter
|
4
|
-
module DefaultOptions
|
5
|
-
def augment_with_defaults!
|
6
|
-
cli_defaults
|
7
|
-
global_defaults
|
8
|
-
end
|
9
|
-
|
10
|
-
DEFAULT_LOG_LEVEL = :warn
|
11
|
-
|
12
|
-
def augment_with_to_hash_defaults!
|
13
|
-
@options[:show_legacy] = true
|
14
|
-
end
|
15
|
-
|
16
|
-
private
|
17
|
-
|
18
|
-
def cli_defaults
|
19
|
-
@options[:debug] ||= false
|
20
|
-
@options[:trace] ||= false
|
21
|
-
@options[:verbose] ||= false
|
22
|
-
@options[:log_level] ||= DEFAULT_LOG_LEVEL
|
23
|
-
@options[:show_legacy] ||= false
|
24
|
-
end
|
25
|
-
|
26
|
-
def global_defaults
|
27
|
-
@options[:block] ||= true
|
28
|
-
@options[:custom_facts] ||= true
|
29
|
-
@options[:custom_dir] ||= []
|
30
|
-
@options[:external_facts] ||= true
|
31
|
-
@options[:external_dir] ||= []
|
32
|
-
@options[:ruby] ||= true
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
@@ -1,52 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Facter
|
4
|
-
module HelperOptions
|
5
|
-
def augment_with_helper_options!(user_query)
|
6
|
-
@options[:user_query] = true if user_query.any?
|
7
|
-
|
8
|
-
no_ruby
|
9
|
-
|
10
|
-
# convert array or string to array
|
11
|
-
@options[:external_dir] = [*@options[:external_dir]] unless @options[:external_dir].nil?
|
12
|
-
|
13
|
-
@options[:log_level] = log_level || @options[:log_level].to_sym
|
14
|
-
@options[:debug] = true if @options[:log_level] == :debug
|
15
|
-
|
16
|
-
validate_log_level
|
17
|
-
|
18
|
-
Log.level = @options[:log_level]
|
19
|
-
Facter.trace(@options[:trace])
|
20
|
-
end
|
21
|
-
|
22
|
-
private
|
23
|
-
|
24
|
-
def no_ruby
|
25
|
-
return if @options[:ruby]
|
26
|
-
|
27
|
-
@options[:custom_facts] = false
|
28
|
-
@options[:blocked_facts] = ['ruby'].concat(@options[:blocked_facts] || [])
|
29
|
-
end
|
30
|
-
|
31
|
-
def log_level
|
32
|
-
if @options[:debug] || @options[:log_level] == :trace
|
33
|
-
:debug
|
34
|
-
elsif @options[:verbose]
|
35
|
-
:info
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def validate_log_level
|
40
|
-
if @options[:log_level].empty?
|
41
|
-
OptionsValidator.write_error_and_exit('the required argument for option'\
|
42
|
-
" '--log-level' is missing")
|
43
|
-
end
|
44
|
-
unless OptionsValidator::LOG_LEVEL.include?(
|
45
|
-
@options[:log_level].to_sym
|
46
|
-
)
|
47
|
-
OptionsValidator.write_error_and_exit("invalid log level #{@options[:log_level]} : expected none, trace,"\
|
48
|
-
' debug, info, warn, error, or fatal.')
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Facter
|
4
|
-
module PriorityOptions
|
5
|
-
def augment_with_priority_options!(priority_options)
|
6
|
-
priority_options.each do |key, val|
|
7
|
-
@options[key.to_sym] = val
|
8
|
-
@options[key.to_sym] = '' if key == 'log_level' && val == 'log_level'
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Facter
|
4
|
-
module ValidateOptions
|
5
|
-
def validate_configs
|
6
|
-
conflicting_configs.each do |op|
|
7
|
-
next unless op.values[0] && op.values[1]
|
8
|
-
|
9
|
-
message = "#{op.keys[0]} and #{op.keys[1]} options conflict: please specify only one"
|
10
|
-
raise_error(message)
|
11
|
-
end
|
12
|
-
validate_log_options
|
13
|
-
end
|
14
|
-
|
15
|
-
private
|
16
|
-
|
17
|
-
def conflicting_configs
|
18
|
-
no_ruby = !@options[:ruby]
|
19
|
-
no_custom_facts = !@options[:custom_facts]
|
20
|
-
puppet = @options[:puppet]
|
21
|
-
custom_dir = @options[:custom_dir].nil? ? false : @options[:custom_dir].any?
|
22
|
-
external_dir = @options[:external_dir].nil? ? false : @options[:external_dir].any?
|
23
|
-
|
24
|
-
[
|
25
|
-
{ 'no-ruby' => no_ruby, 'custom-dir' => custom_dir },
|
26
|
-
{ 'no-external-facts' => !@options[:external_facts], 'external-dir' => external_dir },
|
27
|
-
{ 'no-custom-facts' => no_custom_facts, 'custom-fir' => custom_dir },
|
28
|
-
{ 'no-ruby' => no_ruby, 'puppet' => puppet },
|
29
|
-
{ 'no-custom-facts' => no_custom_facts, 'puppet' => puppet }
|
30
|
-
]
|
31
|
-
end
|
32
|
-
|
33
|
-
def validate_log_options
|
34
|
-
return unless [@options[:debug],
|
35
|
-
@options[:verbose],
|
36
|
-
@options[:log_level] != Facter::DefaultOptions::DEFAULT_LOG_LEVEL]
|
37
|
-
.count(true) > 1
|
38
|
-
|
39
|
-
raise_error('debug, verbose, and log-level options conflict: please specify only one.')
|
40
|
-
end
|
41
|
-
|
42
|
-
def raise_error(message)
|
43
|
-
OptionsValidator.write_error_and_exit(message) if @options[:is_cli]
|
44
|
-
log = Facter::Log.new(self)
|
45
|
-
log.error(message, true)
|
46
|
-
raise ArgumentError, message
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|