cfacter 3.11.0.rc.20180314
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/ext/facter/Makefile.erb +31 -0
- data/ext/facter/cpp-hocon/CMakeLists.txt +67 -0
- data/ext/facter/cpp-hocon/CONTRIBUTING.md +9 -0
- data/ext/facter/cpp-hocon/LICENSE +17 -0
- data/ext/facter/cpp-hocon/MAINTAINERS +33 -0
- data/ext/facter/cpp-hocon/README.md +74 -0
- data/ext/facter/cpp-hocon/acceptance/Gemfile +18 -0
- data/ext/facter/cpp-hocon/acceptance/Rakefile +7 -0
- data/ext/facter/cpp-hocon/acceptance/tests/fake.rb +0 -0
- data/ext/facter/cpp-hocon/appveyor.yml +41 -0
- data/ext/facter/cpp-hocon/lib/CMakeLists.txt +94 -0
- data/ext/facter/cpp-hocon/lib/Doxyfile.in +2312 -0
- data/ext/facter/cpp-hocon/lib/inc/hocon/config.hpp +734 -0
- data/ext/facter/cpp-hocon/lib/inc/hocon/config_exception.hpp +184 -0
- data/ext/facter/cpp-hocon/lib/inc/hocon/config_include_context.hpp +51 -0
- data/ext/facter/cpp-hocon/lib/inc/hocon/config_includer.hpp +53 -0
- data/ext/facter/cpp-hocon/lib/inc/hocon/config_includer_file.hpp +30 -0
- data/ext/facter/cpp-hocon/lib/inc/hocon/config_list.hpp +51 -0
- data/ext/facter/cpp-hocon/lib/inc/hocon/config_mergeable.hpp +72 -0
- data/ext/facter/cpp-hocon/lib/inc/hocon/config_object.hpp +81 -0
- data/ext/facter/cpp-hocon/lib/inc/hocon/config_origin.hpp +98 -0
- data/ext/facter/cpp-hocon/lib/inc/hocon/config_parse_options.hpp +139 -0
- data/ext/facter/cpp-hocon/lib/inc/hocon/config_parseable.hpp +47 -0
- data/ext/facter/cpp-hocon/lib/inc/hocon/config_render_options.hpp +128 -0
- data/ext/facter/cpp-hocon/lib/inc/hocon/config_resolve_options.hpp +83 -0
- data/ext/facter/cpp-hocon/lib/inc/hocon/config_syntax.hpp +24 -0
- data/ext/facter/cpp-hocon/lib/inc/hocon/config_value.hpp +267 -0
- data/ext/facter/cpp-hocon/lib/inc/hocon/config_value_factory.hpp +48 -0
- data/ext/facter/cpp-hocon/lib/inc/hocon/functional_list.hpp +318 -0
- data/ext/facter/cpp-hocon/lib/inc/hocon/parser/config_document.hpp +95 -0
- data/ext/facter/cpp-hocon/lib/inc/hocon/parser/config_document_factory.hpp +39 -0
- data/ext/facter/cpp-hocon/lib/inc/hocon/parser/config_node.hpp +32 -0
- data/ext/facter/cpp-hocon/lib/inc/hocon/path.hpp +60 -0
- data/ext/facter/cpp-hocon/lib/inc/hocon/program_options.hpp +84 -0
- data/ext/facter/cpp-hocon/lib/inc/hocon/types.hpp +57 -0
- data/ext/facter/cpp-hocon/lib/inc/internal/config_document_parser.hpp +83 -0
- data/ext/facter/cpp-hocon/lib/inc/internal/config_parser.hpp +55 -0
- data/ext/facter/cpp-hocon/lib/inc/internal/config_util.hpp +17 -0
- data/ext/facter/cpp-hocon/lib/inc/internal/container.hpp +28 -0
- data/ext/facter/cpp-hocon/lib/inc/internal/default_transformer.hpp +12 -0
- data/ext/facter/cpp-hocon/lib/inc/internal/full_includer.hpp +13 -0
- data/ext/facter/cpp-hocon/lib/inc/internal/nodes/abstract_config_node.hpp +16 -0
- data/ext/facter/cpp-hocon/lib/inc/internal/nodes/abstract_config_node_value.hpp +12 -0
- data/ext/facter/cpp-hocon/lib/inc/internal/nodes/config_node_array.hpp +17 -0
- data/ext/facter/cpp-hocon/lib/inc/internal/nodes/config_node_comment.hpp +14 -0
- data/ext/facter/cpp-hocon/lib/inc/internal/nodes/config_node_complex_value.hpp +25 -0
- data/ext/facter/cpp-hocon/lib/inc/internal/nodes/config_node_concatenation.hpp +16 -0
- data/ext/facter/cpp-hocon/lib/inc/internal/nodes/config_node_field.hpp +29 -0
- data/ext/facter/cpp-hocon/lib/inc/internal/nodes/config_node_include.hpp +26 -0
- data/ext/facter/cpp-hocon/lib/inc/internal/nodes/config_node_object.hpp +45 -0
- data/ext/facter/cpp-hocon/lib/inc/internal/nodes/config_node_path.hpp +25 -0
- data/ext/facter/cpp-hocon/lib/inc/internal/nodes/config_node_root.hpp +24 -0
- data/ext/facter/cpp-hocon/lib/inc/internal/nodes/config_node_simple_value.hpp +21 -0
- data/ext/facter/cpp-hocon/lib/inc/internal/nodes/config_node_single_token.hpp +20 -0
- data/ext/facter/cpp-hocon/lib/inc/internal/parseable.hpp +128 -0
- data/ext/facter/cpp-hocon/lib/inc/internal/path_builder.hpp +20 -0
- data/ext/facter/cpp-hocon/lib/inc/internal/path_parser.hpp +55 -0
- data/ext/facter/cpp-hocon/lib/inc/internal/replaceable_merge_stack.hpp +14 -0
- data/ext/facter/cpp-hocon/lib/inc/internal/resolve_context.hpp +53 -0
- data/ext/facter/cpp-hocon/lib/inc/internal/resolve_result.hpp +21 -0
- data/ext/facter/cpp-hocon/lib/inc/internal/resolve_source.hpp +55 -0
- data/ext/facter/cpp-hocon/lib/inc/internal/simple_config_document.hpp +28 -0
- data/ext/facter/cpp-hocon/lib/inc/internal/simple_config_origin.hpp +67 -0
- data/ext/facter/cpp-hocon/lib/inc/internal/simple_include_context.hpp +22 -0
- data/ext/facter/cpp-hocon/lib/inc/internal/simple_includer.hpp +79 -0
- data/ext/facter/cpp-hocon/lib/inc/internal/substitution_expression.hpp +28 -0
- data/ext/facter/cpp-hocon/lib/inc/internal/token.hpp +45 -0
- data/ext/facter/cpp-hocon/lib/inc/internal/tokenizer.hpp +143 -0
- data/ext/facter/cpp-hocon/lib/inc/internal/tokens.hpp +135 -0
- data/ext/facter/cpp-hocon/lib/inc/internal/unmergeable.hpp +20 -0
- data/ext/facter/cpp-hocon/lib/inc/internal/values/config_boolean.hpp +26 -0
- data/ext/facter/cpp-hocon/lib/inc/internal/values/config_concatenation.hpp +59 -0
- data/ext/facter/cpp-hocon/lib/inc/internal/values/config_delayed_merge.hpp +53 -0
- data/ext/facter/cpp-hocon/lib/inc/internal/values/config_delayed_merge_object.hpp +57 -0
- data/ext/facter/cpp-hocon/lib/inc/internal/values/config_double.hpp +28 -0
- data/ext/facter/cpp-hocon/lib/inc/internal/values/config_int.hpp +25 -0
- data/ext/facter/cpp-hocon/lib/inc/internal/values/config_long.hpp +28 -0
- data/ext/facter/cpp-hocon/lib/inc/internal/values/config_null.hpp +33 -0
- data/ext/facter/cpp-hocon/lib/inc/internal/values/config_number.hpp +38 -0
- data/ext/facter/cpp-hocon/lib/inc/internal/values/config_reference.hpp +38 -0
- data/ext/facter/cpp-hocon/lib/inc/internal/values/config_string.hpp +32 -0
- data/ext/facter/cpp-hocon/lib/inc/internal/values/simple_config_list.hpp +75 -0
- data/ext/facter/cpp-hocon/lib/inc/internal/values/simple_config_object.hpp +107 -0
- data/ext/facter/cpp-hocon/lib/namespaces.dox.in +6 -0
- data/ext/facter/cpp-hocon/lib/src/config.cc +573 -0
- data/ext/facter/cpp-hocon/lib/src/config_document_factory.cc +24 -0
- data/ext/facter/cpp-hocon/lib/src/config_document_parser.cc +620 -0
- data/ext/facter/cpp-hocon/lib/src/config_parse_options.cc +101 -0
- data/ext/facter/cpp-hocon/lib/src/config_parser.cc +399 -0
- data/ext/facter/cpp-hocon/lib/src/config_render_options.cc +44 -0
- data/ext/facter/cpp-hocon/lib/src/config_resolve_options.cc +24 -0
- data/ext/facter/cpp-hocon/lib/src/config_util.cc +95 -0
- data/ext/facter/cpp-hocon/lib/src/config_value_factory.cc +68 -0
- data/ext/facter/cpp-hocon/lib/src/default_transformer.cc +94 -0
- data/ext/facter/cpp-hocon/lib/src/nodes/abstract_config_node.cc +19 -0
- data/ext/facter/cpp-hocon/lib/src/nodes/config_node_array.cc +13 -0
- data/ext/facter/cpp-hocon/lib/src/nodes/config_node_comment.cc +15 -0
- data/ext/facter/cpp-hocon/lib/src/nodes/config_node_complex_value.cc +50 -0
- data/ext/facter/cpp-hocon/lib/src/nodes/config_node_concatenation.cc +14 -0
- data/ext/facter/cpp-hocon/lib/src/nodes/config_node_field.cc +80 -0
- data/ext/facter/cpp-hocon/lib/src/nodes/config_node_include.cc +38 -0
- data/ext/facter/cpp-hocon/lib/src/nodes/config_node_object.cc +318 -0
- data/ext/facter/cpp-hocon/lib/src/nodes/config_node_path.cc +47 -0
- data/ext/facter/cpp-hocon/lib/src/nodes/config_node_root.cc +70 -0
- data/ext/facter/cpp-hocon/lib/src/nodes/config_node_simple_value.cc +50 -0
- data/ext/facter/cpp-hocon/lib/src/nodes/config_node_single_token.cc +18 -0
- data/ext/facter/cpp-hocon/lib/src/parseable.cc +325 -0
- data/ext/facter/cpp-hocon/lib/src/path.cc +219 -0
- data/ext/facter/cpp-hocon/lib/src/path_builder.cc +38 -0
- data/ext/facter/cpp-hocon/lib/src/path_parser.cc +253 -0
- data/ext/facter/cpp-hocon/lib/src/resolve_context.cc +139 -0
- data/ext/facter/cpp-hocon/lib/src/resolve_source.cc +216 -0
- data/ext/facter/cpp-hocon/lib/src/simple_config_document.cc +69 -0
- data/ext/facter/cpp-hocon/lib/src/simple_config_origin.cc +246 -0
- data/ext/facter/cpp-hocon/lib/src/simple_include_context.cc +18 -0
- data/ext/facter/cpp-hocon/lib/src/simple_includer.cc +186 -0
- data/ext/facter/cpp-hocon/lib/src/substitution_expression.cc +35 -0
- data/ext/facter/cpp-hocon/lib/src/token.cc +52 -0
- data/ext/facter/cpp-hocon/lib/src/tokenizer.cc +568 -0
- data/ext/facter/cpp-hocon/lib/src/tokens.cc +257 -0
- data/ext/facter/cpp-hocon/lib/src/values/config_boolean.cc +34 -0
- data/ext/facter/cpp-hocon/lib/src/values/config_concatenation.cc +260 -0
- data/ext/facter/cpp-hocon/lib/src/values/config_delayed_merge.cc +223 -0
- data/ext/facter/cpp-hocon/lib/src/values/config_delayed_merge_object.cc +180 -0
- data/ext/facter/cpp-hocon/lib/src/values/config_double.cc +35 -0
- data/ext/facter/cpp-hocon/lib/src/values/config_int.cc +35 -0
- data/ext/facter/cpp-hocon/lib/src/values/config_long.cc +35 -0
- data/ext/facter/cpp-hocon/lib/src/values/config_null.cc +35 -0
- data/ext/facter/cpp-hocon/lib/src/values/config_number.cc +78 -0
- data/ext/facter/cpp-hocon/lib/src/values/config_object.cc +97 -0
- data/ext/facter/cpp-hocon/lib/src/values/config_reference.cc +85 -0
- data/ext/facter/cpp-hocon/lib/src/values/config_string.cc +47 -0
- data/ext/facter/cpp-hocon/lib/src/values/config_value.cc +289 -0
- data/ext/facter/cpp-hocon/lib/src/values/simple_config_list.cc +219 -0
- data/ext/facter/cpp-hocon/lib/src/values/simple_config_object.cc +515 -0
- data/ext/facter/cpp-hocon/lib/tests/CMakeLists.txt +42 -0
- data/ext/facter/cpp-hocon/lib/tests/concatenation_test.cc +401 -0
- data/ext/facter/cpp-hocon/lib/tests/conf_parser_test.cc +715 -0
- data/ext/facter/cpp-hocon/lib/tests/config_document_parser_test.cc +208 -0
- data/ext/facter/cpp-hocon/lib/tests/config_document_tests.cc +110 -0
- data/ext/facter/cpp-hocon/lib/tests/config_node_test.cc +338 -0
- data/ext/facter/cpp-hocon/lib/tests/config_substitution_test.cc +897 -0
- data/ext/facter/cpp-hocon/lib/tests/config_test.cc +151 -0
- data/ext/facter/cpp-hocon/lib/tests/config_value_factory_test.cc +60 -0
- data/ext/facter/cpp-hocon/lib/tests/config_value_test.cc +111 -0
- data/ext/facter/cpp-hocon/lib/tests/fixtures.hpp.in +3 -0
- data/ext/facter/cpp-hocon/lib/tests/fixtures/test01.conf +91 -0
- data/ext/facter/cpp-hocon/lib/tests/fixtures/test01.json +4 -0
- data/ext/facter/cpp-hocon/lib/tests/main.cc +8 -0
- data/ext/facter/cpp-hocon/lib/tests/path_test.cc +129 -0
- data/ext/facter/cpp-hocon/lib/tests/program_options.cc +63 -0
- data/ext/facter/cpp-hocon/lib/tests/test.conf +1 -0
- data/ext/facter/cpp-hocon/lib/tests/test_utils.cc +452 -0
- data/ext/facter/cpp-hocon/lib/tests/test_utils.hpp +139 -0
- data/ext/facter/cpp-hocon/lib/tests/token_test.cc +108 -0
- data/ext/facter/cpp-hocon/lib/tests/tokenizer_test.cc +694 -0
- data/ext/facter/cpp-hocon/lib/version.h.in +28 -0
- data/ext/facter/cpp-hocon/locales/CMakeLists.txt +4 -0
- data/ext/facter/cpp-hocon/locales/cpp-hocon.pot +767 -0
- data/ext/facter/extconf.rb +22 -0
- data/ext/facter/facter/CMakeLists.txt +183 -0
- data/ext/facter/facter/CONTRIBUTING.md +99 -0
- data/ext/facter/facter/Extensibility.md +133 -0
- data/ext/facter/facter/LICENSE +17 -0
- data/ext/facter/facter/MAINTAINERS +28 -0
- data/ext/facter/facter/README.md +295 -0
- data/ext/facter/facter/Rakefile +42 -0
- data/ext/facter/facter/acceptance/Gemfile +21 -0
- data/ext/facter/facter/acceptance/Rakefile +342 -0
- data/ext/facter/facter/acceptance/bin/ci-bootstrap-from-artifacts.sh +55 -0
- data/ext/facter/facter/acceptance/config/aio/options.rb +9 -0
- data/ext/facter/facter/acceptance/config/git/options.rb +7 -0
- data/ext/facter/facter/acceptance/config/nodes/aix-53-power.yaml +7 -0
- data/ext/facter/facter/acceptance/config/nodes/aix-61-power.yaml +7 -0
- data/ext/facter/facter/acceptance/config/nodes/aix-71-power.yaml +7 -0
- data/ext/facter/facter/acceptance/config/nodes/huaweios-6-powerpc.yaml +7 -0
- data/ext/facter/facter/acceptance/config/nodes/solaris-10-sparc.yaml +9 -0
- data/ext/facter/facter/acceptance/config/nodes/solaris-11-sparc.yaml +9 -0
- data/ext/facter/facter/acceptance/lib/facter/acceptance/base_fact_utils.rb +563 -0
- data/ext/facter/facter/acceptance/lib/facter/acceptance/user_fact_utils.rb +132 -0
- data/ext/facter/facter/acceptance/lib/helper.rb +1 -0
- data/ext/facter/facter/acceptance/lib/puppet/acceptance/common_utils.rb +10 -0
- data/ext/facter/facter/acceptance/lib/puppet/acceptance/git_utils.rb +19 -0
- data/ext/facter/facter/acceptance/lib/puppet/acceptance/install_utils.rb +58 -0
- data/ext/facter/facter/acceptance/setup/aio/pre-suite/010_Install.rb +22 -0
- data/ext/facter/facter/acceptance/setup/aio/pre-suite/021_InstallAristaModule.rb +12 -0
- data/ext/facter/facter/acceptance/setup/aio/pre-suite/022_Remove_LD_PRELOAD.rb +11 -0
- data/ext/facter/facter/acceptance/setup/common/00_EnvSetup.rb +64 -0
- data/ext/facter/facter/acceptance/setup/common/pre-suite/000-delete-puppet-when-none.rb +11 -0
- data/ext/facter/facter/acceptance/setup/git/pre-suite/01_TestSetup.rb +31 -0
- data/ext/facter/facter/acceptance/tests/custom_facts/custom_fact_with_10001_weight_overrides_external_fact.rb +30 -0
- data/ext/facter/facter/acceptance/tests/custom_facts/having_multiple_facts_in_one_file.rb +40 -0
- data/ext/facter/facter/acceptance/tests/custom_facts/using_win32ole_should_not_hang.rb +33 -0
- data/ext/facter/facter/acceptance/tests/external_facts/env_var_overrides_external_fact.rb +46 -0
- data/ext/facter/facter/acceptance/tests/external_facts/external_dir_overrides_default_external_fact.rb +34 -0
- data/ext/facter/facter/acceptance/tests/external_facts/external_fact_overrides_custom_fact.rb +29 -0
- data/ext/facter/facter/acceptance/tests/external_facts/external_fact_overrides_custom_fact_with_10000_weight_or_less.rb +30 -0
- data/ext/facter/facter/acceptance/tests/external_facts/external_fact_overrides_custom_fact_with_confine.rb +35 -0
- data/ext/facter/facter/acceptance/tests/external_facts/external_fact_stderr_messages_output_to_stderr.rb +49 -0
- data/ext/facter/facter/acceptance/tests/external_facts/external_facts_only_run_once.rb +43 -0
- data/ext/facter/facter/acceptance/tests/external_facts/fact_directory_precedence.rb +109 -0
- data/ext/facter/facter/acceptance/tests/external_facts/non_root_users_default_external_fact_directory.rb +142 -0
- data/ext/facter/facter/acceptance/tests/external_facts/root_uses_default_external_fact_dir.rb +34 -0
- data/ext/facter/facter/acceptance/tests/external_facts/structured_executable_facts.rb +139 -0
- data/ext/facter/facter/acceptance/tests/facter_returns_success_on_non_existent_fact.rb +9 -0
- data/ext/facter/facter/acceptance/tests/facts/dmi.rb +51 -0
- data/ext/facter/facter/acceptance/tests/facts/facterversion.rb +11 -0
- data/ext/facter/facter/acceptance/tests/facts/identity.rb +52 -0
- data/ext/facter/facter/acceptance/tests/facts/networking_facts.rb +76 -0
- data/ext/facter/facter/acceptance/tests/facts/non_root_users_without_errors.rb +32 -0
- data/ext/facter/facter/acceptance/tests/facts/operatingsystem_detection_after_clear_on_ubuntu.rb +26 -0
- data/ext/facter/facter/acceptance/tests/facts/os_processors_and_kernel.rb +20 -0
- data/ext/facter/facter/acceptance/tests/facts/partitions.rb +37 -0
- data/ext/facter/facter/acceptance/tests/facts/productname.rb +15 -0
- data/ext/facter/facter/acceptance/tests/facts/ruby.rb +59 -0
- data/ext/facter/facter/acceptance/tests/facts/validate_file_system_size_bytes.rb +37 -0
- data/ext/facter/facter/acceptance/tests/facts/verify_tmpfs_file_system.rb +54 -0
- data/ext/facter/facter/acceptance/tests/load_libfacter.rb +66 -0
- data/ext/facter/facter/acceptance/tests/no_errors_on_stderr.rb +10 -0
- data/ext/facter/facter/acceptance/tests/options/color.rb +16 -0
- data/ext/facter/facter/acceptance/tests/options/config.rb +27 -0
- data/ext/facter/facter/acceptance/tests/options/config_file/blocklist.rb +35 -0
- data/ext/facter/facter/acceptance/tests/options/config_file/blocklist_from_puppet_facts.rb +40 -0
- data/ext/facter/facter/acceptance/tests/options/config_file/custom_dir_overridden_by_cli_custom_dir.rb +56 -0
- data/ext/facter/facter/acceptance/tests/options/config_file/custom_facts.rb +42 -0
- data/ext/facter/facter/acceptance/tests/options/config_file/custom_facts_list.rb +56 -0
- data/ext/facter/facter/acceptance/tests/options/config_file/debug.rb +34 -0
- data/ext/facter/facter/acceptance/tests/options/config_file/debug_override_config_file.rb +34 -0
- data/ext/facter/facter/acceptance/tests/options/config_file/default_file_location.rb +37 -0
- data/ext/facter/facter/acceptance/tests/options/config_file/external_dir_conflicts_with_cli_no_external_facts.rb +37 -0
- data/ext/facter/facter/acceptance/tests/options/config_file/external_dir_overridden_by_cli_external_dir.rb +40 -0
- data/ext/facter/facter/acceptance/tests/options/config_file/external_facts.rb +37 -0
- data/ext/facter/facter/acceptance/tests/options/config_file/external_facts_list.rb +43 -0
- data/ext/facter/facter/acceptance/tests/options/config_file/load_from_ruby.rb +73 -0
- data/ext/facter/facter/acceptance/tests/options/config_file/log_level.rb +35 -0
- data/ext/facter/facter/acceptance/tests/options/config_file/no_custom_facts_and_custom_dir.rb +43 -0
- data/ext/facter/facter/acceptance/tests/options/config_file/no_custom_facts_and_facterlib.rb +43 -0
- data/ext/facter/facter/acceptance/tests/options/config_file/no_custom_facts_and_load_path.rb +49 -0
- data/ext/facter/facter/acceptance/tests/options/config_file/no_external_facts.rb +38 -0
- data/ext/facter/facter/acceptance/tests/options/config_file/no_external_facts_and_external_dir.rb +34 -0
- data/ext/facter/facter/acceptance/tests/options/config_file/no_ruby_disables_custom_facts.rb +52 -0
- data/ext/facter/facter/acceptance/tests/options/config_file/no_ruby_disables_ruby_facts.rb +34 -0
- data/ext/facter/facter/acceptance/tests/options/config_file/trace.rb +48 -0
- data/ext/facter/facter/acceptance/tests/options/config_file/ttls_cached_facts_clear_by_empty_ttls_cache_list.rb +71 -0
- data/ext/facter/facter/acceptance/tests/options/config_file/ttls_cached_facts_creates_json_cache_file.rb +48 -0
- data/ext/facter/facter/acceptance/tests/options/config_file/ttls_cached_facts_expire_facts_do_not_read_the_old_cached_value.rb +58 -0
- data/ext/facter/facter/acceptance/tests/options/config_file/ttls_cached_facts_expire_facts_refresh_the_cached_value.rb +61 -0
- data/ext/facter/facter/acceptance/tests/options/config_file/ttls_cached_facts_read_from_the_cached_value.rb +57 -0
- data/ext/facter/facter/acceptance/tests/options/config_file/ttls_cached_facts_that_are_corrupt_are_refreshed.rb +53 -0
- data/ext/facter/facter/acceptance/tests/options/config_file/ttls_cached_facts_that_are_empty_return_an_empty_value.rb +53 -0
- data/ext/facter/facter/acceptance/tests/options/config_file/ttls_puppet_facts_creates_json_for_cached_facts.rb +45 -0
- data/ext/facter/facter/acceptance/tests/options/config_file/ttls_puppet_facts_honors_cached_facts.rb +54 -0
- data/ext/facter/facter/acceptance/tests/options/config_file/verbose.rb +34 -0
- data/ext/facter/facter/acceptance/tests/options/custom_facts.rb +34 -0
- data/ext/facter/facter/acceptance/tests/options/custom_facts_facterlib.rb +33 -0
- data/ext/facter/facter/acceptance/tests/options/custom_facts_list.rb +48 -0
- data/ext/facter/facter/acceptance/tests/options/custom_facts_load_path.rb +42 -0
- data/ext/facter/facter/acceptance/tests/options/debug.rb +12 -0
- data/ext/facter/facter/acceptance/tests/options/external_facts.rb +28 -0
- data/ext/facter/facter/acceptance/tests/options/external_facts_list.rb +35 -0
- data/ext/facter/facter/acceptance/tests/options/help.rb +13 -0
- data/ext/facter/facter/acceptance/tests/options/json.rb +43 -0
- data/ext/facter/facter/acceptance/tests/options/list_block_groups.rb +16 -0
- data/ext/facter/facter/acceptance/tests/options/list_cache_groups.rb +16 -0
- data/ext/facter/facter/acceptance/tests/options/log_level.rb +13 -0
- data/ext/facter/facter/acceptance/tests/options/no_block.rb +34 -0
- data/ext/facter/facter/acceptance/tests/options/no_cache_should_not_cache_facts.rb +43 -0
- data/ext/facter/facter/acceptance/tests/options/no_cache_should_not_load_cached_facts.rb +58 -0
- data/ext/facter/facter/acceptance/tests/options/no_cache_should_not_refresh_cached_facts.rb +63 -0
- data/ext/facter/facter/acceptance/tests/options/no_color.rb +16 -0
- data/ext/facter/facter/acceptance/tests/options/no_custom_facts.rb +34 -0
- data/ext/facter/facter/acceptance/tests/options/no_custom_facts_and_custom_dir.rb +19 -0
- data/ext/facter/facter/acceptance/tests/options/no_custom_facts_and_facterlib.rb +34 -0
- data/ext/facter/facter/acceptance/tests/options/no_custom_facts_and_load_path.rb +43 -0
- data/ext/facter/facter/acceptance/tests/options/no_external_facts.rb +28 -0
- data/ext/facter/facter/acceptance/tests/options/no_external_facts_and_external_dir.rb +19 -0
- data/ext/facter/facter/acceptance/tests/options/no_ruby.rb +44 -0
- data/ext/facter/facter/acceptance/tests/options/puppet_facts.rb +35 -0
- data/ext/facter/facter/acceptance/tests/options/show_legacy.rb +18 -0
- data/ext/facter/facter/acceptance/tests/options/strict.rb +11 -0
- data/ext/facter/facter/acceptance/tests/options/trace.rb +36 -0
- data/ext/facter/facter/acceptance/tests/options/verbose.rb +12 -0
- data/ext/facter/facter/acceptance/tests/options/version.rb +12 -0
- data/ext/facter/facter/acceptance/tests/options/yaml.rb +43 -0
- data/ext/facter/facter/acceptance/tests/ticket_1123_facter_with_invalid_locale.rb +22 -0
- data/ext/facter/facter/acceptance/tests/ticket_1238_hostname_fqdn.rb +57 -0
- data/ext/facter/facter/appveyor.yml +43 -0
- data/ext/facter/facter/cmake/FindBLKID.cmake +6 -0
- data/ext/facter/facter/cmake/FindCPPHOCON.cmake +6 -0
- data/ext/facter/facter/cmake/FindDependency.cmake +54 -0
- data/ext/facter/facter/cmake/FindOPENSSL.cmake +10 -0
- data/ext/facter/facter/cmake/FindRuby.cmake +286 -0
- data/ext/facter/facter/cmake/FindWHEREAMI.cmake +6 -0
- data/ext/facter/facter/cmake/FindYAMLCPP.cmake +17 -0
- data/ext/facter/facter/contrib/dockerfiles/travis-cpp-builder/Dockerfile +56 -0
- data/ext/facter/facter/contrib/dockerfiles/travis-facter-builder/Dockerfile +23 -0
- data/ext/facter/facter/contrib/dockerfiles/travis-facter-coverity/Dockerfile +40 -0
- data/ext/facter/facter/contrib/dockerfiles/travis-facter-coverity/_coverity-submit.erb +12 -0
- data/ext/facter/facter/contrib/dockerfiles/travis-facter-coverity/fix_curl_command.patch +32 -0
- data/ext/facter/facter/exe/CMakeLists.txt +39 -0
- data/ext/facter/facter/exe/facter.cc +377 -0
- data/ext/facter/facter/ext/build_defaults.yaml +16 -0
- data/ext/facter/facter/ext/debian/changelog.erb +11 -0
- data/ext/facter/facter/ext/debian/compat +1 -0
- data/ext/facter/facter/ext/debian/control +14 -0
- data/ext/facter/facter/ext/debian/copyright +19 -0
- data/ext/facter/facter/ext/debian/docs +2 -0
- data/ext/facter/facter/ext/debian/facter.install +4 -0
- data/ext/facter/facter/ext/debian/lintian-overrides +0 -0
- data/ext/facter/facter/ext/debian/rules +39 -0
- data/ext/facter/facter/ext/debian/source/format +1 -0
- data/ext/facter/facter/ext/project_data.yaml +30 -0
- data/ext/facter/facter/ext/redhat/facter.spec.erb +113 -0
- data/ext/facter/facter/ext/windows/facter.bat +8 -0
- data/ext/facter/facter/ext/windows/facter_interactive.bat +6 -0
- data/ext/facter/facter/ext/windows/run_facter_interactive.bat +9 -0
- data/ext/facter/facter/factergo/example/main.go +17 -0
- data/ext/facter/facter/factergo/facter.go +42 -0
- data/ext/facter/facter/factergo/facter_test.go +25 -0
- data/ext/facter/facter/lib/CMakeLists.txt +409 -0
- data/ext/facter/facter/lib/Doxyfile +2313 -0
- data/ext/facter/facter/lib/Facter.java.in +110 -0
- data/ext/facter/facter/lib/Gemfile +11 -0
- data/ext/facter/facter/lib/Rakefile +8 -0
- data/ext/facter/facter/lib/docs/generate.rb +25 -0
- data/ext/facter/facter/lib/docs/namespaces.dox +129 -0
- data/ext/facter/facter/lib/docs/template.erb +43 -0
- data/ext/facter/facter/lib/facter.rb.in +45 -0
- data/ext/facter/facter/lib/gemspec.in +21 -0
- data/ext/facter/facter/lib/inc/facter/cwrapper.hpp +18 -0
- data/ext/facter/facter/lib/inc/facter/facts/array_value.hpp +125 -0
- data/ext/facter/facter/lib/inc/facter/facts/collection.hpp +339 -0
- data/ext/facter/facter/lib/inc/facter/facts/external/resolver.hpp +49 -0
- data/ext/facter/facter/lib/inc/facter/facts/fact.hpp +669 -0
- data/ext/facter/facter/lib/inc/facter/facts/map_value.hpp +127 -0
- data/ext/facter/facter/lib/inc/facter/facts/os.hpp +202 -0
- data/ext/facter/facter/lib/inc/facter/facts/os_family.hpp +58 -0
- data/ext/facter/facter/lib/inc/facter/facts/resolver.hpp +126 -0
- data/ext/facter/facter/lib/inc/facter/facts/scalar_value.hpp +152 -0
- data/ext/facter/facter/lib/inc/facter/facts/value.hpp +164 -0
- data/ext/facter/facter/lib/inc/facter/facts/vm.hpp +157 -0
- data/ext/facter/facter/lib/inc/facter/logging/logging.hpp +192 -0
- data/ext/facter/facter/lib/inc/facter/ruby/ruby.hpp +62 -0
- data/ext/facter/facter/lib/inc/facter/util/config.hpp +84 -0
- data/ext/facter/facter/lib/inc/facter/util/string.hpp +72 -0
- data/ext/facter/facter/lib/inc/internal/facts/aix/disk_resolver.hpp +25 -0
- data/ext/facter/facter/lib/inc/internal/facts/aix/filesystem_resolver.hpp +41 -0
- data/ext/facter/facter/lib/inc/internal/facts/aix/kernel_resolver.hpp +25 -0
- data/ext/facter/facter/lib/inc/internal/facts/aix/memory_resolver.hpp +25 -0
- data/ext/facter/facter/lib/inc/internal/facts/aix/networking_resolver.hpp +49 -0
- data/ext/facter/facter/lib/inc/internal/facts/aix/operating_system_resolver.hpp +24 -0
- data/ext/facter/facter/lib/inc/internal/facts/aix/processor_resolver.hpp +25 -0
- data/ext/facter/facter/lib/inc/internal/facts/aix/serial_number_resolver.hpp +27 -0
- data/ext/facter/facter/lib/inc/internal/facts/bsd/filesystem_resolver.hpp +30 -0
- data/ext/facter/facter/lib/inc/internal/facts/bsd/networking_resolver.hpp +59 -0
- data/ext/facter/facter/lib/inc/internal/facts/bsd/uptime_resolver.hpp +24 -0
- data/ext/facter/facter/lib/inc/internal/facts/cache.hpp +71 -0
- data/ext/facter/facter/lib/inc/internal/facts/external/execution_resolver.hpp +31 -0
- data/ext/facter/facter/lib/inc/internal/facts/external/json_resolver.hpp +31 -0
- data/ext/facter/facter/lib/inc/internal/facts/external/text_resolver.hpp +31 -0
- data/ext/facter/facter/lib/inc/internal/facts/external/windows/powershell_resolver.hpp +34 -0
- data/ext/facter/facter/lib/inc/internal/facts/external/yaml_resolver.hpp +31 -0
- data/ext/facter/facter/lib/inc/internal/facts/freebsd/dmi_resolver.hpp +28 -0
- data/ext/facter/facter/lib/inc/internal/facts/freebsd/memory_resolver.hpp +25 -0
- data/ext/facter/facter/lib/inc/internal/facts/freebsd/networking_resolver.hpp +42 -0
- data/ext/facter/facter/lib/inc/internal/facts/freebsd/operating_system_resolver.hpp +24 -0
- data/ext/facter/facter/lib/inc/internal/facts/freebsd/processor_resolver.hpp +25 -0
- data/ext/facter/facter/lib/inc/internal/facts/freebsd/virtualization_resolver.hpp +27 -0
- data/ext/facter/facter/lib/inc/internal/facts/freebsd/zfs_resolver.hpp +24 -0
- data/ext/facter/facter/lib/inc/internal/facts/freebsd/zpool_resolver.hpp +24 -0
- data/ext/facter/facter/lib/inc/internal/facts/glib/load_average_resolver.hpp +24 -0
- data/ext/facter/facter/lib/inc/internal/facts/linux/disk_resolver.hpp +25 -0
- data/ext/facter/facter/lib/inc/internal/facts/linux/dmi_resolver.hpp +37 -0
- data/ext/facter/facter/lib/inc/internal/facts/linux/filesystem_resolver.hpp +40 -0
- data/ext/facter/facter/lib/inc/internal/facts/linux/fips_resolver.hpp +31 -0
- data/ext/facter/facter/lib/inc/internal/facts/linux/kernel_resolver.hpp +25 -0
- data/ext/facter/facter/lib/inc/internal/facts/linux/memory_resolver.hpp +25 -0
- data/ext/facter/facter/lib/inc/internal/facts/linux/networking_resolver.hpp +78 -0
- data/ext/facter/facter/lib/inc/internal/facts/linux/operating_system_resolver.hpp +28 -0
- data/ext/facter/facter/lib/inc/internal/facts/linux/os_cisco.hpp +114 -0
- data/ext/facter/facter/lib/inc/internal/facts/linux/os_coreos.hpp +56 -0
- data/ext/facter/facter/lib/inc/internal/facts/linux/os_cumulus.hpp +56 -0
- data/ext/facter/facter/lib/inc/internal/facts/linux/os_linux.hpp +72 -0
- data/ext/facter/facter/lib/inc/internal/facts/linux/processor_resolver.hpp +60 -0
- data/ext/facter/facter/lib/inc/internal/facts/linux/release_file.hpp +124 -0
- data/ext/facter/facter/lib/inc/internal/facts/linux/uptime_resolver.hpp +24 -0
- data/ext/facter/facter/lib/inc/internal/facts/linux/virtualization_resolver.hpp +50 -0
- data/ext/facter/facter/lib/inc/internal/facts/openbsd/dmi_resolver.hpp +28 -0
- data/ext/facter/facter/lib/inc/internal/facts/openbsd/memory_resolver.hpp +25 -0
- data/ext/facter/facter/lib/inc/internal/facts/openbsd/networking_resolver.hpp +42 -0
- data/ext/facter/facter/lib/inc/internal/facts/openbsd/processor_resolver.hpp +25 -0
- data/ext/facter/facter/lib/inc/internal/facts/openbsd/virtualization_resolver.hpp +25 -0
- data/ext/facter/facter/lib/inc/internal/facts/osx/dmi_resolver.hpp +25 -0
- data/ext/facter/facter/lib/inc/internal/facts/osx/memory_resolver.hpp +25 -0
- data/ext/facter/facter/lib/inc/internal/facts/osx/networking_resolver.hpp +60 -0
- data/ext/facter/facter/lib/inc/internal/facts/osx/operating_system_resolver.hpp +25 -0
- data/ext/facter/facter/lib/inc/internal/facts/osx/processor_resolver.hpp +25 -0
- data/ext/facter/facter/lib/inc/internal/facts/osx/system_profiler_resolver.hpp +25 -0
- data/ext/facter/facter/lib/inc/internal/facts/osx/virtualization_resolver.hpp +25 -0
- data/ext/facter/facter/lib/inc/internal/facts/posix/identity_resolver.hpp +25 -0
- data/ext/facter/facter/lib/inc/internal/facts/posix/kernel_resolver.hpp +25 -0
- data/ext/facter/facter/lib/inc/internal/facts/posix/networking_resolver.hpp +48 -0
- data/ext/facter/facter/lib/inc/internal/facts/posix/operating_system_resolver.hpp +25 -0
- data/ext/facter/facter/lib/inc/internal/facts/posix/processor_resolver.hpp +25 -0
- data/ext/facter/facter/lib/inc/internal/facts/posix/ssh_resolver.hpp +28 -0
- data/ext/facter/facter/lib/inc/internal/facts/posix/timezone_resolver.hpp +24 -0
- data/ext/facter/facter/lib/inc/internal/facts/posix/uptime_resolver.hpp +32 -0
- data/ext/facter/facter/lib/inc/internal/facts/posix/xen_resolver.hpp +24 -0
- data/ext/facter/facter/lib/inc/internal/facts/resolvers/augeas_resolver.hpp +35 -0
- data/ext/facter/facter/lib/inc/internal/facts/resolvers/disk_resolver.hpp +81 -0
- data/ext/facter/facter/lib/inc/internal/facts/resolvers/dmi_resolver.hpp +115 -0
- data/ext/facter/facter/lib/inc/internal/facts/resolvers/ec2_resolver.hpp +30 -0
- data/ext/facter/facter/lib/inc/internal/facts/resolvers/filesystem_resolver.hpp +166 -0
- data/ext/facter/facter/lib/inc/internal/facts/resolvers/fips_resolver.hpp +46 -0
- data/ext/facter/facter/lib/inc/internal/facts/resolvers/gce_resolver.hpp +28 -0
- data/ext/facter/facter/lib/inc/internal/facts/resolvers/hypervisors_resolver.hpp +69 -0
- data/ext/facter/facter/lib/inc/internal/facts/resolvers/identity_resolver.hpp +73 -0
- data/ext/facter/facter/lib/inc/internal/facts/resolvers/kernel_resolver.hpp +66 -0
- data/ext/facter/facter/lib/inc/internal/facts/resolvers/ldom_resolver.hpp +64 -0
- data/ext/facter/facter/lib/inc/internal/facts/resolvers/load_average_resolver.hpp +37 -0
- data/ext/facter/facter/lib/inc/internal/facts/resolvers/memory_resolver.hpp +99 -0
- data/ext/facter/facter/lib/inc/internal/facts/resolvers/networking_resolver.hpp +155 -0
- data/ext/facter/facter/lib/inc/internal/facts/resolvers/operating_system_resolver.hpp +235 -0
- data/ext/facter/facter/lib/inc/internal/facts/resolvers/path_resolver.hpp +28 -0
- data/ext/facter/facter/lib/inc/internal/facts/resolvers/processor_resolver.hpp +80 -0
- data/ext/facter/facter/lib/inc/internal/facts/resolvers/ruby_resolver.hpp +56 -0
- data/ext/facter/facter/lib/inc/internal/facts/resolvers/ssh_resolver.hpp +105 -0
- data/ext/facter/facter/lib/inc/internal/facts/resolvers/system_profiler_resolver.hpp +127 -0
- data/ext/facter/facter/lib/inc/internal/facts/resolvers/timezone_resolver.hpp +36 -0
- data/ext/facter/facter/lib/inc/internal/facts/resolvers/uptime_resolver.hpp +36 -0
- data/ext/facter/facter/lib/inc/internal/facts/resolvers/virtualization_resolver.hpp +95 -0
- data/ext/facter/facter/lib/inc/internal/facts/resolvers/xen_resolver.hpp +55 -0
- data/ext/facter/facter/lib/inc/internal/facts/resolvers/zfs_resolver.hpp +59 -0
- data/ext/facter/facter/lib/inc/internal/facts/resolvers/zone_resolver.hpp +95 -0
- data/ext/facter/facter/lib/inc/internal/facts/resolvers/zpool_resolver.hpp +63 -0
- data/ext/facter/facter/lib/inc/internal/facts/solaris/disk_resolver.hpp +25 -0
- data/ext/facter/facter/lib/inc/internal/facts/solaris/dmi_resolver.hpp +25 -0
- data/ext/facter/facter/lib/inc/internal/facts/solaris/filesystem_resolver.hpp +29 -0
- data/ext/facter/facter/lib/inc/internal/facts/solaris/kernel_resolver.hpp +25 -0
- data/ext/facter/facter/lib/inc/internal/facts/solaris/ldom_resolver.hpp +25 -0
- data/ext/facter/facter/lib/inc/internal/facts/solaris/memory_resolver.hpp +25 -0
- data/ext/facter/facter/lib/inc/internal/facts/solaris/networking_resolver.hpp +48 -0
- data/ext/facter/facter/lib/inc/internal/facts/solaris/operating_system_resolver.hpp +25 -0
- data/ext/facter/facter/lib/inc/internal/facts/solaris/processor_resolver.hpp +25 -0
- data/ext/facter/facter/lib/inc/internal/facts/solaris/virtualization_resolver.hpp +25 -0
- data/ext/facter/facter/lib/inc/internal/facts/solaris/zfs_resolver.hpp +24 -0
- data/ext/facter/facter/lib/inc/internal/facts/solaris/zone_resolver.hpp +25 -0
- data/ext/facter/facter/lib/inc/internal/facts/solaris/zpool_resolver.hpp +24 -0
- data/ext/facter/facter/lib/inc/internal/facts/windows/dmi_resolver.hpp +38 -0
- data/ext/facter/facter/lib/inc/internal/facts/windows/identity_resolver.hpp +25 -0
- data/ext/facter/facter/lib/inc/internal/facts/windows/kernel_resolver.hpp +25 -0
- data/ext/facter/facter/lib/inc/internal/facts/windows/memory_resolver.hpp +25 -0
- data/ext/facter/facter/lib/inc/internal/facts/windows/networking_resolver.hpp +74 -0
- data/ext/facter/facter/lib/inc/internal/facts/windows/operating_system_resolver.hpp +36 -0
- data/ext/facter/facter/lib/inc/internal/facts/windows/processor_resolver.hpp +36 -0
- data/ext/facter/facter/lib/inc/internal/facts/windows/timezone_resolver.hpp +24 -0
- data/ext/facter/facter/lib/inc/internal/facts/windows/uptime_resolver.hpp +32 -0
- data/ext/facter/facter/lib/inc/internal/facts/windows/virtualization_resolver.hpp +37 -0
- data/ext/facter/facter/lib/inc/internal/ruby/aggregate_resolution.hpp +77 -0
- data/ext/facter/facter/lib/inc/internal/ruby/chunk.hpp +83 -0
- data/ext/facter/facter/lib/inc/internal/ruby/confine.hpp +60 -0
- data/ext/facter/facter/lib/inc/internal/ruby/fact.hpp +108 -0
- data/ext/facter/facter/lib/inc/internal/ruby/module.hpp +165 -0
- data/ext/facter/facter/lib/inc/internal/ruby/resolution.hpp +126 -0
- data/ext/facter/facter/lib/inc/internal/ruby/ruby_value.hpp +119 -0
- data/ext/facter/facter/lib/inc/internal/ruby/simple_resolution.hpp +56 -0
- data/ext/facter/facter/lib/inc/internal/util/agent.hpp +29 -0
- data/ext/facter/facter/lib/inc/internal/util/aix/odm.hpp +373 -0
- data/ext/facter/facter/lib/inc/internal/util/aix/vmount.hpp +139 -0
- data/ext/facter/facter/lib/inc/internal/util/bsd/scoped_ifaddrs.hpp +33 -0
- data/ext/facter/facter/lib/inc/internal/util/posix/scoped_addrinfo.hpp +45 -0
- data/ext/facter/facter/lib/inc/internal/util/posix/scoped_bio.hpp +34 -0
- data/ext/facter/facter/lib/inc/internal/util/posix/scoped_descriptor.hpp +27 -0
- data/ext/facter/facter/lib/inc/internal/util/scoped_file.hpp +36 -0
- data/ext/facter/facter/lib/inc/internal/util/solaris/k_stat.hpp +176 -0
- data/ext/facter/facter/lib/inc/internal/util/solaris/scoped_kstat.hpp +45 -0
- data/ext/facter/facter/lib/inc/internal/util/versions.hpp +34 -0
- data/ext/facter/facter/lib/inc/internal/util/windows/wsa.hpp +92 -0
- data/ext/facter/facter/lib/inc/internal/util/yaml.hpp +25 -0
- data/ext/facter/facter/lib/schema/core_facts.pot +2017 -0
- data/ext/facter/facter/lib/schema/facter.yaml +1947 -0
- data/ext/facter/facter/lib/schema/translation_tooling.rb +67 -0
- data/ext/facter/facter/lib/spec/unit/facter_spec.rb +136 -0
- data/ext/facter/facter/lib/spec_helper.rb.in +27 -0
- data/ext/facter/facter/lib/src/cwrapper.cc +45 -0
- data/ext/facter/facter/lib/src/facts/aix/collection.cc +32 -0
- data/ext/facter/facter/lib/src/facts/aix/disk_resolver.cc +66 -0
- data/ext/facter/facter/lib/src/facts/aix/filesystem_resolver.cc +132 -0
- data/ext/facter/facter/lib/src/facts/aix/kernel_resolver.cc +27 -0
- data/ext/facter/facter/lib/src/facts/aix/memory_resolver.cc +48 -0
- data/ext/facter/facter/lib/src/facts/aix/networking_resolver.cc +245 -0
- data/ext/facter/facter/lib/src/facts/aix/operating_system_resolver.cc +61 -0
- data/ext/facter/facter/lib/src/facts/aix/processor_resolver.cc +106 -0
- data/ext/facter/facter/lib/src/facts/aix/serial_number_resolver.cc +43 -0
- data/ext/facter/facter/lib/src/facts/array_value.cc +111 -0
- data/ext/facter/facter/lib/src/facts/bsd/collection.cc +27 -0
- data/ext/facter/facter/lib/src/facts/bsd/filesystem_resolver.cc +92 -0
- data/ext/facter/facter/lib/src/facts/bsd/networking_resolver.cc +175 -0
- data/ext/facter/facter/lib/src/facts/bsd/uptime_resolver.cc +23 -0
- data/ext/facter/facter/lib/src/facts/cache.cc +117 -0
- data/ext/facter/facter/lib/src/facts/collection.cc +661 -0
- data/ext/facter/facter/lib/src/facts/external/execution_resolver.cc +89 -0
- data/ext/facter/facter/lib/src/facts/external/json_resolver.cc +219 -0
- data/ext/facter/facter/lib/src/facts/external/resolver.cc +12 -0
- data/ext/facter/facter/lib/src/facts/external/text_resolver.cc +45 -0
- data/ext/facter/facter/lib/src/facts/external/windows/powershell_resolver.cc +117 -0
- data/ext/facter/facter/lib/src/facts/external/yaml_resolver.cc +45 -0
- data/ext/facter/facter/lib/src/facts/freebsd/collection.cc +41 -0
- data/ext/facter/facter/lib/src/facts/freebsd/dmi_resolver.cc +43 -0
- data/ext/facter/facter/lib/src/facts/freebsd/memory_resolver.cc +76 -0
- data/ext/facter/facter/lib/src/facts/freebsd/networking_resolver.cc +55 -0
- data/ext/facter/facter/lib/src/facts/freebsd/operating_system_resolver.cc +17 -0
- data/ext/facter/facter/lib/src/facts/freebsd/processor_resolver.cc +63 -0
- data/ext/facter/facter/lib/src/facts/freebsd/virtualization_resolver.cc +41 -0
- data/ext/facter/facter/lib/src/facts/freebsd/zfs_resolver.cc +12 -0
- data/ext/facter/facter/lib/src/facts/freebsd/zpool_resolver.cc +12 -0
- data/ext/facter/facter/lib/src/facts/glib/load_average_resolver.cc +22 -0
- data/ext/facter/facter/lib/src/facts/linux/collection.cc +44 -0
- data/ext/facter/facter/lib/src/facts/linux/disk_resolver.cc +80 -0
- data/ext/facter/facter/lib/src/facts/linux/dmi_resolver.cc +208 -0
- data/ext/facter/facter/lib/src/facts/linux/filesystem_resolver.cc +282 -0
- data/ext/facter/facter/lib/src/facts/linux/fips_resolver.cc +31 -0
- data/ext/facter/facter/lib/src/facts/linux/kernel_resolver.cc +20 -0
- data/ext/facter/facter/lib/src/facts/linux/memory_resolver.cc +50 -0
- data/ext/facter/facter/lib/src/facts/linux/networking_resolver.cc +275 -0
- data/ext/facter/facter/lib/src/facts/linux/operating_system_resolver.cc +175 -0
- data/ext/facter/facter/lib/src/facts/linux/os_linux.cc +393 -0
- data/ext/facter/facter/lib/src/facts/linux/processor_resolver.cc +200 -0
- data/ext/facter/facter/lib/src/facts/linux/uptime_resolver.cc +15 -0
- data/ext/facter/facter/lib/src/facts/linux/virtualization_resolver.cc +282 -0
- data/ext/facter/facter/lib/src/facts/map_value.cc +119 -0
- data/ext/facter/facter/lib/src/facts/openbsd/collection.cc +37 -0
- data/ext/facter/facter/lib/src/facts/openbsd/dmi_resolver.cc +47 -0
- data/ext/facter/facter/lib/src/facts/openbsd/memory_resolver.cc +76 -0
- data/ext/facter/facter/lib/src/facts/openbsd/networking_resolver.cc +55 -0
- data/ext/facter/facter/lib/src/facts/openbsd/processor_resolver.cc +59 -0
- data/ext/facter/facter/lib/src/facts/openbsd/virtualization_resolver.cc +20 -0
- data/ext/facter/facter/lib/src/facts/osx/collection.cc +39 -0
- data/ext/facter/facter/lib/src/facts/osx/dmi_resolver.cc +32 -0
- data/ext/facter/facter/lib/src/facts/osx/memory_resolver.cc +60 -0
- data/ext/facter/facter/lib/src/facts/osx/networking_resolver.cc +71 -0
- data/ext/facter/facter/lib/src/facts/osx/operating_system_resolver.cc +49 -0
- data/ext/facter/facter/lib/src/facts/osx/processor_resolver.cc +55 -0
- data/ext/facter/facter/lib/src/facts/osx/system_profiler_resolver.cc +66 -0
- data/ext/facter/facter/lib/src/facts/osx/virtualization_resolver.cc +46 -0
- data/ext/facter/facter/lib/src/facts/posix/cache.cc +9 -0
- data/ext/facter/facter/lib/src/facts/posix/collection.cc +48 -0
- data/ext/facter/facter/lib/src/facts/posix/identity_resolver.cc +79 -0
- data/ext/facter/facter/lib/src/facts/posix/kernel_resolver.cc +25 -0
- data/ext/facter/facter/lib/src/facts/posix/networking_resolver.cc +136 -0
- data/ext/facter/facter/lib/src/facts/posix/operatingsystem_resolver.cc +29 -0
- data/ext/facter/facter/lib/src/facts/posix/processor_resolver.cc +22 -0
- data/ext/facter/facter/lib/src/facts/posix/ssh_resolver.cc +116 -0
- data/ext/facter/facter/lib/src/facts/posix/timezone_resolver.cc +26 -0
- data/ext/facter/facter/lib/src/facts/posix/uptime_resolver.cc +53 -0
- data/ext/facter/facter/lib/src/facts/posix/xen_resolver.cc +43 -0
- data/ext/facter/facter/lib/src/facts/resolver.cc +105 -0
- data/ext/facter/facter/lib/src/facts/resolvers/augeas_resolver.cc +56 -0
- data/ext/facter/facter/lib/src/facts/resolvers/disk_resolver.cc +69 -0
- data/ext/facter/facter/lib/src/facts/resolvers/dmi_resolver.cc +160 -0
- data/ext/facter/facter/lib/src/facts/resolvers/ec2_resolver.cc +174 -0
- data/ext/facter/facter/lib/src/facts/resolvers/filesystem_resolver.cc +118 -0
- data/ext/facter/facter/lib/src/facts/resolvers/fips_resolver.cc +23 -0
- data/ext/facter/facter/lib/src/facts/resolvers/gce_resolver.cc +276 -0
- data/ext/facter/facter/lib/src/facts/resolvers/hypervisors_resolver.cc +76 -0
- data/ext/facter/facter/lib/src/facts/resolvers/identity_resolver.cc +50 -0
- data/ext/facter/facter/lib/src/facts/resolvers/kernel_resolver.cc +62 -0
- data/ext/facter/facter/lib/src/facts/resolvers/ldom_resolver.cc +60 -0
- data/ext/facter/facter/lib/src/facts/resolvers/load_average_resolver.cc +36 -0
- data/ext/facter/facter/lib/src/facts/resolvers/memory_resolver.cc +88 -0
- data/ext/facter/facter/lib/src/facts/resolvers/networking_resolver.cc +280 -0
- data/ext/facter/facter/lib/src/facts/resolvers/operating_system_resolver.cc +276 -0
- data/ext/facter/facter/lib/src/facts/resolvers/path_resolver.cc +25 -0
- data/ext/facter/facter/lib/src/facts/resolvers/processor_resolver.cc +70 -0
- data/ext/facter/facter/lib/src/facts/resolvers/ruby_resolver.cc +109 -0
- data/ext/facter/facter/lib/src/facts/resolvers/ssh_resolver.cc +77 -0
- data/ext/facter/facter/lib/src/facts/resolvers/system_profiler_resolver.cc +137 -0
- data/ext/facter/facter/lib/src/facts/resolvers/timezone_resolver.cc +27 -0
- data/ext/facter/facter/lib/src/facts/resolvers/uptime_resolver.cc +63 -0
- data/ext/facter/facter/lib/src/facts/resolvers/virtualization_resolver.cc +119 -0
- data/ext/facter/facter/lib/src/facts/resolvers/xen_resolver.cc +80 -0
- data/ext/facter/facter/lib/src/facts/resolvers/zfs_resolver.cc +63 -0
- data/ext/facter/facter/lib/src/facts/resolvers/zone_resolver.cc +91 -0
- data/ext/facter/facter/lib/src/facts/resolvers/zpool_resolver.cc +93 -0
- data/ext/facter/facter/lib/src/facts/scalar_value.cc +73 -0
- data/ext/facter/facter/lib/src/facts/solaris/collection.cc +51 -0
- data/ext/facter/facter/lib/src/facts/solaris/disk_resolver.cc +35 -0
- data/ext/facter/facter/lib/src/facts/solaris/dmi_resolver.cc +86 -0
- data/ext/facter/facter/lib/src/facts/solaris/filesystem_resolver.cc +92 -0
- data/ext/facter/facter/lib/src/facts/solaris/kernel_resolver.cc +24 -0
- data/ext/facter/facter/lib/src/facts/solaris/ldom_resolver.cc +87 -0
- data/ext/facter/facter/lib/src/facts/solaris/memory_resolver.cc +91 -0
- data/ext/facter/facter/lib/src/facts/solaris/networking_resolver.cc +183 -0
- data/ext/facter/facter/lib/src/facts/solaris/operating_system_resolver.cc +83 -0
- data/ext/facter/facter/lib/src/facts/solaris/processor_resolver.cc +105 -0
- data/ext/facter/facter/lib/src/facts/solaris/virtualization_resolver.cc +38 -0
- data/ext/facter/facter/lib/src/facts/solaris/zfs_resolver.cc +12 -0
- data/ext/facter/facter/lib/src/facts/solaris/zone_resolver.cc +33 -0
- data/ext/facter/facter/lib/src/facts/solaris/zpool_resolver.cc +12 -0
- data/ext/facter/facter/lib/src/facts/windows/cache.cc +11 -0
- data/ext/facter/facter/lib/src/facts/windows/collection.cc +91 -0
- data/ext/facter/facter/lib/src/facts/windows/dmi_resolver.cc +38 -0
- data/ext/facter/facter/lib/src/facts/windows/identity_resolver.cc +46 -0
- data/ext/facter/facter/lib/src/facts/windows/kernel_resolver.cc +78 -0
- data/ext/facter/facter/lib/src/facts/windows/memory_resolver.cc +25 -0
- data/ext/facter/facter/lib/src/facts/windows/networking_resolver.cc +227 -0
- data/ext/facter/facter/lib/src/facts/windows/operating_system_resolver.cc +125 -0
- data/ext/facter/facter/lib/src/facts/windows/processor_resolver.cc +99 -0
- data/ext/facter/facter/lib/src/facts/windows/timezone_resolver.cc +28 -0
- data/ext/facter/facter/lib/src/facts/windows/uptime_resolver.cc +26 -0
- data/ext/facter/facter/lib/src/facts/windows/virtualization_resolver.cc +63 -0
- data/ext/facter/facter/lib/src/java/facter.cc +185 -0
- data/ext/facter/facter/lib/src/logging/logging.cc +151 -0
- data/ext/facter/facter/lib/src/ruby/aggregate_resolution.cc +249 -0
- data/ext/facter/facter/lib/src/ruby/chunk.cc +136 -0
- data/ext/facter/facter/lib/src/ruby/confine.cc +84 -0
- data/ext/facter/facter/lib/src/ruby/fact.cc +382 -0
- data/ext/facter/facter/lib/src/ruby/module.cc +1130 -0
- data/ext/facter/facter/lib/src/ruby/resolution.cc +230 -0
- data/ext/facter/facter/lib/src/ruby/ruby.cc +150 -0
- data/ext/facter/facter/lib/src/ruby/ruby_value.cc +288 -0
- data/ext/facter/facter/lib/src/ruby/simple_resolution.cc +156 -0
- data/ext/facter/facter/lib/src/util/bsd/scoped_ifaddrs.cc +29 -0
- data/ext/facter/facter/lib/src/util/config/config.cc +83 -0
- data/ext/facter/facter/lib/src/util/config/posix/config.cc +12 -0
- data/ext/facter/facter/lib/src/util/config/windows/config.cc +14 -0
- data/ext/facter/facter/lib/src/util/posix/scoped_addrinfo.cc +41 -0
- data/ext/facter/facter/lib/src/util/posix/scoped_bio.cc +29 -0
- data/ext/facter/facter/lib/src/util/posix/scoped_descriptor.cc +20 -0
- data/ext/facter/facter/lib/src/util/scoped_file.cc +26 -0
- data/ext/facter/facter/lib/src/util/solaris/k_stat.cc +165 -0
- data/ext/facter/facter/lib/src/util/solaris/scoped_kstat.cc +31 -0
- data/ext/facter/facter/lib/src/util/string.cc +170 -0
- data/ext/facter/facter/lib/src/util/windows/wsa.cc +69 -0
- data/ext/facter/facter/lib/src/util/yaml.cc +72 -0
- data/ext/facter/facter/lib/tasks/spec.rake +26 -0
- data/ext/facter/facter/lib/tests/CMakeLists.txt +172 -0
- data/ext/facter/facter/lib/tests/collection_fixture.cc +15 -0
- data/ext/facter/facter/lib/tests/collection_fixture.hpp +19 -0
- data/ext/facter/facter/lib/tests/cwrapper.cc +22 -0
- data/ext/facter/facter/lib/tests/facts/array_value.cc +140 -0
- data/ext/facter/facter/lib/tests/facts/boolean_value.cc +67 -0
- data/ext/facter/facter/lib/tests/facts/cache.cc +100 -0
- data/ext/facter/facter/lib/tests/facts/collection.cc +576 -0
- data/ext/facter/facter/lib/tests/facts/double_value.cc +40 -0
- data/ext/facter/facter/lib/tests/facts/external/json_resolver.cc +62 -0
- data/ext/facter/facter/lib/tests/facts/external/posix/execution_resolver.cc +69 -0
- data/ext/facter/facter/lib/tests/facts/external/text_resolver.cc +46 -0
- data/ext/facter/facter/lib/tests/facts/external/windows/execution_resolver.cc +69 -0
- data/ext/facter/facter/lib/tests/facts/external/windows/powershell_resolver.cc +122 -0
- data/ext/facter/facter/lib/tests/facts/external/yaml_resolver.cc +70 -0
- data/ext/facter/facter/lib/tests/facts/integer_value.cc +69 -0
- data/ext/facter/facter/lib/tests/facts/linux/dmi_resolver.cc +116 -0
- data/ext/facter/facter/lib/tests/facts/linux/filesystem_resolver.cc +13 -0
- data/ext/facter/facter/lib/tests/facts/linux/processor_fixture.cc +259 -0
- data/ext/facter/facter/lib/tests/facts/linux/processor_fixture.hpp +77 -0
- data/ext/facter/facter/lib/tests/facts/linux/processor_resolver.cc +312 -0
- data/ext/facter/facter/lib/tests/facts/linux/virtualization_resolver.cc +48 -0
- data/ext/facter/facter/lib/tests/facts/map_value.cc +116 -0
- data/ext/facter/facter/lib/tests/facts/posix/collection.cc +39 -0
- data/ext/facter/facter/lib/tests/facts/posix/uptime_resolver.cc +52 -0
- data/ext/facter/facter/lib/tests/facts/resolvers/augeas_resolver.cc +58 -0
- data/ext/facter/facter/lib/tests/facts/resolvers/disk_resolver.cc +114 -0
- data/ext/facter/facter/lib/tests/facts/resolvers/dmi_resolver.cc +152 -0
- data/ext/facter/facter/lib/tests/facts/resolvers/filesystem_resolver.cc +206 -0
- data/ext/facter/facter/lib/tests/facts/resolvers/identity_resolver.cc +83 -0
- data/ext/facter/facter/lib/tests/facts/resolvers/kernel_resolver.cc +61 -0
- data/ext/facter/facter/lib/tests/facts/resolvers/ldom_resolver.cc +86 -0
- data/ext/facter/facter/lib/tests/facts/resolvers/memory_resolver.cc +135 -0
- data/ext/facter/facter/lib/tests/facts/resolvers/networking_resolver.cc +507 -0
- data/ext/facter/facter/lib/tests/facts/resolvers/operating_system_resolver.cc +247 -0
- data/ext/facter/facter/lib/tests/facts/resolvers/processor_resolver.cc +157 -0
- data/ext/facter/facter/lib/tests/facts/resolvers/ruby_resolver.cc +74 -0
- data/ext/facter/facter/lib/tests/facts/resolvers/ssh_resolver.cc +103 -0
- data/ext/facter/facter/lib/tests/facts/resolvers/system_profiler_resolver.cc +135 -0
- data/ext/facter/facter/lib/tests/facts/resolvers/timezone_resolver.cc +49 -0
- data/ext/facter/facter/lib/tests/facts/resolvers/uptime_resolver.cc +151 -0
- data/ext/facter/facter/lib/tests/facts/resolvers/virtualization_resolver.cc +175 -0
- data/ext/facter/facter/lib/tests/facts/resolvers/xen_resolver.cc +100 -0
- data/ext/facter/facter/lib/tests/facts/resolvers/zfs_resolver.cc +65 -0
- data/ext/facter/facter/lib/tests/facts/resolvers/zone_resolver.cc +122 -0
- data/ext/facter/facter/lib/tests/facts/resolvers/zpool_resolver.cc +69 -0
- data/ext/facter/facter/lib/tests/facts/schema.cc +796 -0
- data/ext/facter/facter/lib/tests/facts/string_value.cc +270 -0
- data/ext/facter/facter/lib/tests/facts/windows/collection.cc +60 -0
- data/ext/facter/facter/lib/tests/facts/windows/networking_resolver.cc +217 -0
- data/ext/facter/facter/lib/tests/fixtures.cc +62 -0
- data/ext/facter/facter/lib/tests/fixtures.hpp.in +27 -0
- data/ext/facter/facter/lib/tests/fixtures/execution/with space/command_with_space.bat +2 -0
- data/ext/facter/facter/lib/tests/fixtures/facts/external/json/facts.json +12 -0
- data/ext/facter/facter/lib/tests/fixtures/facts/external/json/invalid.json +1 -0
- data/ext/facter/facter/lib/tests/fixtures/facts/external/ordering/bar/foo.yaml +1 -0
- data/ext/facter/facter/lib/tests/fixtures/facts/external/ordering/foo/foo.yaml +1 -0
- data/ext/facter/facter/lib/tests/fixtures/facts/external/posix/execution/error_message +4 -0
- data/ext/facter/facter/lib/tests/fixtures/facts/external/posix/execution/facts +5 -0
- data/ext/facter/facter/lib/tests/fixtures/facts/external/posix/execution/failed +3 -0
- data/ext/facter/facter/lib/tests/fixtures/facts/external/posix/execution/not_executable +1 -0
- data/ext/facter/facter/lib/tests/fixtures/facts/external/text/facts.txt +4 -0
- data/ext/facter/facter/lib/tests/fixtures/facts/external/windows/execution/error_message.bat +4 -0
- data/ext/facter/facter/lib/tests/fixtures/facts/external/windows/execution/facts.bat +4 -0
- data/ext/facter/facter/lib/tests/fixtures/facts/external/windows/execution/failed.cmd +2 -0
- data/ext/facter/facter/lib/tests/fixtures/facts/external/windows/execution/not_executable +1 -0
- data/ext/facter/facter/lib/tests/fixtures/facts/external/windows/execution/ruby_script.rb +1 -0
- data/ext/facter/facter/lib/tests/fixtures/facts/external/windows/powershell/error_message.ps1 +3 -0
- data/ext/facter/facter/lib/tests/fixtures/facts/external/windows/powershell/facts.ps1 +4 -0
- data/ext/facter/facter/lib/tests/fixtures/facts/external/windows/powershell/failed.ps1 +2 -0
- data/ext/facter/facter/lib/tests/fixtures/facts/external/windows/powershell/json.ps1 +21 -0
- data/ext/facter/facter/lib/tests/fixtures/facts/external/windows/powershell/not_executable +1 -0
- data/ext/facter/facter/lib/tests/fixtures/facts/external/windows/powershell/yaml.ps1 +18 -0
- data/ext/facter/facter/lib/tests/fixtures/facts/external/yaml/facts.yaml +15 -0
- data/ext/facter/facter/lib/tests/fixtures/facts/external/yaml/invalid.yaml +1 -0
- data/ext/facter/facter/lib/tests/fixtures/facts/external/z/303/266/facts.rb +3 -0
- data/ext/facter/facter/lib/tests/fixtures/facts/external/z/303/266/facts.txt +1 -0
- data/ext/facter/facter/lib/tests/fixtures/facts/linux/cloud/azure +3 -0
- data/ext/facter/facter/lib/tests/fixtures/facts/linux/cloud/azure-unknown +3 -0
- data/ext/facter/facter/lib/tests/fixtures/facts/linux/cloud/not-azure +0 -0
- data/ext/facter/facter/lib/tests/fixtures/facts/linux/dmidecode/full.txt +83 -0
- data/ext/facter/facter/lib/tests/fixtures/facts/linux/dmidecode/full_alternative.txt +83 -0
- data/ext/facter/facter/lib/tests/fixtures/facts/linux/dmidecode/none.txt +2 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/100_resolutions.rb +7 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/101_resolutions.rb +7 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/aggregate.rb +9 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/aggregate_invalid_require.rb +9 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/aggregate_with_block.rb +30 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/aggregate_with_cycle.rb +9 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/aggregate_with_invalid_merge.rb +13 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/aggregate_with_merge.rb +23 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/aggregate_with_require.rb +16 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/array_confine.rb +6 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/array_fact.rb +5 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/bad_command.rb +19 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/bad_syntax.rb +2 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/bignum_fact_value.rb +5 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/block_confine.rb +9 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/block_false_confine.rb +9 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/block_nil_confine.rb +9 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/block_true_confine.rb +9 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/boolean_false_confine.rb +6 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/boolean_false_fact.rb +5 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/boolean_true_confine.rb +6 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/boolean_true_fact.rb +5 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/command_with_space.rb +5 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/confine_missing_fact.rb +22 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/confine_weight.rb +20 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/custom_dir/expect_network_init.rb +15 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/cycle.rb +7 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/debug.rb +7 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/debugging.rb +14 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/debugonce.rb +9 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/define_aggregate_fact.rb +13 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/define_fact.rb +9 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/double_fact.rb +5 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/empty_command.rb +3 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/empty_fact.rb +1 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/empty_fact_with_value.rb +1 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/empty_setcode_command.rb +3 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/exec.rb +7 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/execute_on_fail_raise.rb +17 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/execute_on_fail_value.rb +5 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/execute_timeout.rb +1 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/execution_failure.rb +5 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/existing_aggregate_resolution.rb +5 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/existing_simple_resolution.rb +5 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/fact.rb +7 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/facter.rb +7 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/facterversion.rb +17 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/hash_fact.rb +5 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/hash_with_non_string_key.rb +5 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/integer_fact.rb +5 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/log_exception.rb +21 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/lookup.rb +7 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/multi_confine.rb +6 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/named_resolution.rb +13 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/negative_number.rb +5 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/nil_fact.rb +5 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/nonexistent_command.rb +21 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/on_message.rb +16 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/range_confine.rb +6 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/regexp_confine.rb +6 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/ruby.rb +6 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/simple.rb +11 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/simple_command.rb +7 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/simple_confine.rb +6 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/simple_resolution.rb +5 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/single_allocation.rb +7 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/stderr_output.rb +9 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/string_fact.rb +5 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/timeout.rb +10 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/trace.rb +22 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/uni/341/220/201dir/customfacts/342/204/242.rb +6 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/uses_exit_code.rb +7 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/value.rb +6 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/version.rb +2 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/warn.rb +7 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/warnonce.rb +9 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/weight.rb +20 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/weight_option.rb +17 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/which.rb +9 -0
- data/ext/facter/facter/lib/tests/fixtures/ruby/windows/ole.rb +7 -0
- data/ext/facter/facter/lib/tests/java/facter.cc +69 -0
- data/ext/facter/facter/lib/tests/log_capture.cc +29 -0
- data/ext/facter/facter/lib/tests/log_capture.hpp +35 -0
- data/ext/facter/facter/lib/tests/logging/logging.cc +69 -0
- data/ext/facter/facter/lib/tests/main.cc +20 -0
- data/ext/facter/facter/lib/tests/mock_server.cc +44 -0
- data/ext/facter/facter/lib/tests/mock_server.hpp +25 -0
- data/ext/facter/facter/lib/tests/ruby/ruby.cc +634 -0
- data/ext/facter/facter/lib/tests/ruby/ruby_dirfacts.cc +35 -0
- data/ext/facter/facter/lib/tests/ruby/ruby_helper.cc +41 -0
- data/ext/facter/facter/lib/tests/ruby/ruby_helper.hpp +8 -0
- data/ext/facter/facter/lib/tests/ruby/windows/ruby.cc +53 -0
- data/ext/facter/facter/lib/tests/util/bsd/scoped_ifaddrs.cc +10 -0
- data/ext/facter/facter/lib/tests/util/posix/scoped_addrinfo.cc +11 -0
- data/ext/facter/facter/lib/tests/util/posix/scoped_bio.cc +12 -0
- data/ext/facter/facter/lib/tests/util/posix/scoped_descriptor.cc +22 -0
- data/ext/facter/facter/lib/tests/util/string.cc +291 -0
- data/ext/facter/facter/lib/version.h.in +28 -0
- data/ext/facter/facter/locales/CMakeLists.txt +7 -0
- data/ext/facter/facter/locales/FACTER.pot +1508 -0
- data/ext/facter/facter/man/man8/facter.8 +205 -0
- data/ext/facter/facter/scripts/cpplint.py +4754 -0
- data/ext/facter/facter/scripts/travis_target.sh +83 -0
- data/ext/facter/facter/tasks/ci.rake +22 -0
- data/ext/facter/leatherman/CHANGELOG.md +430 -0
- data/ext/facter/leatherman/CMakeLists.txt +143 -0
- data/ext/facter/leatherman/CONTRIBUTING.md +98 -0
- data/ext/facter/leatherman/LICENSE +17 -0
- data/ext/facter/leatherman/LeathermanConfig.cmake.in +57 -0
- data/ext/facter/leatherman/LeathermanConfigVersion.cmake.in +11 -0
- data/ext/facter/leatherman/MAINTAINERS +28 -0
- data/ext/facter/leatherman/README.md +416 -0
- data/ext/facter/leatherman/appveyor.yml +47 -0
- data/ext/facter/leatherman/catch/CMakeLists.txt +1 -0
- data/ext/facter/leatherman/cmake/FindICU.cmake +690 -0
- data/ext/facter/leatherman/cmake/GetGitRevisionDescription.cmake +130 -0
- data/ext/facter/leatherman/cmake/GetGitRevisionDescription.cmake.in +38 -0
- data/ext/facter/leatherman/cmake/cflags.cmake +110 -0
- data/ext/facter/leatherman/cmake/generate_translations.cmake +17 -0
- data/ext/facter/leatherman/cmake/internal.cmake +241 -0
- data/ext/facter/leatherman/cmake/leatherman.cmake.in +369 -0
- data/ext/facter/leatherman/cmake/leatherman_config.cmake +80 -0
- data/ext/facter/leatherman/cmake/normalize_pot.cmake +17 -0
- data/ext/facter/leatherman/cmake/options.cmake +21 -0
- data/ext/facter/leatherman/cmake/pod2man.cmake +36 -0
- data/ext/facter/leatherman/curl/CMakeLists.txt +42 -0
- data/ext/facter/leatherman/curl/inc/leatherman/curl/client.hpp +441 -0
- data/ext/facter/leatherman/curl/inc/leatherman/curl/request.hpp +130 -0
- data/ext/facter/leatherman/curl/inc/leatherman/curl/response.hpp +80 -0
- data/ext/facter/leatherman/curl/src/client.cc +575 -0
- data/ext/facter/leatherman/curl/src/request.cc +112 -0
- data/ext/facter/leatherman/curl/src/response.cc +62 -0
- data/ext/facter/leatherman/curl/tests/CMakeLists.txt +22 -0
- data/ext/facter/leatherman/curl/tests/client_test.cc +613 -0
- data/ext/facter/leatherman/curl/tests/fixtures.cc +27 -0
- data/ext/facter/leatherman/curl/tests/fixtures.hpp +31 -0
- data/ext/facter/leatherman/curl/tests/mock_curl.cc +423 -0
- data/ext/facter/leatherman/curl/tests/mock_curl.hpp +85 -0
- data/ext/facter/leatherman/curl/tests/request_test.cc +85 -0
- data/ext/facter/leatherman/curl/tests/response_test.cc +58 -0
- data/ext/facter/leatherman/dynamic_library/CMakeLists.txt +43 -0
- data/ext/facter/leatherman/dynamic_library/inc/leatherman/dynamic_library/dynamic_library.hpp +122 -0
- data/ext/facter/leatherman/dynamic_library/src/dynamic_library.cc +57 -0
- data/ext/facter/leatherman/dynamic_library/src/posix/dynamic_library.cc +91 -0
- data/ext/facter/leatherman/dynamic_library/src/windows/dynamic_library.cc +128 -0
- data/ext/facter/leatherman/dynamic_library/tests/dynamic_library_tests.cc +94 -0
- data/ext/facter/leatherman/dynamic_library/tests/fixtures.hpp.in +3 -0
- data/ext/facter/leatherman/dynamic_library/tests/test-lib/goodbye.cc +5 -0
- data/ext/facter/leatherman/dynamic_library/tests/test-lib/hello.cc +7 -0
- data/ext/facter/leatherman/execution/CMakeLists.txt +65 -0
- data/ext/facter/leatherman/execution/inc/leatherman/execution/execution.hpp +488 -0
- data/ext/facter/leatherman/execution/src/execution.cc +510 -0
- data/ext/facter/leatherman/execution/src/posix/execution.cc +574 -0
- data/ext/facter/leatherman/execution/src/posix/generic/platform.cc +30 -0
- data/ext/facter/leatherman/execution/src/posix/platform.hpp +15 -0
- data/ext/facter/leatherman/execution/src/posix/solaris/platform.cc +197 -0
- data/ext/facter/leatherman/execution/src/windows/execution.cc +698 -0
- data/ext/facter/leatherman/execution/tests/fixtures.hpp.in +2 -0
- data/ext/facter/leatherman/execution/tests/fixtures/echo_pid +2 -0
- data/ext/facter/leatherman/execution/tests/fixtures/error_message +5 -0
- data/ext/facter/leatherman/execution/tests/fixtures/execution/selfkill.sh +3 -0
- data/ext/facter/leatherman/execution/tests/fixtures/execution/sleep.sh +3 -0
- data/ext/facter/leatherman/execution/tests/fixtures/facts +5 -0
- data/ext/facter/leatherman/execution/tests/fixtures/failed +3 -0
- data/ext/facter/leatherman/execution/tests/fixtures/ls/crlf.txt +3 -0
- data/ext/facter/leatherman/execution/tests/fixtures/ls/file1.txt +1 -0
- data/ext/facter/leatherman/execution/tests/fixtures/ls/file2.txt +1 -0
- data/ext/facter/leatherman/execution/tests/fixtures/ls/file3.txt +1 -0
- data/ext/facter/leatherman/execution/tests/fixtures/ls/file4.txt +7 -0
- data/ext/facter/leatherman/execution/tests/fixtures/not_executable +1 -0
- data/ext/facter/leatherman/execution/tests/fixtures/windows/error_message.bat +6 -0
- data/ext/facter/leatherman/execution/tests/fixtures/windows/facts.bat +4 -0
- data/ext/facter/leatherman/execution/tests/fixtures/windows/failed.cmd +2 -0
- data/ext/facter/leatherman/execution/tests/fixtures/windows/not_executable +1 -0
- data/ext/facter/leatherman/execution/tests/fixtures/windows/ruby_script.rb +1 -0
- data/ext/facter/leatherman/execution/tests/log_capture.cc +29 -0
- data/ext/facter/leatherman/execution/tests/log_capture.hpp +35 -0
- data/ext/facter/leatherman/execution/tests/lth_cat.cc +38 -0
- data/ext/facter/leatherman/execution/tests/lth_cat.hpp +9 -0
- data/ext/facter/leatherman/execution/tests/posix/execution.cc +728 -0
- data/ext/facter/leatherman/execution/tests/posix/solaris/execution.cc +54 -0
- data/ext/facter/leatherman/execution/tests/windows/execution.cc +789 -0
- data/ext/facter/leatherman/file_util/CMakeLists.txt +18 -0
- data/ext/facter/leatherman/file_util/inc/leatherman/file_util/directory.hpp +28 -0
- data/ext/facter/leatherman/file_util/inc/leatherman/file_util/file.hpp +95 -0
- data/ext/facter/leatherman/file_util/src/directory.cc +51 -0
- data/ext/facter/leatherman/file_util/src/file.cc +131 -0
- data/ext/facter/leatherman/file_util/tests/directory_utils_test.cc +87 -0
- data/ext/facter/leatherman/file_util/tests/file_utils_test.cc +195 -0
- data/ext/facter/leatherman/file_util/tests/fixtures.cc +37 -0
- data/ext/facter/leatherman/file_util/tests/fixtures.hpp +39 -0
- data/ext/facter/leatherman/json_container/CMakeLists.txt +11 -0
- data/ext/facter/leatherman/json_container/README.md +108 -0
- data/ext/facter/leatherman/json_container/inc/leatherman/json_container/json_container.hpp +443 -0
- data/ext/facter/leatherman/json_container/src/json_container.cc +655 -0
- data/ext/facter/leatherman/json_container/tests/json_container_test.cc +1129 -0
- data/ext/facter/leatherman/locale/CMakeLists.txt +46 -0
- data/ext/facter/leatherman/locale/disabled/locale.cc +38 -0
- data/ext/facter/leatherman/locale/inc/leatherman/locale/locale.hpp +263 -0
- data/ext/facter/leatherman/locale/locales/CMakeLists.txt +6 -0
- data/ext/facter/leatherman/locale/locales/fr.po +40 -0
- data/ext/facter/leatherman/locale/locales/leatherman_locale.pot +41 -0
- data/ext/facter/leatherman/locale/src/locale.cc +95 -0
- data/ext/facter/leatherman/locale/tests/format.cc +117 -0
- data/ext/facter/leatherman/locale/tests/locale.cc +190 -0
- data/ext/facter/leatherman/locales/CMakeLists.txt +7 -0
- data/ext/facter/leatherman/locales/leatherman.pot +717 -0
- data/ext/facter/leatherman/logging/CMakeLists.txt +43 -0
- data/ext/facter/leatherman/logging/inc/leatherman/logging/logging.hpp +264 -0
- data/ext/facter/leatherman/logging/locales/CMakeLists.txt +6 -0
- data/ext/facter/leatherman/logging/locales/fr.po +72 -0
- data/ext/facter/leatherman/logging/locales/leatherman_logging.pot +72 -0
- data/ext/facter/leatherman/logging/src/logging.cc +229 -0
- data/ext/facter/leatherman/logging/src/posix/logging.cc +39 -0
- data/ext/facter/leatherman/logging/src/windows/logging.cc +52 -0
- data/ext/facter/leatherman/logging/tests/logging.cc +118 -0
- data/ext/facter/leatherman/logging/tests/logging.hpp +88 -0
- data/ext/facter/leatherman/logging/tests/logging_i18n.cc +103 -0
- data/ext/facter/leatherman/logging/tests/logging_on_message.cc +61 -0
- data/ext/facter/leatherman/logging/tests/logging_stream.cc +159 -0
- data/ext/facter/leatherman/logging/tests/logging_stream_lines.cc +172 -0
- data/ext/facter/leatherman/logging/tests/posix/logging.cc +23 -0
- data/ext/facter/leatherman/logging/tests/windows/logging.cc +13 -0
- data/ext/facter/leatherman/nowide/CMakeLists.txt +7 -0
- data/ext/facter/leatherman/rapidjson/CMakeLists.txt +1 -0
- data/ext/facter/leatherman/ruby/CMakeLists.txt +26 -0
- data/ext/facter/leatherman/ruby/inc/leatherman/ruby/api.hpp +744 -0
- data/ext/facter/leatherman/ruby/src/api.cc +527 -0
- data/ext/facter/leatherman/ruby/src/posix/api.cc +14 -0
- data/ext/facter/leatherman/ruby/src/windows/api.cc +20 -0
- data/ext/facter/leatherman/ruby/tests/api-test.cc +206 -0
- data/ext/facter/leatherman/scripts/cpplint.py +6323 -0
- data/ext/facter/leatherman/tests/CMakeLists.txt +22 -0
- data/ext/facter/leatherman/tests/main.cc +17 -0
- data/ext/facter/leatherman/util/CMakeLists.txt +36 -0
- data/ext/facter/leatherman/util/inc/leatherman/util/environment.hpp +69 -0
- data/ext/facter/leatherman/util/inc/leatherman/util/option_set.hpp +228 -0
- data/ext/facter/leatherman/util/inc/leatherman/util/posix/scoped_descriptor.hpp +32 -0
- data/ext/facter/leatherman/util/inc/leatherman/util/regex.hpp +80 -0
- data/ext/facter/leatherman/util/inc/leatherman/util/scope_exit.hpp +62 -0
- data/ext/facter/leatherman/util/inc/leatherman/util/scoped_env.hpp +35 -0
- data/ext/facter/leatherman/util/inc/leatherman/util/scoped_resource.hpp +130 -0
- data/ext/facter/leatherman/util/inc/leatherman/util/strings.hpp +54 -0
- data/ext/facter/leatherman/util/inc/leatherman/util/time.hpp +36 -0
- data/ext/facter/leatherman/util/inc/leatherman/util/timer.hpp +43 -0
- data/ext/facter/leatherman/util/inc/leatherman/util/uri.hpp +23 -0
- data/ext/facter/leatherman/util/inc/leatherman/util/windows/scoped_handle.hpp +32 -0
- data/ext/facter/leatherman/util/src/environment.cc +29 -0
- data/ext/facter/leatherman/util/src/posix/environment.cc +75 -0
- data/ext/facter/leatherman/util/src/posix/scoped_descriptor.cc +23 -0
- data/ext/facter/leatherman/util/src/posix/time.cc +9 -0
- data/ext/facter/leatherman/util/src/scope_exit.cc +43 -0
- data/ext/facter/leatherman/util/src/scoped_env.cc +37 -0
- data/ext/facter/leatherman/util/src/strings.cc +41 -0
- data/ext/facter/leatherman/util/src/time.cc +49 -0
- data/ext/facter/leatherman/util/src/uri.cc +75 -0
- data/ext/facter/leatherman/util/src/windows/environment.cc +75 -0
- data/ext/facter/leatherman/util/src/windows/scoped_handle.cc +24 -0
- data/ext/facter/leatherman/util/src/windows/time.cc +10 -0
- data/ext/facter/leatherman/util/tests/environment.cc +90 -0
- data/ext/facter/leatherman/util/tests/option_set.cc +234 -0
- data/ext/facter/leatherman/util/tests/posix/environment.cc +36 -0
- data/ext/facter/leatherman/util/tests/scoped_env.cc +52 -0
- data/ext/facter/leatherman/util/tests/strings_test.cc +71 -0
- data/ext/facter/leatherman/util/tests/timer.cc +39 -0
- data/ext/facter/leatherman/util/tests/uri.cc +104 -0
- data/ext/facter/leatherman/util/tests/windows/environment.cc +30 -0
- data/ext/facter/leatherman/vendor/Catch-1.10.0.zip +0 -0
- data/ext/facter/leatherman/vendor/nowide/build/Jamfile.v2 +26 -0
- data/ext/facter/leatherman/vendor/nowide/doc/Doxyfile +1632 -0
- data/ext/facter/leatherman/vendor/nowide/doc/LICENSE_1_0.txt +23 -0
- data/ext/facter/leatherman/vendor/nowide/doc/gendoc.sh +11 -0
- data/ext/facter/leatherman/vendor/nowide/doc/main.txt +354 -0
- data/ext/facter/leatherman/vendor/nowide/include/boost/nowide/args.hpp +167 -0
- data/ext/facter/leatherman/vendor/nowide/include/boost/nowide/cenv.hpp +126 -0
- data/ext/facter/leatherman/vendor/nowide/include/boost/nowide/config.hpp +54 -0
- data/ext/facter/leatherman/vendor/nowide/include/boost/nowide/convert.hpp +154 -0
- data/ext/facter/leatherman/vendor/nowide/include/boost/nowide/cstdio.hpp +101 -0
- data/ext/facter/leatherman/vendor/nowide/include/boost/nowide/cstdlib.hpp +16 -0
- data/ext/facter/leatherman/vendor/nowide/include/boost/nowide/filebuf.hpp +415 -0
- data/ext/facter/leatherman/vendor/nowide/include/boost/nowide/fstream.hpp +283 -0
- data/ext/facter/leatherman/vendor/nowide/include/boost/nowide/integration/filesystem.hpp +28 -0
- data/ext/facter/leatherman/vendor/nowide/include/boost/nowide/iostream.hpp +99 -0
- data/ext/facter/leatherman/vendor/nowide/include/boost/nowide/stackstring.hpp +154 -0
- data/ext/facter/leatherman/vendor/nowide/include/boost/nowide/system.hpp +46 -0
- data/ext/facter/leatherman/vendor/nowide/include/boost/nowide/utf8_codecvt.hpp +499 -0
- data/ext/facter/leatherman/vendor/nowide/include/boost/nowide/windows.hpp +39 -0
- data/ext/facter/leatherman/vendor/nowide/index.html +16 -0
- data/ext/facter/leatherman/vendor/nowide/src/iostream.cpp +263 -0
- data/ext/facter/leatherman/vendor/nowide/standalone/CMakeLists.txt +104 -0
- data/ext/facter/leatherman/vendor/nowide/standalone/MinGW.cmake +9 -0
- data/ext/facter/leatherman/vendor/nowide/standalone/config.hpp +37 -0
- data/ext/facter/leatherman/vendor/nowide/standalone/convert +34 -0
- data/ext/facter/leatherman/vendor/nowide/standalone/encoding_errors.hpp +58 -0
- data/ext/facter/leatherman/vendor/nowide/standalone/encoding_utf.hpp +84 -0
- data/ext/facter/leatherman/vendor/nowide/standalone/run_convert_and_build.sh +17 -0
- data/ext/facter/leatherman/vendor/nowide/standalone/scoped_ptr.hpp +93 -0
- data/ext/facter/leatherman/vendor/nowide/standalone/utf.hpp +469 -0
- data/ext/facter/leatherman/vendor/nowide/template.hpp +19 -0
- data/ext/facter/leatherman/vendor/nowide/test/Jamfile.v2 +43 -0
- data/ext/facter/leatherman/vendor/nowide/test/test.hpp +25 -0
- data/ext/facter/leatherman/vendor/nowide/test/test_codecvt.cpp +254 -0
- data/ext/facter/leatherman/vendor/nowide/test/test_convert.cpp +101 -0
- data/ext/facter/leatherman/vendor/nowide/test/test_env.cpp +49 -0
- data/ext/facter/leatherman/vendor/nowide/test/test_fs.cpp +48 -0
- data/ext/facter/leatherman/vendor/nowide/test/test_fstream.cpp +184 -0
- data/ext/facter/leatherman/vendor/nowide/test/test_iostream.cpp +52 -0
- data/ext/facter/leatherman/vendor/nowide/test/test_stdio.cpp +60 -0
- data/ext/facter/leatherman/vendor/nowide/test/test_system.cpp +91 -0
- data/ext/facter/leatherman/vendor/rapidjson-1.0.2.zip +0 -0
- data/ext/facter/leatherman/windows/CMakeLists.txt +27 -0
- data/ext/facter/leatherman/windows/inc/leatherman/windows/file_util.hpp +23 -0
- data/ext/facter/leatherman/windows/inc/leatherman/windows/process.hpp +22 -0
- data/ext/facter/leatherman/windows/inc/leatherman/windows/registry.hpp +56 -0
- data/ext/facter/leatherman/windows/inc/leatherman/windows/system_error.hpp +23 -0
- data/ext/facter/leatherman/windows/inc/leatherman/windows/user.hpp +30 -0
- data/ext/facter/leatherman/windows/inc/leatherman/windows/windows.hpp +10 -0
- data/ext/facter/leatherman/windows/inc/leatherman/windows/wmi.hpp +188 -0
- data/ext/facter/leatherman/windows/src/file_util.cc +28 -0
- data/ext/facter/leatherman/windows/src/process.cc +42 -0
- data/ext/facter/leatherman/windows/src/registry.cc +96 -0
- data/ext/facter/leatherman/windows/src/system_error.cc +33 -0
- data/ext/facter/leatherman/windows/src/user.cc +76 -0
- data/ext/facter/leatherman/windows/src/wmi.cc +208 -0
- data/ext/facter/leatherman/windows/tests/file_utils_test.cc +13 -0
- metadata +1089 -0
@@ -0,0 +1,100 @@
|
|
1
|
+
#include <catch.hpp>
|
2
|
+
#include <internal/facts/resolvers/xen_resolver.hpp>
|
3
|
+
#include <facter/facts/collection.hpp>
|
4
|
+
#include <facter/facts/fact.hpp>
|
5
|
+
#include <facter/facts/vm.hpp>
|
6
|
+
#include <facter/facts/scalar_value.hpp>
|
7
|
+
#include <facter/facts/map_value.hpp>
|
8
|
+
#include <facter/facts/array_value.hpp>
|
9
|
+
#include "../../collection_fixture.hpp"
|
10
|
+
|
11
|
+
using namespace std;
|
12
|
+
using namespace facter::facts;
|
13
|
+
using namespace facter::facts::resolvers;
|
14
|
+
using namespace facter::testing;
|
15
|
+
|
16
|
+
struct empty_xen_resolver : xen_resolver
|
17
|
+
{
|
18
|
+
protected:
|
19
|
+
virtual string xen_command() override
|
20
|
+
{
|
21
|
+
return "";
|
22
|
+
}
|
23
|
+
|
24
|
+
virtual data collect_data(collection& facts) override
|
25
|
+
{
|
26
|
+
data result;
|
27
|
+
return result;
|
28
|
+
}
|
29
|
+
};
|
30
|
+
|
31
|
+
struct test_xen_resolver : xen_resolver
|
32
|
+
{
|
33
|
+
protected:
|
34
|
+
virtual string xen_command() override
|
35
|
+
{
|
36
|
+
return "";
|
37
|
+
}
|
38
|
+
|
39
|
+
virtual data collect_data(collection& facts) override
|
40
|
+
{
|
41
|
+
data result;
|
42
|
+
result.domains = { "domain1", "domain2" };
|
43
|
+
return result;
|
44
|
+
}
|
45
|
+
};
|
46
|
+
|
47
|
+
// CATCH doesn't behave well with constexpr, so create memory for
|
48
|
+
// the string here before using it in the test.
|
49
|
+
static string xen_privileged = vm::xen_privileged;
|
50
|
+
|
51
|
+
SCENARIO("using the Xen resolver on a privileged VM") {
|
52
|
+
collection_fixture facts;
|
53
|
+
facts.add(fact::virtualization, make_value<string_value>(xen_privileged));
|
54
|
+
WHEN("data is not present") {
|
55
|
+
facts.add(make_shared<empty_xen_resolver>());
|
56
|
+
THEN("facts should not be added") {
|
57
|
+
REQUIRE(facts.size() == 1u);
|
58
|
+
}
|
59
|
+
}
|
60
|
+
WHEN("data is present") {
|
61
|
+
facts.add(make_shared<test_xen_resolver>());
|
62
|
+
THEN("flat facts are added") {
|
63
|
+
REQUIRE(facts.size() == 3u);
|
64
|
+
auto value = facts.get<string_value>(fact::xendomains);
|
65
|
+
REQUIRE(value);
|
66
|
+
REQUIRE(value->value() == "domain1,domain2");
|
67
|
+
}
|
68
|
+
|
69
|
+
THEN("structured facts are added") {
|
70
|
+
REQUIRE(facts.size() == 3u);
|
71
|
+
auto xen = facts.get<map_value>(fact::xen);
|
72
|
+
REQUIRE(xen);
|
73
|
+
REQUIRE(xen->size() == 1u);
|
74
|
+
auto domains = xen->get<array_value>("domains");
|
75
|
+
REQUIRE(domains);
|
76
|
+
REQUIRE(domains->size() == 2u);
|
77
|
+
for (size_t i = 0; i < 2; ++i) {
|
78
|
+
auto domain = domains->get<string_value>(i);
|
79
|
+
REQUIRE(domain);
|
80
|
+
REQUIRE(domain->value() == "domain" + to_string(i+1));
|
81
|
+
}
|
82
|
+
}
|
83
|
+
}
|
84
|
+
}
|
85
|
+
|
86
|
+
SCENARIO("using the Xen resolver on an unprivileged machine") {
|
87
|
+
collection_fixture facts;
|
88
|
+
WHEN("data is not present") {
|
89
|
+
facts.add(make_shared<empty_xen_resolver>());
|
90
|
+
THEN("facts should not be added") {
|
91
|
+
REQUIRE(facts.size() == 0u);
|
92
|
+
}
|
93
|
+
}
|
94
|
+
WHEN("data is present") {
|
95
|
+
facts.add(make_shared<test_xen_resolver>());
|
96
|
+
THEN("facts should not be added") {
|
97
|
+
REQUIRE(facts.size() == 0u);
|
98
|
+
}
|
99
|
+
}
|
100
|
+
}
|
@@ -0,0 +1,65 @@
|
|
1
|
+
#include <catch.hpp>
|
2
|
+
#include <internal/facts/resolvers/zfs_resolver.hpp>
|
3
|
+
#include <facter/facts/collection.hpp>
|
4
|
+
#include <facter/facts/fact.hpp>
|
5
|
+
#include <facter/facts/scalar_value.hpp>
|
6
|
+
#include "../../collection_fixture.hpp"
|
7
|
+
|
8
|
+
using namespace std;
|
9
|
+
using namespace facter::facts;
|
10
|
+
using namespace facter::facts::resolvers;
|
11
|
+
using namespace facter::testing;
|
12
|
+
|
13
|
+
struct empty_zfs_resolver : zfs_resolver
|
14
|
+
{
|
15
|
+
protected:
|
16
|
+
virtual string zfs_command() override
|
17
|
+
{
|
18
|
+
return "";
|
19
|
+
}
|
20
|
+
|
21
|
+
virtual data collect_data(collection& facts) override
|
22
|
+
{
|
23
|
+
data result;
|
24
|
+
return result;
|
25
|
+
}
|
26
|
+
};
|
27
|
+
|
28
|
+
struct test_zfs_resolver : zfs_resolver
|
29
|
+
{
|
30
|
+
protected:
|
31
|
+
virtual string zfs_command() override
|
32
|
+
{
|
33
|
+
return "";
|
34
|
+
}
|
35
|
+
|
36
|
+
virtual data collect_data(collection& facts) override
|
37
|
+
{
|
38
|
+
data result;
|
39
|
+
result.version = "1";
|
40
|
+
result.versions = { "1", "2", "3" };
|
41
|
+
return result;
|
42
|
+
}
|
43
|
+
};
|
44
|
+
|
45
|
+
SCENARIO("using the ZFS resolver") {
|
46
|
+
collection_fixture facts;
|
47
|
+
WHEN("data is not present") {
|
48
|
+
facts.add(make_shared<empty_zfs_resolver>());
|
49
|
+
THEN("facts should not be added") {
|
50
|
+
REQUIRE(facts.size() == 0u);
|
51
|
+
}
|
52
|
+
}
|
53
|
+
WHEN("data is present") {
|
54
|
+
facts.add(make_shared<test_zfs_resolver>());
|
55
|
+
THEN("flat facts are added") {
|
56
|
+
REQUIRE(facts.size() == 2u);
|
57
|
+
auto value = facts.get<string_value>(fact::zfs_version);
|
58
|
+
REQUIRE(value);
|
59
|
+
REQUIRE(value->value() == "1");
|
60
|
+
value = facts.get<string_value>(fact::zfs_versionnumbers);
|
61
|
+
REQUIRE(value);
|
62
|
+
REQUIRE(value->value() == "1,2,3");
|
63
|
+
}
|
64
|
+
}
|
65
|
+
}
|
@@ -0,0 +1,122 @@
|
|
1
|
+
#include <catch.hpp>
|
2
|
+
#include <internal/facts/resolvers/zone_resolver.hpp>
|
3
|
+
#include <facter/facts/collection.hpp>
|
4
|
+
#include <facter/facts/fact.hpp>
|
5
|
+
#include <facter/facts/scalar_value.hpp>
|
6
|
+
#include <facter/facts/map_value.hpp>
|
7
|
+
#include "../../collection_fixture.hpp"
|
8
|
+
|
9
|
+
using namespace std;
|
10
|
+
using namespace facter::facts;
|
11
|
+
using namespace facter::facts::resolvers;
|
12
|
+
using namespace facter::testing;
|
13
|
+
|
14
|
+
struct empty_zone_resolver : zone_resolver
|
15
|
+
{
|
16
|
+
protected:
|
17
|
+
virtual data collect_data(collection& facts) override
|
18
|
+
{
|
19
|
+
data result;
|
20
|
+
return result;
|
21
|
+
}
|
22
|
+
};
|
23
|
+
|
24
|
+
struct test_zone_resolver : zone_resolver
|
25
|
+
{
|
26
|
+
protected:
|
27
|
+
virtual data collect_data(collection& facts) override
|
28
|
+
{
|
29
|
+
data result;
|
30
|
+
result.current_zone_name = "current";
|
31
|
+
|
32
|
+
zone z;
|
33
|
+
z.uuid = "uuid";
|
34
|
+
z.status = "status";
|
35
|
+
z.path = "path";
|
36
|
+
z.name = "name";
|
37
|
+
z.brand = "brand";
|
38
|
+
z.id = "id";
|
39
|
+
z.ip_type = "ip type";
|
40
|
+
result.zones.emplace_back(move(z));
|
41
|
+
return result;
|
42
|
+
}
|
43
|
+
};
|
44
|
+
|
45
|
+
SCENARIO("using the Solaris zone resolver") {
|
46
|
+
collection_fixture facts;
|
47
|
+
WHEN("data is not present") {
|
48
|
+
facts.add(make_shared<empty_zone_resolver>());
|
49
|
+
THEN("only the zone count should be added") {
|
50
|
+
REQUIRE(facts.size() == 1u);
|
51
|
+
auto value = facts.get<integer_value>(fact::zones);
|
52
|
+
REQUIRE(value);
|
53
|
+
REQUIRE(value->value() == 0);
|
54
|
+
}
|
55
|
+
}
|
56
|
+
WHEN("data is present") {
|
57
|
+
facts.add(make_shared<test_zone_resolver>());
|
58
|
+
THEN("a structured fact is added") {
|
59
|
+
REQUIRE(facts.size() == 10u);
|
60
|
+
auto mval = facts.get<map_value>(fact::solaris_zones);
|
61
|
+
REQUIRE(mval);
|
62
|
+
REQUIRE(mval->size() == 2u);
|
63
|
+
auto sval = mval->get<string_value>("current");
|
64
|
+
REQUIRE(sval);
|
65
|
+
REQUIRE(sval->value() == "current");
|
66
|
+
mval = mval->get<map_value>("zones");
|
67
|
+
REQUIRE(mval);
|
68
|
+
REQUIRE(mval->size() == 1u);
|
69
|
+
mval = mval->get<map_value>("name");
|
70
|
+
REQUIRE(mval);
|
71
|
+
REQUIRE(mval->size() == 6u);
|
72
|
+
sval = mval->get<string_value>("uuid");
|
73
|
+
REQUIRE(sval);
|
74
|
+
REQUIRE(sval->value() == "uuid");
|
75
|
+
sval = mval->get<string_value>("status");
|
76
|
+
REQUIRE(sval);
|
77
|
+
REQUIRE(sval->value() == "status");
|
78
|
+
sval = mval->get<string_value>("path");
|
79
|
+
REQUIRE(sval);
|
80
|
+
REQUIRE(sval->value() == "path");
|
81
|
+
sval = mval->get<string_value>("brand");
|
82
|
+
REQUIRE(sval);
|
83
|
+
REQUIRE(sval->value() == "brand");
|
84
|
+
sval = mval->get<string_value>("id");
|
85
|
+
REQUIRE(sval);
|
86
|
+
REQUIRE(sval->value() == "id");
|
87
|
+
sval = mval->get<string_value>("ip_type");
|
88
|
+
REQUIRE(sval);
|
89
|
+
REQUIRE(sval->value() == "ip type");
|
90
|
+
}
|
91
|
+
THEN("flat facts are added") {
|
92
|
+
REQUIRE(facts.size() == 10u);
|
93
|
+
auto ival = facts.get<integer_value>(fact::zones);
|
94
|
+
REQUIRE(ival);
|
95
|
+
REQUIRE(ival->value() == 1);
|
96
|
+
auto sval = facts.get<string_value>(fact::zonename);
|
97
|
+
REQUIRE(sval);
|
98
|
+
REQUIRE(sval->value() == "current");
|
99
|
+
sval = facts.get<string_value>(string("zone_name_") + fact::zone_iptype);
|
100
|
+
REQUIRE(sval);
|
101
|
+
REQUIRE(sval->value() == "ip type");
|
102
|
+
sval = facts.get<string_value>(string("zone_name_") + fact::zone_brand);
|
103
|
+
REQUIRE(sval);
|
104
|
+
REQUIRE(sval->value() == "brand");
|
105
|
+
sval = facts.get<string_value>(string("zone_name_") + fact::zone_uuid);
|
106
|
+
REQUIRE(sval);
|
107
|
+
REQUIRE(sval->value() == "uuid");
|
108
|
+
sval = facts.get<string_value>(string("zone_name_") + fact::zone_id);
|
109
|
+
REQUIRE(sval);
|
110
|
+
REQUIRE(sval->value() == "id");
|
111
|
+
sval = facts.get<string_value>(string("zone_name_") + fact::zone_name);
|
112
|
+
REQUIRE(sval);
|
113
|
+
REQUIRE(sval->value() == "name");
|
114
|
+
sval = facts.get<string_value>(string("zone_name_") + fact::zone_path);
|
115
|
+
REQUIRE(sval);
|
116
|
+
REQUIRE(sval->value() == "path");
|
117
|
+
sval = facts.get<string_value>(string("zone_name_") + fact::zone_status);
|
118
|
+
REQUIRE(sval);
|
119
|
+
REQUIRE(sval->value() == "status");
|
120
|
+
}
|
121
|
+
}
|
122
|
+
}
|
@@ -0,0 +1,69 @@
|
|
1
|
+
#include <catch.hpp>
|
2
|
+
#include <internal/facts/resolvers/zpool_resolver.hpp>
|
3
|
+
#include <facter/facts/collection.hpp>
|
4
|
+
#include <facter/facts/fact.hpp>
|
5
|
+
#include <facter/facts/scalar_value.hpp>
|
6
|
+
#include "../../collection_fixture.hpp"
|
7
|
+
|
8
|
+
using namespace std;
|
9
|
+
using namespace facter::facts;
|
10
|
+
using namespace facter::facts::resolvers;
|
11
|
+
using namespace facter::testing;
|
12
|
+
|
13
|
+
struct empty_zpool_resolver : zpool_resolver
|
14
|
+
{
|
15
|
+
protected:
|
16
|
+
virtual string zpool_command() override
|
17
|
+
{
|
18
|
+
return "";
|
19
|
+
}
|
20
|
+
|
21
|
+
virtual data collect_data(collection& facts) override
|
22
|
+
{
|
23
|
+
data result;
|
24
|
+
return result;
|
25
|
+
}
|
26
|
+
};
|
27
|
+
|
28
|
+
struct test_zpool_resolver : zpool_resolver
|
29
|
+
{
|
30
|
+
protected:
|
31
|
+
virtual string zpool_command() override
|
32
|
+
{
|
33
|
+
return "";
|
34
|
+
}
|
35
|
+
|
36
|
+
virtual data collect_data(collection& facts) override
|
37
|
+
{
|
38
|
+
data result;
|
39
|
+
result.version = "1";
|
40
|
+
result.versions = { "1", "2", "3" };
|
41
|
+
result.feature_flags = { "async_destroy", "lz4_compress", "enabled_txg" };
|
42
|
+
return result;
|
43
|
+
}
|
44
|
+
};
|
45
|
+
|
46
|
+
SCENARIO("using the zpool resolver") {
|
47
|
+
collection_fixture facts;
|
48
|
+
WHEN("data is not present") {
|
49
|
+
facts.add(make_shared<empty_zpool_resolver>());
|
50
|
+
THEN("facts should not be added") {
|
51
|
+
REQUIRE(facts.size() == 0u);
|
52
|
+
}
|
53
|
+
}
|
54
|
+
WHEN("data is present") {
|
55
|
+
facts.add(make_shared<test_zpool_resolver>());
|
56
|
+
THEN("flat facts are added") {
|
57
|
+
REQUIRE(facts.size() == 3u);
|
58
|
+
auto value = facts.get<string_value>(fact::zpool_version);
|
59
|
+
REQUIRE(value);
|
60
|
+
REQUIRE(value->value() == "1");
|
61
|
+
value = facts.get<string_value>(fact::zpool_versionnumbers);
|
62
|
+
REQUIRE(value);
|
63
|
+
REQUIRE(value->value() == "1,2,3");
|
64
|
+
value = facts.get<string_value>(fact::zpool_featureflags);
|
65
|
+
REQUIRE(value);
|
66
|
+
REQUIRE(value->value() == "async_destroy,lz4_compress,enabled_txg");
|
67
|
+
}
|
68
|
+
}
|
69
|
+
}
|
@@ -0,0 +1,796 @@
|
|
1
|
+
#include <catch.hpp>
|
2
|
+
#include <facter/facts/collection.hpp>
|
3
|
+
#include <facter/facts/fact.hpp>
|
4
|
+
#include <facter/facts/vm.hpp>
|
5
|
+
#include <facter/facts/resolver.hpp>
|
6
|
+
#include <facter/facts/array_value.hpp>
|
7
|
+
#include <facter/facts/map_value.hpp>
|
8
|
+
#include <facter/facts/scalar_value.hpp>
|
9
|
+
#include <leatherman/util/regex.hpp>
|
10
|
+
#include <yaml-cpp/yaml.h>
|
11
|
+
#include <boost/nowide/fstream.hpp>
|
12
|
+
#include "../fixtures.hpp"
|
13
|
+
|
14
|
+
// Include all base resolvers here
|
15
|
+
#include <internal/facts/resolvers/augeas_resolver.hpp>
|
16
|
+
#include <internal/facts/resolvers/disk_resolver.hpp>
|
17
|
+
#include <internal/facts/resolvers/dmi_resolver.hpp>
|
18
|
+
#include <internal/facts/resolvers/ec2_resolver.hpp>
|
19
|
+
#include <internal/facts/resolvers/filesystem_resolver.hpp>
|
20
|
+
#include <internal/facts/resolvers/fips_resolver.hpp>
|
21
|
+
#include <internal/facts/resolvers/gce_resolver.hpp>
|
22
|
+
#include <internal/facts/resolvers/hypervisors_resolver.hpp>
|
23
|
+
#include <internal/facts/resolvers/identity_resolver.hpp>
|
24
|
+
#include <internal/facts/resolvers/kernel_resolver.hpp>
|
25
|
+
#include <internal/facts/resolvers/ldom_resolver.hpp>
|
26
|
+
#include <internal/facts/resolvers/load_average_resolver.hpp>
|
27
|
+
#include <internal/facts/resolvers/memory_resolver.hpp>
|
28
|
+
#include <internal/facts/resolvers/networking_resolver.hpp>
|
29
|
+
#include <internal/facts/resolvers/operating_system_resolver.hpp>
|
30
|
+
#include <internal/facts/resolvers/path_resolver.hpp>
|
31
|
+
#include <internal/facts/resolvers/processor_resolver.hpp>
|
32
|
+
#include <internal/facts/resolvers/ruby_resolver.hpp>
|
33
|
+
#include <internal/facts/resolvers/ssh_resolver.hpp>
|
34
|
+
#include <internal/facts/resolvers/system_profiler_resolver.hpp>
|
35
|
+
#include <internal/facts/resolvers/timezone_resolver.hpp>
|
36
|
+
#include <internal/facts/resolvers/uptime_resolver.hpp>
|
37
|
+
#include <internal/facts/resolvers/virtualization_resolver.hpp>
|
38
|
+
#include <internal/facts/resolvers/xen_resolver.hpp>
|
39
|
+
#include <internal/facts/resolvers/zfs_resolver.hpp>
|
40
|
+
#include <internal/facts/resolvers/zone_resolver.hpp>
|
41
|
+
#include <internal/facts/resolvers/zpool_resolver.hpp>
|
42
|
+
|
43
|
+
using namespace std;
|
44
|
+
using namespace facter::facts;
|
45
|
+
using namespace leatherman::util;
|
46
|
+
using namespace facter::testing;
|
47
|
+
using Catch::Matchers::AnyOf;
|
48
|
+
|
49
|
+
// For every base resolver, implement a resolver that outputs the minimum values to pass schema validation
|
50
|
+
// We don't care about the actual data in the facts, only that it conforms to the schema
|
51
|
+
|
52
|
+
struct augeas_resolver : resolvers::augeas_resolver
|
53
|
+
{
|
54
|
+
protected:
|
55
|
+
virtual string get_version() override
|
56
|
+
{
|
57
|
+
return "1.1.0";
|
58
|
+
}
|
59
|
+
};
|
60
|
+
|
61
|
+
struct disk_resolver : resolvers::disk_resolver
|
62
|
+
{
|
63
|
+
protected:
|
64
|
+
virtual data collect_data(collection& facts) override
|
65
|
+
{
|
66
|
+
data result;
|
67
|
+
result.disks.push_back({
|
68
|
+
"name",
|
69
|
+
"vendor",
|
70
|
+
"model",
|
71
|
+
"product",
|
72
|
+
1234
|
73
|
+
});
|
74
|
+
return result;
|
75
|
+
}
|
76
|
+
};
|
77
|
+
|
78
|
+
struct dmi_resolver : resolvers::dmi_resolver
|
79
|
+
{
|
80
|
+
protected:
|
81
|
+
virtual data collect_data(collection& facts) override
|
82
|
+
{
|
83
|
+
data result;
|
84
|
+
result.bios_vendor = fact::bios_vendor;
|
85
|
+
result.bios_version = fact::bios_version;
|
86
|
+
result.bios_release_date = fact::bios_release_date;
|
87
|
+
result.board_asset_tag = fact::board_asset_tag;
|
88
|
+
result.board_manufacturer = fact::board_manufacturer;
|
89
|
+
result.board_product_name = fact::board_product_name;
|
90
|
+
result.board_serial_number = fact::board_serial_number;
|
91
|
+
result.chassis_asset_tag = fact::chassis_asset_tag;
|
92
|
+
result.manufacturer = fact::manufacturer;
|
93
|
+
result.product_name = fact::product_name;
|
94
|
+
result.serial_number = fact::serial_number;
|
95
|
+
result.uuid = fact::uuid;
|
96
|
+
result.chassis_type = fact::chassis_type;
|
97
|
+
return result;
|
98
|
+
}
|
99
|
+
};
|
100
|
+
|
101
|
+
struct ec2_resolver : resolvers::ec2_resolver
|
102
|
+
{
|
103
|
+
void resolve(collection& facts) override
|
104
|
+
{
|
105
|
+
facts.add(fact::ec2_metadata, make_value<map_value>());
|
106
|
+
facts.add(fact::ec2_userdata, make_value<string_value>("user data"));
|
107
|
+
}
|
108
|
+
};
|
109
|
+
|
110
|
+
struct filesystem_resolver : resolvers::filesystem_resolver
|
111
|
+
{
|
112
|
+
protected:
|
113
|
+
virtual data collect_data(collection& facts) override
|
114
|
+
{
|
115
|
+
data result;
|
116
|
+
|
117
|
+
mountpoint mp;
|
118
|
+
mp.name = "name";
|
119
|
+
mp.device = "device";
|
120
|
+
mp.filesystem = "filesystem";
|
121
|
+
mp.size = 1234;
|
122
|
+
mp.available = 12345;
|
123
|
+
mp.options.push_back("option");
|
124
|
+
result.mountpoints.emplace_back(move(mp));
|
125
|
+
|
126
|
+
result.filesystems.insert("filesystem");
|
127
|
+
|
128
|
+
partition p;
|
129
|
+
p.name = "name";
|
130
|
+
p.filesystem = "filesystem";
|
131
|
+
p.size = 1234;
|
132
|
+
p.uuid = "uuid";
|
133
|
+
p.partition_uuid = "partuuid";
|
134
|
+
p.label = "label";
|
135
|
+
p.partition_label = "partlabel";
|
136
|
+
p.mount = "mount";
|
137
|
+
p.backing_file = "/foo/bar";
|
138
|
+
result.partitions.emplace_back(move(p));
|
139
|
+
return result;
|
140
|
+
}
|
141
|
+
};
|
142
|
+
|
143
|
+
struct fips_resolver : resolvers::fips_resolver
|
144
|
+
{
|
145
|
+
protected:
|
146
|
+
virtual data collect_data(collection& facts) override
|
147
|
+
{
|
148
|
+
data result;
|
149
|
+
result.is_fips_mode_enabled = false;
|
150
|
+
return result;
|
151
|
+
}
|
152
|
+
};
|
153
|
+
|
154
|
+
using hypervisor_data = std::unordered_map<std::string, std::unordered_map<std::string, boost::variant<std::string, bool, int>>>;
|
155
|
+
|
156
|
+
struct hypervisors_resolver_test : resolvers::hypervisors_resolver_base
|
157
|
+
{
|
158
|
+
virtual hypervisor_data collect_data(collection& facts)
|
159
|
+
{
|
160
|
+
hypervisor_data results;
|
161
|
+
|
162
|
+
unordered_map<std::string, boost::variant<std::string, bool, int>> metadata {
|
163
|
+
{"string_value", string{"string"}}, // boost assumes const char* values are bools when bool is among the variants
|
164
|
+
{"integer_value", 42},
|
165
|
+
{"boolean_value", true},
|
166
|
+
};
|
167
|
+
|
168
|
+
results.insert({"hypervisor_name", metadata});
|
169
|
+
|
170
|
+
return results;
|
171
|
+
}
|
172
|
+
};
|
173
|
+
|
174
|
+
struct identity_resolver : resolvers::identity_resolver
|
175
|
+
{
|
176
|
+
protected:
|
177
|
+
virtual data collect_data(collection& facts) override
|
178
|
+
{
|
179
|
+
data result;
|
180
|
+
result.group_id = 123;
|
181
|
+
result.group_name = "group";
|
182
|
+
result.user_id = 456;
|
183
|
+
result.user_name = "user";
|
184
|
+
result.privileged = false;
|
185
|
+
return result;
|
186
|
+
}
|
187
|
+
};
|
188
|
+
|
189
|
+
struct kernel_resolver : resolvers::kernel_resolver
|
190
|
+
{
|
191
|
+
protected:
|
192
|
+
virtual data collect_data(collection& facts) override
|
193
|
+
{
|
194
|
+
data result;
|
195
|
+
result.name = "kernel";
|
196
|
+
result.release = "1.2.3-kernel";
|
197
|
+
result.version = "1.2.3";
|
198
|
+
return result;
|
199
|
+
}
|
200
|
+
};
|
201
|
+
|
202
|
+
struct load_average_resolver : resolvers::load_average_resolver
|
203
|
+
{
|
204
|
+
protected:
|
205
|
+
virtual boost::optional<std::tuple<double, double, double> > get_load_averages() override
|
206
|
+
{
|
207
|
+
return make_tuple(0.12, 3.45, 6.78);
|
208
|
+
}
|
209
|
+
};
|
210
|
+
|
211
|
+
struct memory_resolver : resolvers::memory_resolver
|
212
|
+
{
|
213
|
+
protected:
|
214
|
+
virtual data collect_data(collection& facts) override
|
215
|
+
{
|
216
|
+
data result;
|
217
|
+
result.swap_encryption = encryption_status::encrypted;
|
218
|
+
result.mem_total = 10 * 1024 * 1024;
|
219
|
+
result.mem_free = 5 * 1024 * 1024;
|
220
|
+
result.swap_total = 20 * 1024 * 1024;
|
221
|
+
result.swap_free = 4 * 1024 * 1024;
|
222
|
+
return result;
|
223
|
+
}
|
224
|
+
};
|
225
|
+
|
226
|
+
struct networking_resolver : resolvers::networking_resolver
|
227
|
+
{
|
228
|
+
protected:
|
229
|
+
virtual data collect_data(collection& facts) override
|
230
|
+
{
|
231
|
+
data result;
|
232
|
+
|
233
|
+
result.hostname = "hostname";
|
234
|
+
result.domain = "domain";
|
235
|
+
result.fqdn = "hostname.domain";
|
236
|
+
result.primary_interface = "interface1";
|
237
|
+
|
238
|
+
interface iface;
|
239
|
+
iface.name = "interface1";
|
240
|
+
iface.dhcp_server = "192.168.1.1";
|
241
|
+
iface.ipv4_bindings.emplace_back(binding { "127.0.0.1", "255.0.0.0", "127.0.0.0"});
|
242
|
+
iface.ipv4_bindings.emplace_back(binding { "123.123.123.123", "255.255.255.0", "123.123.123.0"});
|
243
|
+
iface.ipv6_bindings.emplace_back(binding { "fe80::1", "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff", "::1"});
|
244
|
+
iface.ipv6_bindings.emplace_back(binding { "fe80::2", "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff", "::2"});
|
245
|
+
iface.macaddress = "00:00:00:00:00:00";
|
246
|
+
iface.mtu = 12345;
|
247
|
+
result.interfaces.emplace_back(move(iface));
|
248
|
+
return result;
|
249
|
+
}
|
250
|
+
};
|
251
|
+
|
252
|
+
struct operating_system_resolver : resolvers::operating_system_resolver
|
253
|
+
{
|
254
|
+
protected:
|
255
|
+
virtual data collect_data(collection& facts) override
|
256
|
+
{
|
257
|
+
data result;
|
258
|
+
result.name = "name";
|
259
|
+
result.family = "family";
|
260
|
+
result.release = "1.2.3";
|
261
|
+
result.major = "1.2";
|
262
|
+
result.minor = "3";
|
263
|
+
result.specification_version = "1.4";
|
264
|
+
result.distro.id = "id";
|
265
|
+
result.distro.release = "1.2.3";
|
266
|
+
result.distro.codename = "codename";
|
267
|
+
result.distro.description = "description";
|
268
|
+
result.osx.product = "product";
|
269
|
+
result.osx.build = "build";
|
270
|
+
result.osx.version = "10.10";
|
271
|
+
result.win.system32 = "system32";
|
272
|
+
result.architecture = "arch";
|
273
|
+
result.hardware = "hardware";
|
274
|
+
result.selinux.supported = true;
|
275
|
+
result.selinux.enabled = true;
|
276
|
+
result.selinux.enforced = true;
|
277
|
+
result.selinux.current_mode = "current mode";
|
278
|
+
result.selinux.config_mode = "config mode";
|
279
|
+
result.selinux.config_policy = "config policy";
|
280
|
+
result.selinux.policy_version = "policy version";
|
281
|
+
return result;
|
282
|
+
}
|
283
|
+
};
|
284
|
+
|
285
|
+
struct processor_resolver : resolvers::processor_resolver
|
286
|
+
{
|
287
|
+
protected:
|
288
|
+
virtual data collect_data(collection& facts) override
|
289
|
+
{
|
290
|
+
data result;
|
291
|
+
result.isa = "isa";
|
292
|
+
result.logical_count = 4;
|
293
|
+
result.physical_count = 2;
|
294
|
+
result.models = {
|
295
|
+
"processor1",
|
296
|
+
"processor2",
|
297
|
+
"processor3",
|
298
|
+
"processor4"
|
299
|
+
};
|
300
|
+
result.speed = 10 * 1000 * 1000 * 1000ull;
|
301
|
+
return result;
|
302
|
+
}
|
303
|
+
};
|
304
|
+
|
305
|
+
struct ruby_resolver : resolvers::ruby_resolver
|
306
|
+
{
|
307
|
+
protected:
|
308
|
+
virtual data collect_data(collection& facts) override
|
309
|
+
{
|
310
|
+
data result;
|
311
|
+
result.platform = "platform";
|
312
|
+
result.sitedir = "sitedir";
|
313
|
+
result.version = "2.1.5";
|
314
|
+
return result;
|
315
|
+
}
|
316
|
+
};
|
317
|
+
|
318
|
+
struct ssh_resolver : resolvers::ssh_resolver
|
319
|
+
{
|
320
|
+
protected:
|
321
|
+
virtual data collect_data(collection& facts) override
|
322
|
+
{
|
323
|
+
data result;
|
324
|
+
result.dsa.key = "dsa:key";
|
325
|
+
result.dsa.type = "dsa:type";
|
326
|
+
result.dsa.digest.sha1 = "dsa:sha1";
|
327
|
+
result.dsa.digest.sha256 = "dsa:sha256";
|
328
|
+
result.ecdsa.key = "ecdsa:key";
|
329
|
+
result.ecdsa.type = "ecdsa:type";
|
330
|
+
result.ecdsa.digest.sha1 = "ecdsa:sha1";
|
331
|
+
result.ecdsa.digest.sha256 = "ecdsa:sha256";
|
332
|
+
result.ed25519.key = "ed25519:key";
|
333
|
+
result.ed25519.type = "ed25519:type";
|
334
|
+
result.ed25519.digest.sha1 = "ed25519:sha1";
|
335
|
+
result.ed25519.digest.sha256 = "ed25519:sha256";
|
336
|
+
result.rsa.key = "rsa:key";
|
337
|
+
result.rsa.type = "rsa:type";
|
338
|
+
result.rsa.digest.sha1 = "rsa:sha1";
|
339
|
+
result.rsa.digest.sha256 = "rsa:sha256";
|
340
|
+
return result;
|
341
|
+
}
|
342
|
+
};
|
343
|
+
|
344
|
+
struct system_profiler_resolver : resolvers::system_profiler_resolver
|
345
|
+
{
|
346
|
+
protected:
|
347
|
+
virtual data collect_data(collection& facts) override
|
348
|
+
{
|
349
|
+
data result;
|
350
|
+
result.boot_mode = "boot_mode";
|
351
|
+
result.boot_rom_version = "boot_rom_version";
|
352
|
+
result.boot_volume = "boot_volume";
|
353
|
+
result.processor_name = "processor_name";
|
354
|
+
result.processor_speed = "processor_speed";
|
355
|
+
result.kernel_version = "kernel_version";
|
356
|
+
result.l2_cache_per_core = "l2_cache_per_core";
|
357
|
+
result.l3_cache = "l3_cache";
|
358
|
+
result.computer_name = "computer_name";
|
359
|
+
result.model_identifier = "model_identifier";
|
360
|
+
result.model_name = "model_name";
|
361
|
+
result.cores = "cores";
|
362
|
+
result.system_version = "system_version";
|
363
|
+
result.processors = "processors";
|
364
|
+
result.memory = "memory";
|
365
|
+
result.hardware_uuid = "hardware_uuid";
|
366
|
+
result.secure_virtual_memory = "secure_virtual_memory";
|
367
|
+
result.serial_number = "serial_number";
|
368
|
+
result.smc_version = "smc_version";
|
369
|
+
result.uptime = "uptime";
|
370
|
+
result.username = "username";
|
371
|
+
return result;
|
372
|
+
}
|
373
|
+
};
|
374
|
+
|
375
|
+
struct timezone_resolver : resolvers::timezone_resolver
|
376
|
+
{
|
377
|
+
protected:
|
378
|
+
virtual string get_timezone() override
|
379
|
+
{
|
380
|
+
return "PDT";
|
381
|
+
}
|
382
|
+
};
|
383
|
+
|
384
|
+
struct uptime_resolver : resolvers::uptime_resolver
|
385
|
+
{
|
386
|
+
protected:
|
387
|
+
virtual int64_t get_uptime() override
|
388
|
+
{
|
389
|
+
return 1;
|
390
|
+
}
|
391
|
+
};
|
392
|
+
|
393
|
+
struct virtualization_resolver : resolvers::virtualization_resolver
|
394
|
+
{
|
395
|
+
protected:
|
396
|
+
virtual string get_hypervisor(collection& facts) override
|
397
|
+
{
|
398
|
+
// The xen fact only resolves if virtualization is xen_privileged.
|
399
|
+
return vm::xen_privileged;
|
400
|
+
}
|
401
|
+
|
402
|
+
virtual string get_cloud_provider(collection& facts) override
|
403
|
+
{
|
404
|
+
return "azure";
|
405
|
+
}
|
406
|
+
};
|
407
|
+
|
408
|
+
struct xen_resolver : resolvers::xen_resolver
|
409
|
+
{
|
410
|
+
protected:
|
411
|
+
virtual string xen_command() override
|
412
|
+
{
|
413
|
+
return "";
|
414
|
+
}
|
415
|
+
|
416
|
+
virtual data collect_data(collection& facts) override
|
417
|
+
{
|
418
|
+
data result;
|
419
|
+
result.domains = { "domain1", "domain2" };
|
420
|
+
return result;
|
421
|
+
}
|
422
|
+
};
|
423
|
+
|
424
|
+
struct zfs_resolver : resolvers::zfs_resolver
|
425
|
+
{
|
426
|
+
protected:
|
427
|
+
virtual string zfs_command() override
|
428
|
+
{
|
429
|
+
return "";
|
430
|
+
}
|
431
|
+
|
432
|
+
virtual data collect_data(collection& facts) override
|
433
|
+
{
|
434
|
+
data result;
|
435
|
+
result.version = 1;
|
436
|
+
result.versions = { "1", "2", "3" };
|
437
|
+
return result;
|
438
|
+
}
|
439
|
+
};
|
440
|
+
|
441
|
+
struct zone_resolver : resolvers::zone_resolver
|
442
|
+
{
|
443
|
+
protected:
|
444
|
+
virtual data collect_data(collection& facts) override
|
445
|
+
{
|
446
|
+
data result;
|
447
|
+
zone z;
|
448
|
+
z.brand = "brand";
|
449
|
+
z.id = "id";
|
450
|
+
z.ip_type = "ip type";
|
451
|
+
z.name = "name";
|
452
|
+
z.path = "path";
|
453
|
+
z.status = "status";
|
454
|
+
z.uuid = "uuid";
|
455
|
+
result.zones.emplace_back(move(z));
|
456
|
+
result.current_zone_name = "name";
|
457
|
+
return result;
|
458
|
+
}
|
459
|
+
};
|
460
|
+
|
461
|
+
struct zpool_resolver : resolvers::zpool_resolver
|
462
|
+
{
|
463
|
+
protected:
|
464
|
+
virtual string zpool_command() override
|
465
|
+
{
|
466
|
+
return "";
|
467
|
+
}
|
468
|
+
|
469
|
+
virtual data collect_data(collection& facts) override
|
470
|
+
{
|
471
|
+
data result;
|
472
|
+
result.version = 1;
|
473
|
+
result.versions = { "1", "2", "3" };
|
474
|
+
result.feature_flags = { "async_destroy", "lz4_compress", "enabled_txg" };
|
475
|
+
return result;
|
476
|
+
}
|
477
|
+
};
|
478
|
+
|
479
|
+
void add_all_facts(collection& facts)
|
480
|
+
{
|
481
|
+
facts.add("env_windows_installdir", make_value<string_value>("C:\\Program Files\\Some\\Path"));
|
482
|
+
facts.add("facterversion", make_value<string_value>("version"));
|
483
|
+
facts.add("aio_agent_version", make_value<string_value>(""));
|
484
|
+
facts.add(make_shared<augeas_resolver>());
|
485
|
+
facts.add(make_shared<disk_resolver>());
|
486
|
+
facts.add(make_shared<dmi_resolver>());
|
487
|
+
facts.add(make_shared<filesystem_resolver>());
|
488
|
+
facts.add(make_shared<fips_resolver>());
|
489
|
+
// TODO: refactor the EC2 resolver to use the "collect_data" pattern
|
490
|
+
facts.add(make_shared<ec2_resolver>());
|
491
|
+
// TODO: refactor the GCE resolver to use the "collect_data" pattern
|
492
|
+
facts.add(make_shared<hypervisors_resolver_test>());
|
493
|
+
facts.add(fact::gce, make_value<map_value>());
|
494
|
+
facts.add(make_shared<identity_resolver>());
|
495
|
+
facts.add(make_shared<kernel_resolver>());
|
496
|
+
facts.add(fact::ldom, make_value<map_value>());
|
497
|
+
facts.add("ldom_domainname", make_value<string_value>("somedomain", true));
|
498
|
+
facts.add(make_shared<load_average_resolver>());
|
499
|
+
facts.add(make_shared<memory_resolver>());
|
500
|
+
facts.add(make_shared<networking_resolver>());
|
501
|
+
facts.add(make_shared<operating_system_resolver>());
|
502
|
+
facts.add(make_shared<resolvers::path_resolver>());
|
503
|
+
facts.add(make_shared<processor_resolver>());
|
504
|
+
facts.add(make_shared<ruby_resolver>());
|
505
|
+
facts.add(make_shared<ssh_resolver>());
|
506
|
+
facts.add(make_shared<system_profiler_resolver>());
|
507
|
+
facts.add(make_shared<timezone_resolver>());
|
508
|
+
facts.add(make_shared<uptime_resolver>());
|
509
|
+
facts.add(make_shared<virtualization_resolver>());
|
510
|
+
facts.add(make_shared<xen_resolver>());
|
511
|
+
facts.add(make_shared<zfs_resolver>());
|
512
|
+
facts.add(make_shared<zone_resolver>());
|
513
|
+
facts.add(make_shared<zpool_resolver>());
|
514
|
+
}
|
515
|
+
|
516
|
+
void validate_attributes(YAML::Node const& node)
|
517
|
+
{
|
518
|
+
REQUIRE(node.IsMap());
|
519
|
+
|
520
|
+
for (auto const& attribute : node) {
|
521
|
+
auto attribute_name = attribute.first.as<string>();
|
522
|
+
CAPTURE(attribute_name);
|
523
|
+
REQUIRE_THAT(attribute_name,
|
524
|
+
Catch::Equals("pattern") ||
|
525
|
+
Catch::Equals("type") ||
|
526
|
+
Catch::Equals("hidden") ||
|
527
|
+
Catch::Equals("description") ||
|
528
|
+
Catch::Equals("resolution") ||
|
529
|
+
Catch::Equals("caveats") ||
|
530
|
+
Catch::Equals("elements") ||
|
531
|
+
Catch::Equals("validate") ||
|
532
|
+
Catch::Equals("blockgroup")
|
533
|
+
);
|
534
|
+
}
|
535
|
+
|
536
|
+
// If pattern is present, it must be a non-empty string
|
537
|
+
auto pattern_attribute = node["pattern"];
|
538
|
+
if (pattern_attribute) {
|
539
|
+
REQUIRE(pattern_attribute.IsScalar());
|
540
|
+
auto pattern = pattern_attribute.as<string>();
|
541
|
+
REQUIRE_FALSE(pattern.empty());
|
542
|
+
}
|
543
|
+
|
544
|
+
// Node must have a type attribute
|
545
|
+
auto type_attribute = node["type"];
|
546
|
+
REQUIRE(type_attribute);
|
547
|
+
REQUIRE(type_attribute.IsScalar());
|
548
|
+
auto type = type_attribute.as<string>();
|
549
|
+
REQUIRE_THAT(type,
|
550
|
+
Catch::Equals("integer") ||
|
551
|
+
Catch::Equals("double") ||
|
552
|
+
Catch::Equals("string") ||
|
553
|
+
Catch::Equals("boolean") ||
|
554
|
+
Catch::Equals("array") ||
|
555
|
+
Catch::Equals("map") ||
|
556
|
+
Catch::Equals("ip") ||
|
557
|
+
Catch::Equals("ip6") ||
|
558
|
+
Catch::Equals("mac")
|
559
|
+
);
|
560
|
+
|
561
|
+
// Check map types
|
562
|
+
auto elements = node["elements"];
|
563
|
+
if (type == "map") {
|
564
|
+
// If the validate attribute is present, it must be true or false
|
565
|
+
auto validate_attribute = node["validate"];
|
566
|
+
string validate = "true";
|
567
|
+
if (validate_attribute) {
|
568
|
+
REQUIRE(validate_attribute.IsScalar());
|
569
|
+
validate = validate_attribute.as<string>();
|
570
|
+
REQUIRE_THAT(validate, AnyOf(Catch::Equals("true"), Catch::Equals("false")));
|
571
|
+
}
|
572
|
+
|
573
|
+
// Validated map values must have elements
|
574
|
+
if (validate == "true") {
|
575
|
+
REQUIRE(elements);
|
576
|
+
REQUIRE(elements.IsMap());
|
577
|
+
}
|
578
|
+
} else {
|
579
|
+
REQUIRE_FALSE(elements);
|
580
|
+
|
581
|
+
// There should not be a validate attribute
|
582
|
+
auto validate_attribute = node["validate"];
|
583
|
+
REQUIRE_FALSE(validate_attribute);
|
584
|
+
}
|
585
|
+
|
586
|
+
// If hidden is present, it must be a boolean
|
587
|
+
auto hidden_attribute = node["hidden"];
|
588
|
+
if (hidden_attribute) {
|
589
|
+
REQUIRE(hidden_attribute.IsScalar());
|
590
|
+
auto hidden = hidden_attribute.as<string>();
|
591
|
+
REQUIRE_THAT(hidden, AnyOf(Catch::Equals("true"), Catch::Equals("false")));
|
592
|
+
}
|
593
|
+
|
594
|
+
// Node must have a description attribute
|
595
|
+
auto description_attribute = node["description"];
|
596
|
+
REQUIRE(description_attribute);
|
597
|
+
REQUIRE(description_attribute.IsScalar());
|
598
|
+
auto description = description_attribute.as<string>();
|
599
|
+
REQUIRE_FALSE(description.empty());
|
600
|
+
|
601
|
+
// If the resolutions is present, it must be a non-empty string
|
602
|
+
auto resolutions_attribute = node["resolutions"];
|
603
|
+
if (resolutions_attribute) {
|
604
|
+
REQUIRE(resolutions_attribute.IsScalar());
|
605
|
+
auto resolutions = resolutions_attribute.as<string>();
|
606
|
+
REQUIRE_FALSE(resolutions.empty());
|
607
|
+
}
|
608
|
+
|
609
|
+
// If the caveats are present, it must be a non-empty string
|
610
|
+
auto caveats_attribute = node["caveats"];
|
611
|
+
if (caveats_attribute) {
|
612
|
+
REQUIRE(caveats_attribute.IsScalar());
|
613
|
+
auto caveats = caveats_attribute.as<string>();
|
614
|
+
REQUIRE_FALSE(caveats.empty());
|
615
|
+
}
|
616
|
+
|
617
|
+
auto blockgroup_attribute = node["blockgroup"];
|
618
|
+
if (blockgroup_attribute) {
|
619
|
+
REQUIRE(blockgroup_attribute.IsScalar());
|
620
|
+
auto blockgroup = blockgroup_attribute.as<string>();
|
621
|
+
REQUIRE_FALSE(blockgroup.empty());
|
622
|
+
}
|
623
|
+
|
624
|
+
// Recurse on elements
|
625
|
+
if (elements) {
|
626
|
+
for (auto const& element : elements) {
|
627
|
+
auto element_name = element.first.as<string>();
|
628
|
+
CAPTURE(element_name);
|
629
|
+
validate_attributes(element.second);
|
630
|
+
}
|
631
|
+
}
|
632
|
+
}
|
633
|
+
|
634
|
+
YAML::Node find_child(YAML::Node const& node, string const& name, set<string>& found)
|
635
|
+
{
|
636
|
+
REQUIRE(node.IsMap());
|
637
|
+
|
638
|
+
for (auto const& child : node) {
|
639
|
+
auto child_name = child.first.as<string>();
|
640
|
+
auto pattern_attribute = child.second["pattern"];
|
641
|
+
if ((pattern_attribute && re_search(name, boost::regex(pattern_attribute.as<string>()))) ||
|
642
|
+
child_name == name) {
|
643
|
+
found.insert(move(child_name));
|
644
|
+
return child.second;
|
645
|
+
}
|
646
|
+
}
|
647
|
+
|
648
|
+
return YAML::Node(YAML::NodeType::Undefined);
|
649
|
+
}
|
650
|
+
|
651
|
+
void validate_fact(YAML::Node const& node, value const* fact_value, bool require_all_elements)
|
652
|
+
{
|
653
|
+
REQUIRE(node.IsMap());
|
654
|
+
|
655
|
+
// Ensure the types match
|
656
|
+
auto type_attribute = node["type"];
|
657
|
+
auto expected_type = type_attribute.as<string>();
|
658
|
+
string type;
|
659
|
+
string_value const* svalue = nullptr;
|
660
|
+
map_value const* map = nullptr;
|
661
|
+
if (dynamic_cast<integer_value const*>(fact_value)) {
|
662
|
+
type = "integer";
|
663
|
+
} else if (dynamic_cast<double_value const*>(fact_value)) {
|
664
|
+
type = "double";
|
665
|
+
} else if ((svalue = dynamic_cast<string_value const*>(fact_value))) {
|
666
|
+
type = "string";
|
667
|
+
|
668
|
+
// Check for special string types; sourced from http://stackoverflow.com/a/17871737
|
669
|
+
static boost::regex ip_pattern("^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$");
|
670
|
+
static boost::regex ip6_pattern("^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$");
|
671
|
+
static boost::regex mac_pattern("^(([0-9a-fA-F]){2}\\:){5}([0-9a-fA-F]){2}$");
|
672
|
+
|
673
|
+
if (expected_type == "ip" && re_search(svalue->value(), ip_pattern)) {
|
674
|
+
type = "ip";
|
675
|
+
} else if (expected_type == "ip6" && re_search(svalue->value(), ip6_pattern)) {
|
676
|
+
type = "ip6";
|
677
|
+
} else if (expected_type == "mac" && re_search(svalue->value(), mac_pattern)) {
|
678
|
+
type = "mac";
|
679
|
+
}
|
680
|
+
} else if (dynamic_cast<boolean_value const*>(fact_value)) {
|
681
|
+
type = "boolean";
|
682
|
+
} else if (dynamic_cast<array_value const*>(fact_value)) {
|
683
|
+
type = "array";
|
684
|
+
} else if ((map = dynamic_cast<map_value const*>(fact_value))) {
|
685
|
+
type = "map";
|
686
|
+
} else {
|
687
|
+
FAIL("unexpected fact value type");
|
688
|
+
}
|
689
|
+
REQUIRE(type == expected_type);
|
690
|
+
|
691
|
+
// Ensure the value is hidden according to the schema
|
692
|
+
auto hidden_attribute = node["hidden"];
|
693
|
+
bool expected_hidden = hidden_attribute && hidden_attribute.as<string>() == "true";
|
694
|
+
bool hidden = fact_value->hidden();
|
695
|
+
REQUIRE(hidden == expected_hidden);
|
696
|
+
|
697
|
+
// Recurse on map elements
|
698
|
+
if (map) {
|
699
|
+
auto elements = node["elements"];
|
700
|
+
|
701
|
+
// Validate the map's elements "validate" is unset or true
|
702
|
+
auto validate_attribute = node["validate"];
|
703
|
+
if (!validate_attribute || validate_attribute.as<string>() == "true") {
|
704
|
+
set<string> found;
|
705
|
+
map->each([&](string const& element_name, value const* element_value) {
|
706
|
+
if (!element_value) {
|
707
|
+
return true;
|
708
|
+
}
|
709
|
+
CAPTURE(element_name);
|
710
|
+
auto element = find_child(elements, element_name, found);
|
711
|
+
REQUIRE(element);
|
712
|
+
validate_fact(element, element_value, require_all_elements);
|
713
|
+
return true;
|
714
|
+
});
|
715
|
+
|
716
|
+
// Require all elements were found
|
717
|
+
if (require_all_elements) {
|
718
|
+
REQUIRE(found.size() == elements.size());
|
719
|
+
}
|
720
|
+
}
|
721
|
+
}
|
722
|
+
}
|
723
|
+
|
724
|
+
// TestRail C62454
|
725
|
+
SCENARIO("validating schema") {
|
726
|
+
boost::nowide::ifstream stream(LIBFACTER_TESTS_DIRECTORY "/../schema/facter.yaml");
|
727
|
+
|
728
|
+
YAML::Node schema = YAML::Load(stream);
|
729
|
+
collection_fixture facts;
|
730
|
+
|
731
|
+
WHEN("validating the schema itself") {
|
732
|
+
THEN("all attributes must be valid") {
|
733
|
+
for (auto const& fact : schema) {
|
734
|
+
auto fact_name = fact.first.as<string>();
|
735
|
+
CAPTURE(fact_name);
|
736
|
+
validate_attributes(fact.second);
|
737
|
+
}
|
738
|
+
}
|
739
|
+
}
|
740
|
+
WHEN("validating a fact collection") {
|
741
|
+
THEN("all facts must conform to the schema") {
|
742
|
+
add_all_facts(facts);
|
743
|
+
|
744
|
+
set<string> found;
|
745
|
+
|
746
|
+
facts.each([&](string const& fact_name, value const* fact_value) {
|
747
|
+
if (!fact_value) {
|
748
|
+
return true;
|
749
|
+
}
|
750
|
+
CAPTURE(fact_name);
|
751
|
+
auto fact = find_child(schema, fact_name, found);
|
752
|
+
REQUIRE(fact);
|
753
|
+
validate_fact(fact, fact_value, true);
|
754
|
+
return true;
|
755
|
+
});
|
756
|
+
|
757
|
+
// Require all elements in the schema were found
|
758
|
+
REQUIRE(found.size() == schema.size());
|
759
|
+
}
|
760
|
+
THEN("the current platform's facts must conform to the schema") {
|
761
|
+
facts.add_default_facts(true);
|
762
|
+
|
763
|
+
set<string> found;
|
764
|
+
|
765
|
+
facts.each([&](string const& fact_name, value const* fact_value) {
|
766
|
+
if (!fact_value) {
|
767
|
+
return true;
|
768
|
+
}
|
769
|
+
CAPTURE(fact_name);
|
770
|
+
auto fact = find_child(schema, fact_name, found);
|
771
|
+
REQUIRE(fact);
|
772
|
+
validate_fact(fact, fact_value, false);
|
773
|
+
return true;
|
774
|
+
});
|
775
|
+
}
|
776
|
+
THEN("blocked facts are not resolved") {
|
777
|
+
set<string> blocked_facts;
|
778
|
+
set<string> blockgroups;
|
779
|
+
for (auto const& fact : schema) {
|
780
|
+
auto fact_name = fact.first.as<string>();
|
781
|
+
auto blockgroup = fact.second["blockgroup"];
|
782
|
+
if (blockgroup) {
|
783
|
+
blockgroups.insert(blockgroup.as<string>());
|
784
|
+
blocked_facts.insert(fact_name);
|
785
|
+
}
|
786
|
+
}
|
787
|
+
collection_fixture with_blocked(blockgroups);
|
788
|
+
add_all_facts(with_blocked);
|
789
|
+
with_blocked.resolve_facts();
|
790
|
+
for (auto const& fact : blocked_facts) {
|
791
|
+
CAPTURE(fact);
|
792
|
+
REQUIRE_FALSE(with_blocked.get<map_value>(fact));
|
793
|
+
}
|
794
|
+
}
|
795
|
+
}
|
796
|
+
}
|