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,29 @@
|
|
1
|
+
#include "log_capture.hpp"
|
2
|
+
#include <boost/nowide/iostream.hpp>
|
3
|
+
|
4
|
+
using namespace std;
|
5
|
+
using namespace facter::logging;
|
6
|
+
|
7
|
+
namespace facter { namespace testing {
|
8
|
+
|
9
|
+
log_capture::log_capture(facter::logging::level level)
|
10
|
+
{
|
11
|
+
// Setup logging for capturing
|
12
|
+
setup_logging(_stream);
|
13
|
+
set_level(level);
|
14
|
+
}
|
15
|
+
|
16
|
+
log_capture::~log_capture()
|
17
|
+
{
|
18
|
+
// Cleanup
|
19
|
+
setup_logging(boost::nowide::cout);
|
20
|
+
set_level(level::none);
|
21
|
+
clear_logged_errors();
|
22
|
+
}
|
23
|
+
|
24
|
+
string log_capture::result() const
|
25
|
+
{
|
26
|
+
return _stream.str();
|
27
|
+
}
|
28
|
+
|
29
|
+
}} // namespace facter::testing
|
@@ -0,0 +1,35 @@
|
|
1
|
+
#pragma once
|
2
|
+
|
3
|
+
#include <sstream>
|
4
|
+
#include <string>
|
5
|
+
#include <facter/logging/logging.hpp>
|
6
|
+
|
7
|
+
namespace facter { namespace testing {
|
8
|
+
|
9
|
+
/**
|
10
|
+
* Utility class for capturing facter log output.
|
11
|
+
*/
|
12
|
+
struct log_capture
|
13
|
+
{
|
14
|
+
/**
|
15
|
+
* Constructs the log capture and starts capturing log output.
|
16
|
+
* @param level The log level to capture.
|
17
|
+
*/
|
18
|
+
explicit log_capture(facter::logging::level level);
|
19
|
+
|
20
|
+
/**
|
21
|
+
* Destructs the log capture and stops capturing log output.
|
22
|
+
*/
|
23
|
+
~log_capture();
|
24
|
+
|
25
|
+
/**
|
26
|
+
* Gets the captured log.
|
27
|
+
* @return Returns the captured log as a single string.
|
28
|
+
*/
|
29
|
+
std::string result() const;
|
30
|
+
|
31
|
+
private:
|
32
|
+
std::ostringstream _stream;
|
33
|
+
};
|
34
|
+
|
35
|
+
}} // namespace facter::testing
|
@@ -0,0 +1,69 @@
|
|
1
|
+
#include <catch.hpp>
|
2
|
+
#include <facter/logging/logging.hpp>
|
3
|
+
#include <leatherman/util/regex.hpp>
|
4
|
+
#include "../log_capture.hpp"
|
5
|
+
|
6
|
+
using namespace std;
|
7
|
+
using namespace facter::logging;
|
8
|
+
using namespace leatherman::util;
|
9
|
+
using namespace facter::testing;
|
10
|
+
|
11
|
+
SCENARIO("logging with a TRACE level") {
|
12
|
+
log_capture capture(level::trace);
|
13
|
+
REQUIRE(is_enabled(level::trace));
|
14
|
+
log(level::trace, "testing %1% %2% %3%", 1, "2", 3.0);
|
15
|
+
auto output = capture.result();
|
16
|
+
CAPTURE(output);
|
17
|
+
REQUIRE(re_search(output, boost::regex("TRACE puppetlabs\\.facter - testing 1 2 3$")));
|
18
|
+
REQUIRE_FALSE(error_logged());
|
19
|
+
}
|
20
|
+
|
21
|
+
SCENARIO("logging with a DEBUG level") {
|
22
|
+
log_capture capture(level::debug);
|
23
|
+
REQUIRE(is_enabled(level::debug));
|
24
|
+
log(level::debug, "testing %1% %2% %3%", 1, "2", 3.0);
|
25
|
+
auto output = capture.result();
|
26
|
+
CAPTURE(output);
|
27
|
+
REQUIRE(re_search(output, boost::regex("DEBUG puppetlabs\\.facter - testing 1 2 3$")));
|
28
|
+
REQUIRE_FALSE(error_logged());
|
29
|
+
}
|
30
|
+
|
31
|
+
SCENARIO("logging with an INFO level") {
|
32
|
+
log_capture capture(level::info);
|
33
|
+
REQUIRE(is_enabled(level::info));
|
34
|
+
log(level::info, "testing %1% %2% %3%", 1, "2", 3.0);
|
35
|
+
auto output = capture.result();
|
36
|
+
CAPTURE(output);
|
37
|
+
REQUIRE(re_search(output, boost::regex("INFO puppetlabs\\.facter - testing 1 2 3$")));
|
38
|
+
REQUIRE_FALSE(error_logged());
|
39
|
+
}
|
40
|
+
|
41
|
+
SCENARIO("logging with a WARNING level") {
|
42
|
+
log_capture capture(level::warning);
|
43
|
+
REQUIRE(is_enabled(level::warning));
|
44
|
+
log(level::warning, "testing %1% %2% %3%", 1, "2", 3.0);
|
45
|
+
auto output = capture.result();
|
46
|
+
CAPTURE(output);
|
47
|
+
REQUIRE(re_search(output, boost::regex("WARN puppetlabs\\.facter - testing 1 2 3")));
|
48
|
+
REQUIRE_FALSE(error_logged());
|
49
|
+
}
|
50
|
+
|
51
|
+
SCENARIO("logging with an ERROR level") {
|
52
|
+
log_capture capture(level::error);
|
53
|
+
REQUIRE(is_enabled(level::error));
|
54
|
+
log(level::error, "testing %1% %2% %3%", 1, "2", 3.0);
|
55
|
+
auto output = capture.result();
|
56
|
+
CAPTURE(output);
|
57
|
+
REQUIRE(re_search(output, boost::regex("ERROR puppetlabs\\.facter - testing 1 2 3$")));
|
58
|
+
REQUIRE(error_logged());
|
59
|
+
}
|
60
|
+
|
61
|
+
SCENARIO("logging with a FATAL level") {
|
62
|
+
log_capture capture(level::fatal);
|
63
|
+
REQUIRE(is_enabled(level::fatal));
|
64
|
+
log(level::fatal, "testing %1% %2% %3%", 1, "2", 3.0);
|
65
|
+
auto output = capture.result();
|
66
|
+
CAPTURE(output);
|
67
|
+
REQUIRE(re_search(output, boost::regex("FATAL puppetlabs\\.facter - testing 1 2 3$")));
|
68
|
+
REQUIRE(error_logged());
|
69
|
+
}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
#define CATCH_CONFIG_RUNNER
|
2
|
+
#include <catch.hpp>
|
3
|
+
#include <facter/ruby/ruby.hpp>
|
4
|
+
#include <facter/logging/logging.hpp>
|
5
|
+
#include <boost/nowide/iostream.hpp>
|
6
|
+
|
7
|
+
using namespace std;
|
8
|
+
using namespace facter::logging;
|
9
|
+
|
10
|
+
int main(int argc, char **argv)
|
11
|
+
{
|
12
|
+
// Disable logging for tests
|
13
|
+
setup_logging(boost::nowide::cout);
|
14
|
+
set_level(level::none);
|
15
|
+
|
16
|
+
// Before running tests, initialize Ruby
|
17
|
+
facter::ruby::initialize();
|
18
|
+
|
19
|
+
return Catch::Session().run( argc, argv );
|
20
|
+
}
|
@@ -0,0 +1,44 @@
|
|
1
|
+
#include <cstdlib>
|
2
|
+
#include <iostream>
|
3
|
+
#include <utility>
|
4
|
+
#include "mock_server.hpp"
|
5
|
+
|
6
|
+
namespace facter {
|
7
|
+
|
8
|
+
static void session(tcp::socket sock) {
|
9
|
+
try {
|
10
|
+
for (;;) {
|
11
|
+
char data[1024];
|
12
|
+
|
13
|
+
boost::system::error_code error;
|
14
|
+
sock.read_some(boost::asio::buffer(data), error);
|
15
|
+
if (error == boost::asio::error::eof) {
|
16
|
+
break; // Connection closed cleanly by peer.
|
17
|
+
} else if (error) {
|
18
|
+
throw boost::system::system_error(error); // Some other error.
|
19
|
+
}
|
20
|
+
|
21
|
+
std::string response = "HTTP/1.1 301 Moved Permanently\nContent-length: 0\nLocation: https://puppet.com/\nConnection: close\n\n";
|
22
|
+
boost::asio::write(sock, boost::asio::buffer(response));
|
23
|
+
}
|
24
|
+
} catch (std::exception& e) {
|
25
|
+
std::cerr << "Exception in thread: " << e.what() << "\n";
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
mock_server::mock_server(int port) :
|
30
|
+
acceptor_(io_service_, tcp::endpoint(tcp::v4(), port)),
|
31
|
+
socket_(io_service_)
|
32
|
+
{
|
33
|
+
acceptor_.async_accept(socket_, [this](boost::system::error_code ec) {
|
34
|
+
if (!ec) session(std::move(socket_));
|
35
|
+
});
|
36
|
+
thread_ = boost::thread([this]() {io_service_.run_one();});
|
37
|
+
}
|
38
|
+
|
39
|
+
mock_server::~mock_server()
|
40
|
+
{
|
41
|
+
thread_.join();
|
42
|
+
}
|
43
|
+
|
44
|
+
} // namespace facter
|
@@ -0,0 +1,25 @@
|
|
1
|
+
#pragma once
|
2
|
+
|
3
|
+
#pragma GCC diagnostic push
|
4
|
+
#pragma GCC diagnostic ignored "-Wunused-variable"
|
5
|
+
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
|
6
|
+
#include <boost/asio.hpp>
|
7
|
+
#include <boost/thread.hpp>
|
8
|
+
#pragma GCC diagnostic pop
|
9
|
+
|
10
|
+
namespace facter {
|
11
|
+
|
12
|
+
using boost::asio::ip::tcp;
|
13
|
+
|
14
|
+
class mock_server {
|
15
|
+
public:
|
16
|
+
mock_server(int port);
|
17
|
+
~mock_server();
|
18
|
+
private:
|
19
|
+
boost::asio::io_service io_service_;
|
20
|
+
tcp::acceptor acceptor_;
|
21
|
+
tcp::socket socket_;
|
22
|
+
boost::thread thread_;
|
23
|
+
};
|
24
|
+
|
25
|
+
} // namespace facter
|
@@ -0,0 +1,634 @@
|
|
1
|
+
#include <catch.hpp>
|
2
|
+
#include <facter/version.h>
|
3
|
+
#include <facter/facts/scalar_value.hpp>
|
4
|
+
#include <internal/ruby/ruby_value.hpp>
|
5
|
+
#include <leatherman/util/regex.hpp>
|
6
|
+
#include <leatherman/util/scoped_env.hpp>
|
7
|
+
#include <leatherman/ruby/api.hpp>
|
8
|
+
#include "./ruby_helper.hpp"
|
9
|
+
#include "../collection_fixture.hpp"
|
10
|
+
#include "../log_capture.hpp"
|
11
|
+
|
12
|
+
using namespace std;
|
13
|
+
using namespace facter::facts;
|
14
|
+
using namespace facter::ruby;
|
15
|
+
using namespace facter::logging;
|
16
|
+
using namespace facter::testing;
|
17
|
+
using namespace leatherman::util;
|
18
|
+
using namespace leatherman::ruby;
|
19
|
+
|
20
|
+
SCENARIO("custom facts written in Ruby") {
|
21
|
+
collection_fixture facts;
|
22
|
+
REQUIRE(facts.size() == 0u);
|
23
|
+
|
24
|
+
// Setup ruby
|
25
|
+
auto& ruby = api::instance();
|
26
|
+
REQUIRE(ruby.initialized());
|
27
|
+
ruby.include_stack_trace(true);
|
28
|
+
|
29
|
+
GIVEN("a fact that resolves to nil") {
|
30
|
+
REQUIRE(load_custom_fact("nil_fact.rb", facts));
|
31
|
+
THEN("the value should not be in the collection") {
|
32
|
+
REQUIRE_FALSE(facts["foo"]);
|
33
|
+
}
|
34
|
+
}
|
35
|
+
GIVEN("a fact that resolves to non-nil") {
|
36
|
+
REQUIRE(load_custom_fact("simple.rb", facts));
|
37
|
+
THEN("the value should be in the collection") {
|
38
|
+
REQUIRE(ruby_value_to_string(facts.get<ruby_value>("foo")) == "\"bar\"");
|
39
|
+
}
|
40
|
+
}
|
41
|
+
GIVEN("a fact with a simple resolution") {
|
42
|
+
REQUIRE(load_custom_fact("simple_resolution.rb", facts));
|
43
|
+
THEN("the value should be in the collection") {
|
44
|
+
REQUIRE(ruby_value_to_string(facts.get<ruby_value>("foo")) == "\"bar\"");
|
45
|
+
}
|
46
|
+
}
|
47
|
+
GIVEN("a fact without any resolutions") {
|
48
|
+
WHEN("the fact has no explicit value") {
|
49
|
+
REQUIRE(load_custom_fact("empty_fact.rb", facts));
|
50
|
+
THEN("the value should not be in the collection") {
|
51
|
+
REQUIRE_FALSE(facts["foo"]);
|
52
|
+
}
|
53
|
+
}
|
54
|
+
WHEN("the fact has an explicit value") {
|
55
|
+
REQUIRE(load_custom_fact("empty_fact_with_value.rb", facts));
|
56
|
+
THEN("the value should be in the collection") {
|
57
|
+
REQUIRE(ruby_value_to_string(facts.get<ruby_value>("foo")) == "{\n int => 1,\n bool_true => true,\n bool_false => false,\n double => 12.34,\n string => \"foo\",\n array => [\n 1,\n 2,\n 3\n ]\n}");
|
58
|
+
}
|
59
|
+
}
|
60
|
+
}
|
61
|
+
GIVEN("a fact with an empty command") {
|
62
|
+
log_capture capture(level::error);
|
63
|
+
REQUIRE_FALSE(load_custom_fact("empty_command.rb", facts));
|
64
|
+
THEN("an error is logged") {
|
65
|
+
auto output = capture.result();
|
66
|
+
CAPTURE(output);
|
67
|
+
REQUIRE(re_search(output, boost::regex("ERROR puppetlabs\\.facter - .* expected a non-empty String for first argument")));
|
68
|
+
}
|
69
|
+
}
|
70
|
+
GIVEN("a fact with a command") {
|
71
|
+
REQUIRE(load_custom_fact("simple_command.rb", facts));
|
72
|
+
THEN("the value should be in the collection") {
|
73
|
+
REQUIRE(ruby_value_to_string(facts.get<ruby_value>("foo")) == "\"bar baz\"");
|
74
|
+
}
|
75
|
+
}
|
76
|
+
GIVEN("a fact with a bad command") {
|
77
|
+
THEN("the value should not be in the collection") {
|
78
|
+
REQUIRE_FALSE(facts["foo"]);
|
79
|
+
}
|
80
|
+
}
|
81
|
+
GIVEN("a fact with unicode characters in the path and name") {
|
82
|
+
REQUIRE(load_custom_fact("uni\u1401dir/customfacts\u2122.rb", facts));
|
83
|
+
THEN("the value should be in the collection") {
|
84
|
+
REQUIRE(ruby_value_to_string(facts.get<ruby_value>("somefact\u2122")) == "\"other\u2122\"");
|
85
|
+
}
|
86
|
+
}
|
87
|
+
GIVEN("a fact with a confine") {
|
88
|
+
WHEN("the confine is met") {
|
89
|
+
facts.add("somefact", make_value<string_value>("SomeValue"));
|
90
|
+
REQUIRE(load_custom_fact("simple_confine.rb", facts));
|
91
|
+
THEN("the value should be in the collection") {
|
92
|
+
REQUIRE(ruby_value_to_string(facts.get<ruby_value>("foo")) == "\"bar\"");
|
93
|
+
}
|
94
|
+
}
|
95
|
+
WHEN("the confine is not met") {
|
96
|
+
REQUIRE(load_custom_fact("simple_confine.rb", facts));
|
97
|
+
THEN("the value should not be in the collection") {
|
98
|
+
REQUIRE_FALSE(facts["foo"]);
|
99
|
+
}
|
100
|
+
}
|
101
|
+
WHEN("the multiple confines are present and one is not met") {
|
102
|
+
facts.add("kernel", make_value<string_value>("linux"));
|
103
|
+
REQUIRE(load_custom_fact("confine_missing_fact.rb", facts));
|
104
|
+
THEN("the value should not be in the collection") {
|
105
|
+
REQUIRE_FALSE(facts["foo"]);
|
106
|
+
}
|
107
|
+
}
|
108
|
+
WHEN("multiple confines are met") {
|
109
|
+
facts.add("fact1", make_value<string_value>("VALUE1"));
|
110
|
+
facts.add("fact2", make_value<string_value>("Value2"));
|
111
|
+
facts.add("fact3", make_value<string_value>("value3"));
|
112
|
+
REQUIRE(load_custom_fact("multi_confine.rb", facts));
|
113
|
+
THEN("the value should be in the collection") {
|
114
|
+
REQUIRE(ruby_value_to_string(facts.get<ruby_value>("foo")) == "\"bar\"");
|
115
|
+
}
|
116
|
+
}
|
117
|
+
WHEN("none of the multiple confines are met") {
|
118
|
+
REQUIRE(load_custom_fact("multi_confine.rb", facts));
|
119
|
+
THEN("the value should not be in the collection") {
|
120
|
+
REQUIRE_FALSE(facts["foo"]);
|
121
|
+
}
|
122
|
+
}
|
123
|
+
WHEN("the confine is a block that returns nil") {
|
124
|
+
REQUIRE(load_custom_fact("block_nil_confine.rb", facts));
|
125
|
+
THEN("the value should not be in the collection") {
|
126
|
+
REQUIRE_FALSE(facts["foo"]);
|
127
|
+
}
|
128
|
+
}
|
129
|
+
WHEN("the confine is a block that evaluates to false") {
|
130
|
+
REQUIRE(load_custom_fact("block_confine.rb", facts));
|
131
|
+
THEN("the value should not be in the collection") {
|
132
|
+
REQUIRE_FALSE(facts["foo"]);
|
133
|
+
}
|
134
|
+
}
|
135
|
+
WHEN("the confine is a block that simply returns false") {
|
136
|
+
REQUIRE(load_custom_fact("block_false_confine.rb", facts));
|
137
|
+
THEN("the value should not be in the collection") {
|
138
|
+
REQUIRE_FALSE(facts["foo"]);
|
139
|
+
}
|
140
|
+
}
|
141
|
+
WHEN("the confine is a block that evaluates to true") {
|
142
|
+
facts.add("fact1", make_value<string_value>("value1"));
|
143
|
+
REQUIRE(load_custom_fact("block_confine.rb", facts));
|
144
|
+
THEN("the value should be in the collection") {
|
145
|
+
REQUIRE(ruby_value_to_string(facts.get<ruby_value>("foo")) == "\"bar\"");
|
146
|
+
}
|
147
|
+
}
|
148
|
+
WHEN("the confine is a block that simply returns true") {
|
149
|
+
REQUIRE(load_custom_fact("block_true_confine.rb", facts));
|
150
|
+
THEN("the value should be in the collection") {
|
151
|
+
REQUIRE(ruby_value_to_string(facts.get<ruby_value>("foo")) == "\"bar\"");
|
152
|
+
}
|
153
|
+
}
|
154
|
+
WHEN("the confine is an array and the value is not in the array") {
|
155
|
+
facts.add("fact", make_value<string_value>("foo"));
|
156
|
+
REQUIRE(load_custom_fact("array_confine.rb", facts));
|
157
|
+
THEN("the value should not be in the collection") {
|
158
|
+
REQUIRE_FALSE(facts["foo"]);
|
159
|
+
}
|
160
|
+
}
|
161
|
+
WHEN("the confine is an array and the value is in the array") {
|
162
|
+
facts.add("fact", make_value<string_value>("value3"));
|
163
|
+
REQUIRE(load_custom_fact("array_confine.rb", facts));
|
164
|
+
THEN("the value should be in the collection") {
|
165
|
+
REQUIRE(ruby_value_to_string(facts.get<ruby_value>("foo")) == "\"bar\"");
|
166
|
+
}
|
167
|
+
}
|
168
|
+
WHEN("the confine is a regular expression that evaluates to true") {
|
169
|
+
facts.add("fact", make_value<string_value>("foo"));
|
170
|
+
REQUIRE(load_custom_fact("regexp_confine.rb", facts));
|
171
|
+
THEN("the value should be in the collection") {
|
172
|
+
REQUIRE(ruby_value_to_string(facts.get<ruby_value>("foo")) == "\"bar\"");
|
173
|
+
}
|
174
|
+
}
|
175
|
+
WHEN("the confine is a regular expression that evaluates to false") {
|
176
|
+
facts.add("fact", make_value<string_value>("baz"));
|
177
|
+
REQUIRE(load_custom_fact("regexp_confine.rb", facts));
|
178
|
+
THEN("the value should not be in the collection") {
|
179
|
+
REQUIRE_FALSE(facts["foo"]);
|
180
|
+
}
|
181
|
+
}
|
182
|
+
WHEN("the confine is a range that evaluates to true") {
|
183
|
+
facts.add("fact", make_value<integer_value>(4));
|
184
|
+
REQUIRE(load_custom_fact("range_confine.rb", facts));
|
185
|
+
THEN("the value should be in the collection") {
|
186
|
+
REQUIRE(ruby_value_to_string(facts.get<ruby_value>("foo")) == "\"bar\"");
|
187
|
+
}
|
188
|
+
}
|
189
|
+
WHEN("the confine is a range that evaluates to false") {
|
190
|
+
facts.add("fact", make_value<integer_value>(10));
|
191
|
+
REQUIRE(load_custom_fact("range_confine.rb", facts));
|
192
|
+
THEN("the value should not be in the collection") {
|
193
|
+
REQUIRE_FALSE(facts["foo"]);
|
194
|
+
}
|
195
|
+
}
|
196
|
+
WHEN("the confine evaluates to true") {
|
197
|
+
facts.add("fact", make_value<boolean_value>(true));
|
198
|
+
REQUIRE(load_custom_fact("boolean_true_confine.rb", facts));
|
199
|
+
THEN("the value should be in the collection") {
|
200
|
+
REQUIRE(ruby_value_to_string(facts.get<ruby_value>("foo")) == "\"bar\"");
|
201
|
+
}
|
202
|
+
}
|
203
|
+
WHEN("the confine evaluates to false") {
|
204
|
+
facts.add("fact", make_value<boolean_value>(true));
|
205
|
+
REQUIRE(load_custom_fact("boolean_false_confine.rb", facts));
|
206
|
+
THEN("the value should not be in the collection") {
|
207
|
+
REQUIRE_FALSE(facts["foo"]);
|
208
|
+
}
|
209
|
+
}
|
210
|
+
THEN("resolution with the most confines wins") {
|
211
|
+
facts.add("fact1", make_value<string_value>("value1"));
|
212
|
+
facts.add("fact2", make_value<string_value>("value2"));
|
213
|
+
facts.add("fact3", make_value<string_value>("value3"));
|
214
|
+
REQUIRE(load_custom_fact("confine_weight.rb", facts));
|
215
|
+
REQUIRE(ruby_value_to_string(facts.get<ruby_value>("foo")) == "\"value2\"");
|
216
|
+
}
|
217
|
+
}
|
218
|
+
GIVEN("a file with a syntax error") {
|
219
|
+
log_capture capture(level::error);
|
220
|
+
REQUIRE_FALSE(load_custom_fact("bad_syntax.rb", facts));
|
221
|
+
THEN("an error is logged") {
|
222
|
+
auto output = capture.result();
|
223
|
+
CAPTURE(output);
|
224
|
+
REQUIRE(re_search(output, boost::regex("ERROR puppetlabs\\.facter - .* undefined method `foo' for Facter:Module")));
|
225
|
+
}
|
226
|
+
}
|
227
|
+
GIVEN("a fact with weighted resolutions") {
|
228
|
+
REQUIRE(load_custom_fact("weight.rb", facts));
|
229
|
+
THEN("the resolution with the highest weight wins") {
|
230
|
+
REQUIRE(ruby_value_to_string(facts.get<ruby_value>("foo")) == "\"value2\"");
|
231
|
+
}
|
232
|
+
}
|
233
|
+
GIVEN("a fact with weight options") {
|
234
|
+
REQUIRE(load_custom_fact("weight_option.rb", facts));
|
235
|
+
THEN("the resolution with the highest weight wins") {
|
236
|
+
REQUIRE(ruby_value_to_string(facts.get<ruby_value>("foo")) == "\"value2\"");
|
237
|
+
}
|
238
|
+
}
|
239
|
+
GIVEN("a fact that resolves to a string value") {
|
240
|
+
REQUIRE(load_custom_fact("string_fact.rb", facts));
|
241
|
+
THEN("the value is a string") {
|
242
|
+
REQUIRE(ruby_value_to_string(facts.get<ruby_value>("foo")) == "\"hello world\"");
|
243
|
+
}
|
244
|
+
}
|
245
|
+
GIVEN("a fact that resolves to an integer value") {
|
246
|
+
REQUIRE(load_custom_fact("integer_fact.rb", facts));
|
247
|
+
THEN("the value is an integer") {
|
248
|
+
REQUIRE(ruby_value_to_string(facts.get<ruby_value>("foo")) == "1234");
|
249
|
+
}
|
250
|
+
}
|
251
|
+
GIVEN("a fact that resolves to a true value") {
|
252
|
+
REQUIRE(load_custom_fact("boolean_true_fact.rb", facts));
|
253
|
+
THEN("the value is true") {
|
254
|
+
REQUIRE(ruby_value_to_string(facts.get<ruby_value>("foo")) == "true");
|
255
|
+
}
|
256
|
+
}
|
257
|
+
GIVEN("a fact that resolves to a false value") {
|
258
|
+
REQUIRE(load_custom_fact("boolean_false_fact.rb", facts));
|
259
|
+
THEN("the value is false") {
|
260
|
+
REQUIRE(ruby_value_to_string(facts.get<ruby_value>("foo")) == "false");
|
261
|
+
}
|
262
|
+
}
|
263
|
+
GIVEN("a fact that resolves to a double value") {
|
264
|
+
REQUIRE(load_custom_fact("double_fact.rb", facts));
|
265
|
+
THEN("the value is a double") {
|
266
|
+
REQUIRE(ruby_value_to_string(facts.get<ruby_value>("foo")) == "12.34");
|
267
|
+
}
|
268
|
+
}
|
269
|
+
GIVEN("a fact that resolves to an array value") {
|
270
|
+
REQUIRE(load_custom_fact("array_fact.rb", facts));
|
271
|
+
THEN("the value is an array") {
|
272
|
+
REQUIRE(ruby_value_to_string(facts.get<ruby_value>("foo")) == "[\n 1,\n true,\n false,\n \"foo\",\n 12.4,\n [\n 1\n ],\n {\n foo => \"bar\"\n }\n]");
|
273
|
+
}
|
274
|
+
THEN("the members of the fact can be queried") {
|
275
|
+
REQUIRE(ruby_value_to_string(facts.query<ruby_value>("foo.5.0")) == "1");
|
276
|
+
}
|
277
|
+
}
|
278
|
+
GIVEN("a fact that resolves to a hash value") {
|
279
|
+
REQUIRE(load_custom_fact("hash_fact.rb", facts));
|
280
|
+
THEN("the value is a hash") {
|
281
|
+
REQUIRE(ruby_value_to_string(facts.get<ruby_value>("foo")) == "{\n int => 1,\n bool_true => true,\n bool_false => false,\n double => 12.34,\n string => \"foo\",\n array => [\n 1,\n 2,\n 3\n ]\n}");
|
282
|
+
}
|
283
|
+
THEN("the members of the fact can be queried") {
|
284
|
+
REQUIRE(ruby_value_to_string(facts.query<ruby_value>("foo.array.1")) == "2");
|
285
|
+
}
|
286
|
+
}
|
287
|
+
GIVEN("a fact that resolves using Facter.value") {
|
288
|
+
facts.add("bar", make_value<string_value>("baz"));
|
289
|
+
REQUIRE(load_custom_fact("value.rb", facts));
|
290
|
+
THEN("the value should match") {
|
291
|
+
REQUIRE(ruby_value_to_string(facts.get<ruby_value>("foo")) == "\"baz\"");
|
292
|
+
}
|
293
|
+
}
|
294
|
+
GIVEN("a fact that resolves using Facter.fact") {
|
295
|
+
facts.add("bar", make_value<string_value>("baz"));
|
296
|
+
REQUIRE(load_custom_fact("fact.rb", facts));
|
297
|
+
THEN("the value should match") {
|
298
|
+
REQUIRE(ruby_value_to_string(facts.get<ruby_value>("foo")) == "\"baz\"");
|
299
|
+
}
|
300
|
+
}
|
301
|
+
GIVEN("a fact that resolves using Facter[]") {
|
302
|
+
facts.add("bar", make_value<string_value>("baz"));
|
303
|
+
REQUIRE(load_custom_fact("lookup.rb", facts));
|
304
|
+
THEN("the value should match") {
|
305
|
+
REQUIRE(ruby_value_to_string(facts.get<ruby_value>("foo")) == "\"baz\"");
|
306
|
+
}
|
307
|
+
}
|
308
|
+
GIVEN("a fact that resolves when using Facter::Core::Execution#which") {
|
309
|
+
REQUIRE(load_custom_fact("which.rb", facts));
|
310
|
+
THEN("the value should match") {
|
311
|
+
REQUIRE(ruby_value_to_string(facts.get<ruby_value>("foo")) == "\"bar\"");
|
312
|
+
}
|
313
|
+
}
|
314
|
+
GIVEN("a fact that logs debug messages") {
|
315
|
+
log_capture capture(level::debug);
|
316
|
+
REQUIRE(load_custom_fact("debug.rb", facts));
|
317
|
+
THEN("the messages should be logged") {
|
318
|
+
auto output = capture.result();
|
319
|
+
CAPTURE(output);
|
320
|
+
REQUIRE(re_search(output, boost::regex("DEBUG puppetlabs\\.facter - message1")));
|
321
|
+
REQUIRE(re_search(output, boost::regex("DEBUG puppetlabs\\.facter - message2")));
|
322
|
+
}
|
323
|
+
}
|
324
|
+
GIVEN("a fact that logs debug messages only once") {
|
325
|
+
log_capture capture(level::debug);
|
326
|
+
REQUIRE(load_custom_fact("debugonce.rb", facts));
|
327
|
+
THEN("the messages should be logged") {
|
328
|
+
auto output = capture.result();
|
329
|
+
CAPTURE(output);
|
330
|
+
REQUIRE(re_search(output, boost::regex("DEBUG puppetlabs\\.facter - unique debug1")));
|
331
|
+
REQUIRE(re_search(output, boost::regex("DEBUG puppetlabs\\.facter - unique debug2")));
|
332
|
+
}
|
333
|
+
}
|
334
|
+
GIVEN("a fact that logs warning messages") {
|
335
|
+
log_capture capture(level::warning);
|
336
|
+
REQUIRE(load_custom_fact("warn.rb", facts));
|
337
|
+
THEN("the messages should be logged") {
|
338
|
+
auto output = capture.result();
|
339
|
+
CAPTURE(output);
|
340
|
+
REQUIRE(re_search(output, boost::regex("WARN puppetlabs\\.facter - message1")));
|
341
|
+
REQUIRE(re_search(output, boost::regex("WARN puppetlabs\\.facter - message2")));
|
342
|
+
}
|
343
|
+
}
|
344
|
+
GIVEN("a fact that logs warning messages only once") {
|
345
|
+
log_capture capture(level::warning);
|
346
|
+
REQUIRE(load_custom_fact("warnonce.rb", facts));
|
347
|
+
THEN("the messages should be logged") {
|
348
|
+
auto output = capture.result();
|
349
|
+
CAPTURE(output);
|
350
|
+
REQUIRE(re_search(output, boost::regex("WARN puppetlabs\\.facter - unique warning1")));
|
351
|
+
REQUIRE(re_search(output, boost::regex("WARN puppetlabs\\.facter - unique warning2")));
|
352
|
+
}
|
353
|
+
}
|
354
|
+
GIVEN("a fact that logs an exception") {
|
355
|
+
log_capture capture(level::error);
|
356
|
+
REQUIRE(load_custom_fact("log_exception.rb", facts));
|
357
|
+
THEN("an error should be logged") {
|
358
|
+
auto output = capture.result();
|
359
|
+
CAPTURE(output);
|
360
|
+
REQUIRE(re_search(output, boost::regex("ERROR puppetlabs\\.facter - first")));
|
361
|
+
REQUIRE(re_search(output, boost::regex("ERROR puppetlabs\\.facter - second")));
|
362
|
+
REQUIRE(re_search(output, boost::regex("ERROR puppetlabs\\.facter - third")));
|
363
|
+
}
|
364
|
+
}
|
365
|
+
GIVEN("a fact with a named resolution") {
|
366
|
+
REQUIRE(load_custom_fact("named_resolution.rb", facts));
|
367
|
+
THEN("adding a resolution with the same name overrides the existing resolution") {
|
368
|
+
REQUIRE(ruby_value_to_string(facts.get<ruby_value>("foo")) == "\"value2\"");
|
369
|
+
}
|
370
|
+
}
|
371
|
+
GIVEN("a fact added with define_fact and define_resolution") {
|
372
|
+
REQUIRE(load_custom_fact("define_fact.rb", facts));
|
373
|
+
THEN("the value should be in the collection") {
|
374
|
+
REQUIRE(ruby_value_to_string(facts.get<ruby_value>("foo")) == "\"bar\"");
|
375
|
+
}
|
376
|
+
}
|
377
|
+
GIVEN("a fact with a dependency cycle") {
|
378
|
+
log_capture capture(level::error);
|
379
|
+
REQUIRE(load_custom_fact("cycle.rb", facts));
|
380
|
+
THEN("an error is logged") {
|
381
|
+
auto output = capture.result();
|
382
|
+
CAPTURE(output);
|
383
|
+
REQUIRE(re_search(output, boost::regex("ERROR puppetlabs\\.facter - .* cycle detected while requesting value of fact \"bar\"")));
|
384
|
+
}
|
385
|
+
}
|
386
|
+
GIVEN("an aggregate resolution with array chunks") {
|
387
|
+
REQUIRE(load_custom_fact("aggregate.rb", facts));
|
388
|
+
THEN("the arrays are appended") {
|
389
|
+
REQUIRE(ruby_value_to_string(facts.get<ruby_value>("foo")) == "[\n \"foo\",\n \"bar\"\n]");
|
390
|
+
}
|
391
|
+
}
|
392
|
+
GIVEN("an aggregate resolution with required chunks") {
|
393
|
+
REQUIRE(load_custom_fact("aggregate_with_require.rb", facts));
|
394
|
+
THEN("the arrays are appended in dependency order") {
|
395
|
+
REQUIRE(ruby_value_to_string(facts.get<ruby_value>("foo")) == "[\n \"foo\",\n \"bar\",\n \"foo\",\n \"baz\",\n \"foo\",\n \"bar\",\n \"foo\"\n]");
|
396
|
+
}
|
397
|
+
}
|
398
|
+
GIVEN("an aggregate resolution with an invalid require") {
|
399
|
+
log_capture capture(level::error);
|
400
|
+
REQUIRE_FALSE(load_custom_fact("aggregate_invalid_require.rb", facts));
|
401
|
+
THEN("the arrays are appended in dependency order") {
|
402
|
+
auto output = capture.result();
|
403
|
+
CAPTURE(output);
|
404
|
+
REQUIRE(re_search(output, boost::regex("ERROR puppetlabs\\.facter - .* expected a Symbol or Array of Symbol for require option")));
|
405
|
+
}
|
406
|
+
}
|
407
|
+
GIVEN("an aggregate resolution with a custom aggregator") {
|
408
|
+
REQUIRE(load_custom_fact("aggregate_with_block.rb", facts));
|
409
|
+
THEN("the value should be what was returned from the block") {
|
410
|
+
REQUIRE(ruby_value_to_string(facts.get<ruby_value>("foo")) == "10");
|
411
|
+
}
|
412
|
+
}
|
413
|
+
GIVEN("an aggregate resolution with hashes to merge") {
|
414
|
+
REQUIRE(load_custom_fact("aggregate_with_merge.rb", facts));
|
415
|
+
THEN("the value should be a deep merge of the hashes") {
|
416
|
+
REQUIRE(ruby_value_to_string(facts.get<ruby_value>("foo")) == "{\n foo => \"bar\",\n array => [\n 1,\n 2,\n 3,\n 4,\n 5,\n 6\n ],\n hash => {\n jam => \"cakes\",\n subarray => [\n \"hello\",\n \"world\"\n ],\n foo => \"bar\"\n },\n baz => \"jam\"\n}");
|
417
|
+
}
|
418
|
+
}
|
419
|
+
GIVEN("an aggregate resolution with an invalid require") {
|
420
|
+
log_capture capture(level::error);
|
421
|
+
REQUIRE(load_custom_fact("aggregate_with_invalid_merge.rb", facts));
|
422
|
+
THEN("an error is logged") {
|
423
|
+
auto output = capture.result();
|
424
|
+
CAPTURE(output);
|
425
|
+
REQUIRE(re_search(output, boost::regex("ERROR puppetlabs\\.facter - .* cannot merge \"hello\":String and \"world\":String")));
|
426
|
+
}
|
427
|
+
}
|
428
|
+
GIVEN("an aggregate resolution with a cycle") {
|
429
|
+
log_capture capture(level::error);
|
430
|
+
REQUIRE(load_custom_fact("aggregate_with_cycle.rb", facts));
|
431
|
+
THEN("an error is logged") {
|
432
|
+
auto output = capture.result();
|
433
|
+
CAPTURE(output);
|
434
|
+
REQUIRE(re_search(output, boost::regex("ERROR puppetlabs.facter - .* chunk dependency cycle detected")));
|
435
|
+
}
|
436
|
+
}
|
437
|
+
GIVEN("a fact with a defined aggregate resolution") {
|
438
|
+
REQUIRE(load_custom_fact("define_aggregate_fact.rb", facts));
|
439
|
+
THEN("value should be in the collection") {
|
440
|
+
REQUIRE(ruby_value_to_string(facts.get<ruby_value>("foo")) == "[\n \"foo\",\n \"bar\"\n]");
|
441
|
+
}
|
442
|
+
}
|
443
|
+
GIVEN("an aggregate resolution when a simple resolution already exists") {
|
444
|
+
log_capture capture(level::error);
|
445
|
+
REQUIRE_FALSE(load_custom_fact("existing_simple_resolution.rb", facts));
|
446
|
+
THEN("an error is logged") {
|
447
|
+
auto output = capture.result();
|
448
|
+
CAPTURE(output);
|
449
|
+
REQUIRE(re_search(output, boost::regex("ERROR puppetlabs\\.facter - .* cannot define an aggregate resolution with name \"bar\": a simple resolution with the same name already exists")));
|
450
|
+
}
|
451
|
+
}
|
452
|
+
GIVEN("a simple resolution when an aggregate resolution already exists") {
|
453
|
+
log_capture capture(level::error);
|
454
|
+
REQUIRE_FALSE(load_custom_fact("existing_aggregate_resolution.rb", facts));
|
455
|
+
THEN("an error is logged") {
|
456
|
+
auto output = capture.result();
|
457
|
+
CAPTURE(output);
|
458
|
+
REQUIRE(re_search(output, boost::regex("ERROR puppetlabs\\.facter - .* cannot define a simple resolution with name \"bar\": an aggregate resolution with the same name already exists")));
|
459
|
+
}
|
460
|
+
}
|
461
|
+
GIVEN("a custom fact that logs the facter version") {
|
462
|
+
log_capture capture(level::debug);
|
463
|
+
REQUIRE(load_custom_fact("version.rb", facts));
|
464
|
+
THEN("the expected version is logged") {
|
465
|
+
auto output = capture.result();
|
466
|
+
CAPTURE(output);
|
467
|
+
REQUIRE(re_search(output, boost::regex("DEBUG puppetlabs\\.facter - " + (boost::format("%1%\\.%2%\\.%3%") % LIBFACTER_VERSION_MAJOR % LIBFACTER_VERSION_MINOR % LIBFACTER_VERSION_PATCH).str())));
|
468
|
+
}
|
469
|
+
}
|
470
|
+
GIVEN("a fact resolution that uses Facter::Core::Execution#exec") {
|
471
|
+
REQUIRE(load_custom_fact("exec.rb", facts));
|
472
|
+
THEN("value should be in the collection") {
|
473
|
+
REQUIRE(ruby_value_to_string(facts.get<ruby_value>("foo")) == "\"bar baz\"");
|
474
|
+
}
|
475
|
+
}
|
476
|
+
GIVEN("Facter::Core::Execution#execute with on_fail => :raise") {
|
477
|
+
log_capture capture(level::error);
|
478
|
+
REQUIRE_FALSE(load_custom_fact("execute_on_fail_raise.rb", facts));
|
479
|
+
THEN("an error is logged") {
|
480
|
+
auto output = capture.result();
|
481
|
+
CAPTURE(output);
|
482
|
+
REQUIRE(re_search(output, boost::regex("ERROR puppetlabs\\.facter - .* execution of command \"the_most_interesting_command_in_the_world\" failed")));
|
483
|
+
}
|
484
|
+
}
|
485
|
+
GIVEN("a fact resolution that uses Facter::Core::Execution#execute with a default value") {
|
486
|
+
REQUIRE(load_custom_fact("execute_on_fail_value.rb", facts));
|
487
|
+
THEN("value should be in the collection") {
|
488
|
+
REQUIRE(ruby_value_to_string(facts.get<ruby_value>("foo")) == "\"default\"");
|
489
|
+
}
|
490
|
+
}
|
491
|
+
GIVEN("a fact resolution that uses Facter::Core::Execution#execute with a timeout") {
|
492
|
+
log_capture capture(level::error);
|
493
|
+
REQUIRE_FALSE(load_custom_fact("execute_timeout.rb", facts));
|
494
|
+
THEN("an error is logged") {
|
495
|
+
auto output = capture.result();
|
496
|
+
CAPTURE(output);
|
497
|
+
REQUIRE(re_search(output, boost::regex("ERROR puppetlabs\\.facter - .* command timed out after 1 seconds")));
|
498
|
+
}
|
499
|
+
}
|
500
|
+
GIVEN("a fact that uses timeout") {
|
501
|
+
log_capture capture(level::warning);
|
502
|
+
REQUIRE(load_custom_fact("timeout.rb", facts));
|
503
|
+
THEN("a warning is logged") {
|
504
|
+
auto output = capture.result();
|
505
|
+
CAPTURE(output);
|
506
|
+
REQUIRE(re_search(output, boost::regex("WARN puppetlabs\\.facter - timeout option is not supported for custom facts and will be ignored.$")));
|
507
|
+
REQUIRE(re_search(output, boost::regex("WARN puppetlabs\\.facter - timeout= is not supported for custom facts and will be ignored.$")));
|
508
|
+
}
|
509
|
+
}
|
510
|
+
GIVEN("a fact that uses Facter#trace to enable backtraces") {
|
511
|
+
log_capture capture(level::error);
|
512
|
+
REQUIRE(load_custom_fact("trace.rb", facts));
|
513
|
+
THEN("backtraces are logged") {
|
514
|
+
auto output = capture.result();
|
515
|
+
CAPTURE(output);
|
516
|
+
REQUIRE(re_search(output, boost::regex("ERROR puppetlabs\\.facter - first")));
|
517
|
+
REQUIRE(re_search(output, boost::regex("ERROR puppetlabs\\.facter - second\\nbacktrace:")));
|
518
|
+
}
|
519
|
+
}
|
520
|
+
GIVEN("a fact that uses Facter#debugging to enable debug messages") {
|
521
|
+
log_capture capture(level::debug);
|
522
|
+
REQUIRE(load_custom_fact("debugging.rb", facts));
|
523
|
+
THEN("debug message is logged") {
|
524
|
+
auto output = capture.result();
|
525
|
+
CAPTURE(output);
|
526
|
+
REQUIRE(re_search(output, boost::regex("DEBUG puppetlabs\\.facter - yep")));
|
527
|
+
REQUIRE_FALSE(re_search(output, boost::regex("DEBUG puppetlabs\\.facter - nope")));
|
528
|
+
}
|
529
|
+
}
|
530
|
+
GIVEN("a custom on_message block") {
|
531
|
+
log_capture capture(level::debug);
|
532
|
+
REQUIRE(load_custom_fact("on_message.rb", facts));
|
533
|
+
THEN("no messages are logged") {
|
534
|
+
REQUIRE_FALSE(re_search(capture.result(), boost::regex("debug message")));
|
535
|
+
}
|
536
|
+
}
|
537
|
+
GIVEN("a custom fact with a higher weight than a built-in fact") {
|
538
|
+
REQUIRE(load_custom_fact("ruby.rb", facts));
|
539
|
+
THEN("the custom fact wins") {
|
540
|
+
REQUIRE(ruby_value_to_string(facts.get<ruby_value>("ruby")) == "\"override\"");
|
541
|
+
}
|
542
|
+
}
|
543
|
+
GIVEN("a custom fact with the same weight as a built-in fact") {
|
544
|
+
REQUIRE(load_custom_fact("facterversion.rb", facts));
|
545
|
+
THEN("the built-in fact wins") {
|
546
|
+
REQUIRE(ruby_value_to_string(facts["facterversion"]) == "\"" LIBFACTER_VERSION "\"");
|
547
|
+
}
|
548
|
+
}
|
549
|
+
GIVEN("a fact value from the environment") {
|
550
|
+
scoped_env var("FACTER_RuBy", "from environment!");
|
551
|
+
REQUIRE(load_custom_fact("ruby.rb", facts));
|
552
|
+
THEN("the value from the environment wins") {
|
553
|
+
REQUIRE(ruby_value_to_string(facts["ruby"]) == "\"from environment!\"");
|
554
|
+
}
|
555
|
+
}
|
556
|
+
GIVEN("a hash value with non-string keys") {
|
557
|
+
REQUIRE(load_custom_fact("hash_with_non_string_key.rb", facts));
|
558
|
+
THEN("the keys are converted to strings") {
|
559
|
+
REQUIRE(ruby_value_to_string(facts.get<ruby_value>("foo")) == "{\n foo => \"bar\"\n}");
|
560
|
+
}
|
561
|
+
}
|
562
|
+
GIVEN("a fact that requires facter") {
|
563
|
+
REQUIRE(load_custom_fact("facter.rb", facts));
|
564
|
+
THEN("the require succeeds") {
|
565
|
+
REQUIRE(ruby_value_to_string(facts.get<ruby_value>("foo")) == "\"bar\"");
|
566
|
+
}
|
567
|
+
}
|
568
|
+
GIVEN("a fact that has 100 resolutions") {
|
569
|
+
REQUIRE(load_custom_fact("100_resolutions.rb", facts));
|
570
|
+
THEN("the fact evaluates") {
|
571
|
+
REQUIRE(ruby_value_to_string(facts.get<ruby_value>("foo")) == "\"bar\"");
|
572
|
+
}
|
573
|
+
}
|
574
|
+
GIVEN("a fact that has 101 resolutions") {
|
575
|
+
log_capture capture(level::error);
|
576
|
+
REQUIRE_FALSE(load_custom_fact("101_resolutions.rb", facts));
|
577
|
+
THEN("an error is logged") {
|
578
|
+
auto output = capture.result();
|
579
|
+
CAPTURE(output);
|
580
|
+
REQUIRE(re_search(output, boost::regex("ERROR puppetlabs\\.facter - .* fact \"foo\" already has the maximum number of resolutions allowed \\(100\\)")));
|
581
|
+
}
|
582
|
+
}
|
583
|
+
GIVEN("a fact that runs a command outputting to stderr") {
|
584
|
+
REQUIRE(load_custom_fact("stderr_output.rb", facts));
|
585
|
+
THEN("the values should only contain stdout output") {
|
586
|
+
REQUIRE(ruby_value_to_string(facts.get<ruby_value>("first")) == "\"bar\"");
|
587
|
+
REQUIRE(ruby_value_to_string(facts.get<ruby_value>("second")) == "\"bar\"");
|
588
|
+
}
|
589
|
+
}
|
590
|
+
GIVEN("a fact that runs a setcode command that returns no output") {
|
591
|
+
REQUIRE(load_custom_fact("empty_setcode_command.rb", facts));
|
592
|
+
THEN("the fact should not resolve") {
|
593
|
+
REQUIRE_FALSE(facts["foo"]);
|
594
|
+
}
|
595
|
+
}
|
596
|
+
GIVEN("a fact that runs executes nonexistent commands") {
|
597
|
+
REQUIRE(load_custom_fact("nonexistent_command.rb", facts));
|
598
|
+
THEN("the fact should not resolve") {
|
599
|
+
REQUIRE(ruby_value_to_string(facts.get<ruby_value>("first")) == "\"pass\"");
|
600
|
+
REQUIRE_FALSE(facts["second"]);
|
601
|
+
REQUIRE(ruby_value_to_string(facts.get<ruby_value>("third")) == "\"pass\"");
|
602
|
+
}
|
603
|
+
}
|
604
|
+
GIVEN("a fact that executes a command that returns non-zero") {
|
605
|
+
REQUIRE(load_custom_fact("execution_failure.rb", facts));
|
606
|
+
THEN("the fact value should be the command's output") {
|
607
|
+
REQUIRE(ruby_value_to_string(facts.get<ruby_value>("foo")) == "\"bar\"");
|
608
|
+
}
|
609
|
+
}
|
610
|
+
GIVEN("a built-in fact requested multiple times") {
|
611
|
+
REQUIRE(load_custom_fact("single_allocation.rb", facts));
|
612
|
+
THEN("the value should be properly cached between Facter.value calls") {
|
613
|
+
REQUIRE(ruby_value_to_string(facts.get<ruby_value>("foo")) == "true");
|
614
|
+
}
|
615
|
+
}
|
616
|
+
GIVEN("a fact that returns a negative number") {
|
617
|
+
REQUIRE(load_custom_fact("negative_number.rb", facts));
|
618
|
+
THEN("the value should be output as a signed value") {
|
619
|
+
REQUIRE(ruby_value_to_string(facts.get<ruby_value>("foo")) == "-101");
|
620
|
+
}
|
621
|
+
}
|
622
|
+
GIVEN("a fact that returns the exit code of its command") {
|
623
|
+
REQUIRE(load_custom_fact("uses_exit_code.rb", facts));
|
624
|
+
THEN("the value should be the exit code") {
|
625
|
+
REQUIRE(ruby_value_to_string(facts.get<ruby_value>("foo")) == "99");
|
626
|
+
}
|
627
|
+
}
|
628
|
+
GIVEN("a fact that returns a number larger than 32-bits") {
|
629
|
+
REQUIRE(load_custom_fact("bignum_fact_value.rb", facts));
|
630
|
+
THEN("the value should be output correctly") {
|
631
|
+
REQUIRE(ruby_value_to_string(facts.get<ruby_value>("bignum_fact")) == "12345678901");
|
632
|
+
}
|
633
|
+
}
|
634
|
+
}
|