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,54 @@
|
|
1
|
+
#include <catch.hpp>
|
2
|
+
#include <leatherman/execution/execution.hpp>
|
3
|
+
#include <leatherman/util/strings.hpp>
|
4
|
+
#include <boost/algorithm/string.hpp>
|
5
|
+
#include <boost/lexical_cast.hpp>
|
6
|
+
|
7
|
+
using namespace std;
|
8
|
+
using namespace leatherman::execution;
|
9
|
+
|
10
|
+
SCENARIO("executing detached commands with execution::execute") {
|
11
|
+
auto get_ctids = [](string const& input) {
|
12
|
+
vector<int> ctids;
|
13
|
+
leatherman::util::each_line(input, [&ctids](string& line) {
|
14
|
+
try {
|
15
|
+
boost::algorithm::trim(line);
|
16
|
+
ctids.push_back(boost::lexical_cast<int>(line));
|
17
|
+
} catch(boost::bad_lexical_cast const&) {
|
18
|
+
ctids.clear();
|
19
|
+
return false;
|
20
|
+
}
|
21
|
+
return true;
|
22
|
+
});
|
23
|
+
return ctids;
|
24
|
+
};
|
25
|
+
GIVEN("the detached process creation is requested") {
|
26
|
+
THEN("the command is executed in a different process contract than its parent") {
|
27
|
+
auto exec = execute("/bin/sh", { "-c", "ps -o ctid= -p $EXECUTOR_PID,$$" },
|
28
|
+
{ { "EXECUTOR_PID", to_string(getpid()) } },
|
29
|
+
0,
|
30
|
+
{ execution_options::create_detached_process,
|
31
|
+
execution_options::merge_environment,
|
32
|
+
execution_options::redirect_stderr_to_null });
|
33
|
+
REQUIRE(exec.success);
|
34
|
+
REQUIRE(exec.exit_code == 0);
|
35
|
+
auto ctids = get_ctids(exec.output);
|
36
|
+
REQUIRE(ctids.size() == 2); // the ps command returned two CTIDs
|
37
|
+
REQUIRE(ctids[0] != ctids[1]); // the contract IDs are different
|
38
|
+
}
|
39
|
+
}
|
40
|
+
GIVEN("the detached process creation is NOT requested") {
|
41
|
+
THEN("the command is executed in the same process contract as its parent") {
|
42
|
+
auto exec = execute("/bin/sh", { "-c", "ps -o ctid= -p $EXECUTOR_PID,$$" },
|
43
|
+
{ { "EXECUTOR_PID", to_string(getpid()) } },
|
44
|
+
0,
|
45
|
+
{ execution_options::merge_environment,
|
46
|
+
execution_options::redirect_stderr_to_null });
|
47
|
+
REQUIRE(exec.success);
|
48
|
+
REQUIRE(exec.exit_code == 0);
|
49
|
+
auto ctids = get_ctids(exec.output);
|
50
|
+
REQUIRE(ctids.size() == 2); // the ps command returned two CTIDs
|
51
|
+
REQUIRE(ctids[0] == ctids[1]); // the contract IDs are the same
|
52
|
+
}
|
53
|
+
}
|
54
|
+
}
|
@@ -0,0 +1,789 @@
|
|
1
|
+
#include <catch.hpp>
|
2
|
+
#include <leatherman/execution/execution.hpp>
|
3
|
+
#include <leatherman/util/strings.hpp>
|
4
|
+
#include <leatherman/util/scope_exit.hpp>
|
5
|
+
#include <leatherman/util/scoped_env.hpp>
|
6
|
+
#include <leatherman/windows/windows.hpp>
|
7
|
+
#include <boost/algorithm/string.hpp>
|
8
|
+
#include <boost/filesystem.hpp>
|
9
|
+
#include <boost/nowide/fstream.hpp>
|
10
|
+
#include <leatherman/util/regex.hpp>
|
11
|
+
#include "../fixtures.hpp"
|
12
|
+
#include "../log_capture.hpp"
|
13
|
+
#include "../lth_cat.hpp"
|
14
|
+
#include <stdlib.h>
|
15
|
+
|
16
|
+
using namespace std;
|
17
|
+
using namespace leatherman::util;
|
18
|
+
using namespace leatherman::execution;
|
19
|
+
using namespace leatherman::logging;
|
20
|
+
using namespace leatherman::execution::testing;
|
21
|
+
using leatherman::util::scoped_env;
|
22
|
+
using namespace boost::filesystem;
|
23
|
+
|
24
|
+
// Ruby doesn't appear to normalize commands passed to cmd.exe, so neither do we. A utility is provided
|
25
|
+
// here for familiarity in writing unit tests.
|
26
|
+
static string normalize(const char *filepath)
|
27
|
+
{
|
28
|
+
return path(filepath).make_preferred().string();
|
29
|
+
}
|
30
|
+
|
31
|
+
SCENARIO("searching for programs with execution::which") {
|
32
|
+
GIVEN("an absolute path") {
|
33
|
+
THEN("the same path should be returned") {
|
34
|
+
REQUIRE(which(EXEC_TESTS_DIRECTORY "/fixtures/windows/facts.bat")
|
35
|
+
== EXEC_TESTS_DIRECTORY "/fixtures/windows/facts.bat");
|
36
|
+
}
|
37
|
+
}
|
38
|
+
GIVEN("a relative path") {
|
39
|
+
THEN("it should find a file with the same relative offset from a directory on PATH") {
|
40
|
+
REQUIRE(which("windows/facts", { EXEC_TESTS_DIRECTORY "/fixtures" })
|
41
|
+
== EXEC_TESTS_DIRECTORY "/fixtures\\windows/facts.bat");
|
42
|
+
}
|
43
|
+
}
|
44
|
+
GIVEN("a file without an extension") {
|
45
|
+
THEN("it should find a batch file with the same base name") {
|
46
|
+
REQUIRE(which("facts", { EXEC_TESTS_DIRECTORY "/fixtures/windows" })
|
47
|
+
== EXEC_TESTS_DIRECTORY "/fixtures/windows\\facts.bat");
|
48
|
+
}
|
49
|
+
}
|
50
|
+
GIVEN("a file that does not exist") {
|
51
|
+
THEN("an empty string should be returned") {
|
52
|
+
REQUIRE(which("not_on_the_path") == "");
|
53
|
+
}
|
54
|
+
}
|
55
|
+
GIVEN("a file that exists but is not an executable") {
|
56
|
+
THEN("an empty string should be returned") {
|
57
|
+
REQUIRE(which("not_executable", { EXEC_TESTS_DIRECTORY "/fixtures/windows" }) == "");
|
58
|
+
}
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
SCENARIO("expanding command paths with execution::expand_command") {
|
63
|
+
GIVEN("an executable on the PATH") {
|
64
|
+
THEN("the executable is expanded to an absolute path") {
|
65
|
+
REQUIRE(expand_command("facts 1 2 3", { EXEC_TESTS_DIRECTORY "/fixtures/windows" })
|
66
|
+
== EXEC_TESTS_DIRECTORY "/fixtures/windows\\facts.bat 1 2 3");
|
67
|
+
}
|
68
|
+
}
|
69
|
+
GIVEN("a single-quoted command") {
|
70
|
+
THEN("the expanded path should be single-quoted") {
|
71
|
+
REQUIRE(expand_command("'facts' 1 2 3", { EXEC_TESTS_DIRECTORY "/fixtures/windows" })
|
72
|
+
== "'" EXEC_TESTS_DIRECTORY "/fixtures/windows\\facts.bat' 1 2 3");
|
73
|
+
}
|
74
|
+
}
|
75
|
+
GIVEN("a double-quoted command") {
|
76
|
+
THEN("the expanded path should be double-quoted") {
|
77
|
+
REQUIRE(expand_command("\"facts\" 1 2 3", { EXEC_TESTS_DIRECTORY "/fixtures/windows" })
|
78
|
+
== "\"" EXEC_TESTS_DIRECTORY "/fixtures/windows\\facts.bat\" 1 2 3");
|
79
|
+
}
|
80
|
+
}
|
81
|
+
GIVEN("a command not on PATH") {
|
82
|
+
THEN("the returned command is empty") {
|
83
|
+
REQUIRE(expand_command("not_on_the_path") == "");
|
84
|
+
}
|
85
|
+
}
|
86
|
+
GIVEN("a non-executable command on PATH") {
|
87
|
+
THEN("the returned command is empty") {
|
88
|
+
REQUIRE(expand_command("not_executable", { EXEC_TESTS_DIRECTORY "/fixtures/windows" }) == "");
|
89
|
+
}
|
90
|
+
}
|
91
|
+
}
|
92
|
+
|
93
|
+
SCENARIO("executing commands with execution::execute") {
|
94
|
+
auto get_variables = [](string const& input) {
|
95
|
+
map<string, string> variables;
|
96
|
+
leatherman::util::each_line(input, [&](string& line) {
|
97
|
+
vector<string> parts;
|
98
|
+
boost::split(parts, line, boost::is_any_of("="), boost::token_compress_off);
|
99
|
+
if (parts.size() != 2u) {
|
100
|
+
return true;
|
101
|
+
}
|
102
|
+
variables.emplace(make_pair(move(parts[0]), move(parts[1])));
|
103
|
+
return true;
|
104
|
+
});
|
105
|
+
return variables;
|
106
|
+
};
|
107
|
+
std::string spool_dir { EXEC_TESTS_DIRECTORY "/spool" };
|
108
|
+
auto get_file_content = [spool_dir](string const& filename) {
|
109
|
+
string filepath((path(spool_dir) / filename).string());
|
110
|
+
boost::nowide::ifstream strm(filepath.c_str());
|
111
|
+
if (!strm) FAIL("failed to open file: " + filename);
|
112
|
+
string content((istreambuf_iterator<char>(strm)), (istreambuf_iterator<char>()));
|
113
|
+
strm.close();
|
114
|
+
return content;
|
115
|
+
};
|
116
|
+
if (!exists(spool_dir) && !create_directories(spool_dir)) {
|
117
|
+
FAIL("failed to create spool directory");
|
118
|
+
}
|
119
|
+
scope_exit spool_cleaner([spool_dir]() { remove_all(spool_dir); });
|
120
|
+
GIVEN("a command that succeeds") {
|
121
|
+
THEN("the output should be returned") {
|
122
|
+
auto exec = execute("cmd.exe", { "/c", "type", normalize(EXEC_TESTS_DIRECTORY "/fixtures/ls/file3.txt") });
|
123
|
+
REQUIRE(exec.success);
|
124
|
+
REQUIRE(exec.output == "file3");
|
125
|
+
REQUIRE(exec.error == "");
|
126
|
+
REQUIRE(exec.exit_code == 0);
|
127
|
+
}
|
128
|
+
WHEN("the create new process group option is used") {
|
129
|
+
auto exec = execute("cmd.exe", { "/c", "type", normalize(EXEC_TESTS_DIRECTORY "/fixtures/ls/file3.txt") }, 0, { execution_options::trim_output, execution_options::merge_environment, execution_options::redirect_stderr_to_null, execution_options::create_detached_process });
|
130
|
+
REQUIRE(exec.success);
|
131
|
+
REQUIRE(exec.output == "file3");
|
132
|
+
REQUIRE(exec.error == "");
|
133
|
+
REQUIRE(exec.exit_code == 0);
|
134
|
+
}
|
135
|
+
WHEN("expecting input") {
|
136
|
+
auto exec = execute("cmd.exe", { "/c", CMAKE_BIN_DIRECTORY "/lth_cat.exe" }, "hello");
|
137
|
+
REQUIRE(exec.success);
|
138
|
+
REQUIRE(exec.output == "hello");
|
139
|
+
REQUIRE(exec.error == "");
|
140
|
+
REQUIRE(exec.exit_code == 0);
|
141
|
+
}
|
142
|
+
WHEN("expecting input with lots of output") {
|
143
|
+
auto exec = execute("cmd.exe", { "/c", CMAKE_BIN_DIRECTORY "/lth_cat.exe", "prefix", "suffix", "overwhelm", "stderr" },
|
144
|
+
"hello\ngoodbye", 0, { execution_options::merge_environment });
|
145
|
+
REQUIRE(exec.success);
|
146
|
+
auto expected = lth_cat::prefix+lth_cat::overwhelm+"hello\n"+lth_cat::overwhelm+"goodbye\n"+lth_cat::overwhelm+lth_cat::suffix;
|
147
|
+
boost::replace_all(expected, "\n", "\r\n");
|
148
|
+
REQUIRE(exec.output == expected);
|
149
|
+
REQUIRE(exec.error == "hello\r\ngoodbye\r\n");
|
150
|
+
REQUIRE(exec.exit_code == 0);
|
151
|
+
}
|
152
|
+
WHEN("requested to write stdout to file") {
|
153
|
+
string out_file(spool_dir + "/stdout_test.out");
|
154
|
+
auto exec = execute(EXEC_TESTS_DIRECTORY "/fixtures/windows/error_message.bat", {}, "", out_file);
|
155
|
+
REQUIRE(exists(out_file));
|
156
|
+
THEN("stdout is correctly redirected to file") {
|
157
|
+
auto output = get_file_content("stdout_test.out");
|
158
|
+
REQUIRE(output == "foo=bar\nsome more stuff\n");
|
159
|
+
}
|
160
|
+
THEN("the returned results are correct and stdout was not buffered") {
|
161
|
+
REQUIRE(exec.success);
|
162
|
+
REQUIRE(exec.output.empty());
|
163
|
+
REQUIRE(exec.error == "error message!");
|
164
|
+
}
|
165
|
+
}
|
166
|
+
WHEN("requested to write stdout and stderr to the same file with trim") {
|
167
|
+
string out_file(spool_dir + "/stdout_stderr_test.out");
|
168
|
+
auto exec = execute(EXEC_TESTS_DIRECTORY "/fixtures/windows/error_message.bat", {}, "", out_file, "", {}, nullptr, 0, { execution_options::trim_output, execution_options::merge_environment, execution_options::redirect_stderr_to_stdout });
|
169
|
+
REQUIRE(boost::filesystem::exists(out_file));
|
170
|
+
THEN("stdout and stderr are correctly redirected to file") {
|
171
|
+
auto output = get_file_content("stdout_stderr_test.out");
|
172
|
+
REQUIRE(output == "error message!\nfoo=bar\nsome more stuff\n");
|
173
|
+
}
|
174
|
+
THEN("the returned results are correct and out/err streams were not buffered") {
|
175
|
+
REQUIRE(exec.success);
|
176
|
+
REQUIRE(exec.output.empty());
|
177
|
+
REQUIRE(exec.error.empty());
|
178
|
+
}
|
179
|
+
}
|
180
|
+
WHEN("requested to write stdout to a file in an unknown directory") {
|
181
|
+
bool success = false;
|
182
|
+
try {
|
183
|
+
execute("cmd.exe", { "/c", CMAKE_BIN_DIRECTORY "/lth_cat.exe" }, "spam", EXEC_TESTS_DIRECTORY "/spam/eggs/stdout.out");
|
184
|
+
success = true;
|
185
|
+
} catch (...) {
|
186
|
+
// pass
|
187
|
+
}
|
188
|
+
THEN("it fails") {
|
189
|
+
REQUIRE_FALSE(success);
|
190
|
+
}
|
191
|
+
}
|
192
|
+
WHEN("requested to write both stdout and stderr to file without trim") {
|
193
|
+
string out_file(spool_dir + "/stdout_test_b.out");
|
194
|
+
string err_file(spool_dir + "/stderr_test_b.err");
|
195
|
+
auto exec = execute(EXEC_TESTS_DIRECTORY "/fixtures/windows/error_message.bat", {}, "",
|
196
|
+
out_file, err_file, {}, nullptr, 0, lth_util::option_set<execution_options>{});
|
197
|
+
REQUIRE(boost::filesystem::exists(out_file));
|
198
|
+
REQUIRE(boost::filesystem::exists(err_file));
|
199
|
+
THEN("stdout and stderr are correctly redirected to different files") {
|
200
|
+
auto output = get_file_content("stdout_test_b.out");
|
201
|
+
auto error = get_file_content("stderr_test_b.err");
|
202
|
+
REQUIRE(output == "foo=bar\n\nsome more stuff\n");
|
203
|
+
REQUIRE(error == "error message!\n");
|
204
|
+
}
|
205
|
+
THEN("the returned results are correct and out/err streams were not buffered") {
|
206
|
+
REQUIRE(exec.success);
|
207
|
+
REQUIRE(exec.output.empty());
|
208
|
+
REQUIRE(exec.error.empty());
|
209
|
+
}
|
210
|
+
}
|
211
|
+
WHEN("requested to execute a PID callback") {
|
212
|
+
int pid_from_callback = 0;
|
213
|
+
auto exec = execute(EXEC_TESTS_DIRECTORY "/fixtures/windows/error_message.bat", {}, "", {}, [&pid_from_callback](size_t pid) { pid_from_callback = pid; });
|
214
|
+
THEN("the returned results are correct") {
|
215
|
+
REQUIRE(exec.success);
|
216
|
+
REQUIRE(exec.output == "foo=bar\r\n\r\nsome more stuff");
|
217
|
+
REQUIRE(exec.error.empty()); // stderr is redirected to null
|
218
|
+
}
|
219
|
+
THEN("the callback is successfully executed") {
|
220
|
+
REQUIRE(pid_from_callback > 0);
|
221
|
+
}
|
222
|
+
}
|
223
|
+
}
|
224
|
+
GIVEN("a command that fails") {
|
225
|
+
WHEN("default options are used") {
|
226
|
+
auto exec = execute("cmd.exe", { "/c", "dir", "/B", "does_not_exist" });
|
227
|
+
THEN("no output is returned") {
|
228
|
+
REQUIRE_FALSE(exec.success);
|
229
|
+
REQUIRE(exec.output == "");
|
230
|
+
REQUIRE(exec.error == "");
|
231
|
+
REQUIRE(exec.exit_code > 0);
|
232
|
+
}
|
233
|
+
}
|
234
|
+
WHEN("the create new process group option is used") {
|
235
|
+
auto exec = execute("cmd.exe", { "/c", "dir", "/B", "does_not_exist" }, 0, { execution_options::trim_output, execution_options::merge_environment, execution_options::redirect_stderr_to_null, execution_options::create_detached_process });
|
236
|
+
THEN("no output is returned") {
|
237
|
+
REQUIRE_FALSE(exec.success);
|
238
|
+
REQUIRE(exec.output == "");
|
239
|
+
REQUIRE(exec.error == "");
|
240
|
+
REQUIRE(exec.exit_code > 0);
|
241
|
+
}
|
242
|
+
}
|
243
|
+
WHEN("the redirect stderr option is used") {
|
244
|
+
auto exec = execute("cmd.exe", { "/c", "dir", "/B", "does_not_exist" }, 0, { execution_options::trim_output, execution_options::merge_environment, execution_options::redirect_stderr_to_stdout });
|
245
|
+
THEN("error output is returned on stdout") {
|
246
|
+
REQUIRE_FALSE(exec.success);
|
247
|
+
REQUIRE(exec.output == "File Not Found");
|
248
|
+
REQUIRE(exec.error == "");
|
249
|
+
REQUIRE(exec.exit_code > 0);
|
250
|
+
}
|
251
|
+
}
|
252
|
+
WHEN("not redirecting stderr to null") {
|
253
|
+
auto exec = execute("cmd.exe", { "/c", "dir", "/B", "does_not_exist" }, 0, { execution_options::trim_output, execution_options::merge_environment });
|
254
|
+
THEN("error output is returned") {
|
255
|
+
REQUIRE_FALSE(exec.success);
|
256
|
+
REQUIRE(exec.output == "");
|
257
|
+
REQUIRE(exec.error == "File Not Found");
|
258
|
+
REQUIRE(exec.exit_code > 0);
|
259
|
+
}
|
260
|
+
}
|
261
|
+
WHEN("the 'throw on non-zero exit' option is used") {
|
262
|
+
THEN("a child exit exception is thrown") {
|
263
|
+
REQUIRE_THROWS_AS(execute("cmd.exe", { "/c", "dir", "/B", "does_not_exist" }, 0, { execution_options::trim_output, execution_options::merge_environment, execution_options::throw_on_nonzero_exit }), child_exit_exception);
|
264
|
+
}
|
265
|
+
}
|
266
|
+
WHEN("requested to merge the environment") {
|
267
|
+
scoped_env test_var("TEST_INHERITED_VARIABLE", "TEST_INHERITED_VALUE");
|
268
|
+
auto exec = execute("cmd.exe", { "/c", "set" }, { { "TEST_VARIABLE1", "TEST_VALUE1" }, { "TEST_VARIABLE2", "TEST_VALUE2" } });
|
269
|
+
REQUIRE(exec.success);
|
270
|
+
REQUIRE(exec.error == "");
|
271
|
+
auto variables = get_variables(exec.output);
|
272
|
+
THEN("the child environment should contain the given variables") {
|
273
|
+
REQUIRE(variables.size() > 4u);
|
274
|
+
REQUIRE(variables.count("TEST_VARIABLE1") == 1u);
|
275
|
+
REQUIRE(variables["TEST_VARIABLE1"] == "TEST_VALUE1");
|
276
|
+
REQUIRE(variables.count("TEST_VARIABLE1") == 1u);
|
277
|
+
REQUIRE(variables["TEST_VARIABLE1"] == "TEST_VALUE1");
|
278
|
+
}
|
279
|
+
THEN("the child environment should have LC_ALL and LANG set to C") {
|
280
|
+
REQUIRE(variables.count("LC_ALL") == 1u);
|
281
|
+
REQUIRE(variables["LC_ALL"] == "C");
|
282
|
+
REQUIRE(variables.count("LANG") == 1u);
|
283
|
+
REQUIRE(variables["LANG"] == "C");
|
284
|
+
}
|
285
|
+
}
|
286
|
+
WHEN("requested to override the environment") {
|
287
|
+
scoped_env test_var("TEST_INHERITED_VARIABLE", "TEST_INHERITED_VALUE");
|
288
|
+
auto exec = execute("cmd.exe", { "/c", "set" }, { { "TEST_VARIABLE1", "TEST_VALUE1" }, { "TEST_VARIABLE2", "TEST_VALUE2" } }, 0, { execution_options::trim_output });
|
289
|
+
REQUIRE(exec.success);
|
290
|
+
REQUIRE(exec.error == "");
|
291
|
+
auto variables = get_variables(exec.output);
|
292
|
+
THEN("the child environment should only contain the given variables") {
|
293
|
+
REQUIRE(variables.count("TEST_VARIABLE1") == 1u);
|
294
|
+
REQUIRE(variables["TEST_VARIABLE1"] == "TEST_VALUE1");
|
295
|
+
REQUIRE(variables.count("TEST_VARIABLE1") == 1u);
|
296
|
+
REQUIRE(variables["TEST_VARIABLE1"] == "TEST_VALUE1");
|
297
|
+
}
|
298
|
+
THEN("the child environment should have LC_ALL and LANG set to C") {
|
299
|
+
REQUIRE(variables.count("LC_ALL") == 1u);
|
300
|
+
REQUIRE(variables["LC_ALL"] == "C");
|
301
|
+
REQUIRE(variables.count("LANG") == 1u);
|
302
|
+
REQUIRE(variables["LANG"] == "C");
|
303
|
+
}
|
304
|
+
}
|
305
|
+
WHEN("requested to override LC_ALL or LANG") {
|
306
|
+
auto exec = execute("cmd.exe", { "/c", "set" }, { { "LANG", "FOO" }, { "LC_ALL", "BAR" } });
|
307
|
+
REQUIRE(exec.success);
|
308
|
+
REQUIRE(exec.error == "");
|
309
|
+
auto variables = get_variables(exec.output);
|
310
|
+
THEN("the values should be passed to the child process") {
|
311
|
+
REQUIRE(variables.count("LC_ALL") == 1u);
|
312
|
+
REQUIRE(variables["LC_ALL"] == "BAR");
|
313
|
+
REQUIRE(variables.count("LANG") == 1u);
|
314
|
+
REQUIRE(variables["LANG"] == "FOO");
|
315
|
+
}
|
316
|
+
}
|
317
|
+
}
|
318
|
+
GIVEN("a command that outputs leading/trailing whitespace") {
|
319
|
+
THEN("whitespace should be trimmed by default") {
|
320
|
+
auto exec = execute("cmd.exe", { "/c", "type", normalize(EXEC_TESTS_DIRECTORY "/fixtures/ls/file1.txt") });
|
321
|
+
REQUIRE(exec.success);
|
322
|
+
REQUIRE(exec.output == "this is a test of trimming");
|
323
|
+
REQUIRE(exec.error == "");
|
324
|
+
}
|
325
|
+
WHEN("the 'trim whitespace' option is not used") {
|
326
|
+
auto exec = execute("cmd.exe", { "/c", "type", normalize(EXEC_TESTS_DIRECTORY "/fixtures/ls/file1.txt") }, 0, { execution_options::merge_environment });
|
327
|
+
REQUIRE(exec.success);
|
328
|
+
THEN("whitespace should not be trimmed") {
|
329
|
+
REQUIRE(exec.output == " this is a test of trimming ");
|
330
|
+
REQUIRE(exec.error == "");
|
331
|
+
}
|
332
|
+
}
|
333
|
+
}
|
334
|
+
GIVEN("a long-running command") {
|
335
|
+
WHEN("given a timeout") {
|
336
|
+
THEN("a timeout exception should be thrown") {
|
337
|
+
string ruby = which("ruby.exe");
|
338
|
+
if (ruby.empty()) {
|
339
|
+
WARN("skipping command timeout test because no ruby was found on the PATH.");
|
340
|
+
return;
|
341
|
+
}
|
342
|
+
|
343
|
+
try {
|
344
|
+
execute("cmd.exe", { "/c", "ruby.exe", "-e", "sleep 60" }, 1);
|
345
|
+
FAIL("did not throw timeout exception");
|
346
|
+
} catch (timeout_exception const& ex) {
|
347
|
+
// Verify the process was killed
|
348
|
+
REQUIRE(OpenProcess(0, FALSE, ex.pid()) == nullptr);
|
349
|
+
} catch (exception const&) {
|
350
|
+
FAIL("unexpected exception thrown");
|
351
|
+
}
|
352
|
+
}
|
353
|
+
}
|
354
|
+
}
|
355
|
+
GIVEN("stderr is redirected to null") {
|
356
|
+
WHEN("using a debug log level") {
|
357
|
+
log_capture capture(log_level::debug);
|
358
|
+
auto exec = execute(EXEC_TESTS_DIRECTORY "/fixtures/windows/error_message.bat");
|
359
|
+
REQUIRE(exec.success);
|
360
|
+
REQUIRE(exec.output == "foo=bar\r\n\r\nsome more stuff");
|
361
|
+
REQUIRE(exec.error.empty());
|
362
|
+
THEN("stderr is logged") {
|
363
|
+
auto output = capture.result();
|
364
|
+
CAPTURE(output);
|
365
|
+
REQUIRE(re_search(output, boost::regex("DEBUG !!! - error message!")));
|
366
|
+
}
|
367
|
+
}
|
368
|
+
WHEN("not using a debug log level") {
|
369
|
+
log_capture capture(log_level::warning);
|
370
|
+
auto exec = execute(EXEC_TESTS_DIRECTORY "/fixtures/windows/error_message.bat");
|
371
|
+
REQUIRE(exec.success);
|
372
|
+
REQUIRE(exec.output == "foo=bar\r\n\r\nsome more stuff");
|
373
|
+
REQUIRE(exec.error.empty());
|
374
|
+
THEN("stderr is not logged") {
|
375
|
+
auto output = capture.result();
|
376
|
+
CAPTURE(output);
|
377
|
+
REQUIRE_FALSE(re_search(output, boost::regex("DEBUG !!! - error message!")));
|
378
|
+
}
|
379
|
+
}
|
380
|
+
}
|
381
|
+
GIVEN("a command that outputs windows-style newlines") {
|
382
|
+
// These are the default options so that I don't override them.
|
383
|
+
lth_util::option_set<execution_options> options = { execution_options::trim_output, execution_options::merge_environment, execution_options::redirect_stderr_to_null };
|
384
|
+
WHEN("newlines are not normalized") {
|
385
|
+
auto exec = execute("cmd.exe", { "/c", "type", normalize(EXEC_TESTS_DIRECTORY "/fixtures/ls/crlf.txt") }, 0, options);
|
386
|
+
REQUIRE(exec.success);
|
387
|
+
REQUIRE(exec.error == "");
|
388
|
+
REQUIRE(exec.output.find('\r') != std::string::npos);
|
389
|
+
}
|
390
|
+
WHEN("requested to normalize newlines") {
|
391
|
+
auto exec = execute("cmd.exe", { "/c", "type", normalize(EXEC_TESTS_DIRECTORY "/fixtures/ls/crlf.txt") }, 0, options | option_set<execution_options>{ execution_options::convert_newlines });
|
392
|
+
REQUIRE(exec.success);
|
393
|
+
REQUIRE(exec.error == "");
|
394
|
+
REQUIRE(exec.output.find('\r') == std::string::npos);
|
395
|
+
}
|
396
|
+
}
|
397
|
+
}
|
398
|
+
|
399
|
+
SCENARIO("executing commands with leatherman::execution::each_line") {
|
400
|
+
GIVEN("a command that succeeds") {
|
401
|
+
THEN("each line of output should be returned") {
|
402
|
+
vector<string> lines;
|
403
|
+
bool success = leatherman::execution::each_line(
|
404
|
+
"cmd.exe",
|
405
|
+
{
|
406
|
+
"/c",
|
407
|
+
"type",
|
408
|
+
normalize(EXEC_TESTS_DIRECTORY "/fixtures/ls/file4.txt")
|
409
|
+
},
|
410
|
+
[&](string& line) {
|
411
|
+
lines.push_back(line);
|
412
|
+
return true;
|
413
|
+
});
|
414
|
+
REQUIRE(success);
|
415
|
+
REQUIRE(lines.size() == 4u);
|
416
|
+
REQUIRE(lines[0] == "line1");
|
417
|
+
REQUIRE(lines[1] == "line2");
|
418
|
+
REQUIRE(lines[2] == "line3");
|
419
|
+
REQUIRE(lines[3] == "line4");
|
420
|
+
}
|
421
|
+
WHEN("output stops when false is returned from callback") {
|
422
|
+
vector<string> lines;
|
423
|
+
bool success = leatherman::execution::each_line(
|
424
|
+
"cmd.exe",
|
425
|
+
{
|
426
|
+
"/c",
|
427
|
+
"type",
|
428
|
+
normalize(EXEC_TESTS_DIRECTORY "/fixtures/ls/file4.txt")
|
429
|
+
},
|
430
|
+
[&](string& line) {
|
431
|
+
lines.push_back(line);
|
432
|
+
return false;
|
433
|
+
});
|
434
|
+
REQUIRE(success);
|
435
|
+
REQUIRE(lines.size() == 1u);
|
436
|
+
REQUIRE(lines[0] == "line1");
|
437
|
+
}
|
438
|
+
WHEN("requested to merge the environment") {
|
439
|
+
scoped_env test_var("TEST_INHERITED_VARIABLE", "TEST_INHERITED_VALUE");
|
440
|
+
map<string, string> variables;
|
441
|
+
bool success = each_line(
|
442
|
+
"cmd.exe",
|
443
|
+
{
|
444
|
+
"/c",
|
445
|
+
"set"
|
446
|
+
},
|
447
|
+
{
|
448
|
+
{"TEST_VARIABLE1", "TEST_VALUE1" },
|
449
|
+
{"TEST_VARIABLE2", "TEST_VALUE2" }
|
450
|
+
},
|
451
|
+
[&](string& line) {
|
452
|
+
vector<string> parts;
|
453
|
+
boost::split(parts, line, boost::is_any_of("="), boost::token_compress_off);
|
454
|
+
if (parts.size() != 2u) {
|
455
|
+
return true;
|
456
|
+
}
|
457
|
+
variables.emplace(make_pair(move(parts[0]), move(parts[1])));
|
458
|
+
return true;
|
459
|
+
});
|
460
|
+
REQUIRE(success);
|
461
|
+
THEN("the child environment should contain the given variables") {
|
462
|
+
REQUIRE(variables.size() > 4u);
|
463
|
+
REQUIRE(variables.count("TEST_VARIABLE1") == 1u);
|
464
|
+
REQUIRE(variables["TEST_VARIABLE1"] == "TEST_VALUE1");
|
465
|
+
REQUIRE(variables.count("TEST_VARIABLE1") == 1u);
|
466
|
+
REQUIRE(variables["TEST_VARIABLE1"] == "TEST_VALUE1");
|
467
|
+
}
|
468
|
+
THEN("the child environment should have LC_ALL and LANG set to C") {
|
469
|
+
REQUIRE(variables.count("LC_ALL") == 1u);
|
470
|
+
REQUIRE(variables["LC_ALL"] == "C");
|
471
|
+
REQUIRE(variables.count("LANG") == 1u);
|
472
|
+
REQUIRE(variables["LANG"] == "C");
|
473
|
+
}
|
474
|
+
}
|
475
|
+
WHEN("requested to override the environment") {
|
476
|
+
scoped_env test_var("TEST_INHERITED_VARIABLE", "TEST_INHERITED_VALUE");
|
477
|
+
map<string, string> variables;
|
478
|
+
bool success = each_line(
|
479
|
+
"cmd.exe",
|
480
|
+
{
|
481
|
+
"/c",
|
482
|
+
"set"
|
483
|
+
},
|
484
|
+
{
|
485
|
+
{"TEST_VARIABLE1", "TEST_VALUE1" },
|
486
|
+
{"TEST_VARIABLE2", "TEST_VALUE2" }
|
487
|
+
},
|
488
|
+
[&](string& line) {
|
489
|
+
vector<string> parts;
|
490
|
+
boost::split(parts, line, boost::is_any_of("="), boost::token_compress_off);
|
491
|
+
if (parts.size() != 2u) {
|
492
|
+
return true;
|
493
|
+
}
|
494
|
+
variables.emplace(make_pair(move(parts[0]), move(parts[1])));
|
495
|
+
return true;
|
496
|
+
},
|
497
|
+
nullptr,
|
498
|
+
0,
|
499
|
+
{
|
500
|
+
execution_options::trim_output
|
501
|
+
});
|
502
|
+
REQUIRE(success);
|
503
|
+
THEN("the child environment should only contain the given variables") {
|
504
|
+
// Windows adds several extra variables, such as COMSPEC, PATHEXT, and PROMPT.
|
505
|
+
// Leave some buffer room for future additions, while ensuring we don't include
|
506
|
+
// everything.
|
507
|
+
REQUIRE(variables.size() < 10u);
|
508
|
+
REQUIRE(variables.count("TEST_VARIABLE1") == 1u);
|
509
|
+
REQUIRE(variables["TEST_VARIABLE1"] == "TEST_VALUE1");
|
510
|
+
REQUIRE(variables.count("TEST_VARIABLE1") == 1u);
|
511
|
+
REQUIRE(variables["TEST_VARIABLE1"] == "TEST_VALUE1");
|
512
|
+
REQUIRE(variables.count("TEST_INHERITED_VARIABLE") == 0u);
|
513
|
+
}
|
514
|
+
THEN("the child environment should have LC_ALL and LANG set to C") {
|
515
|
+
REQUIRE(variables.count("LC_ALL") == 1u);
|
516
|
+
REQUIRE(variables["LC_ALL"] == "C");
|
517
|
+
REQUIRE(variables.count("LANG") == 1u);
|
518
|
+
REQUIRE(variables["LANG"] == "C");
|
519
|
+
}
|
520
|
+
}
|
521
|
+
WHEN("requested to override LC_ALL or LANG") {
|
522
|
+
map<string, string> variables;
|
523
|
+
bool success = each_line(
|
524
|
+
"cmd.exe",
|
525
|
+
{
|
526
|
+
"/c",
|
527
|
+
"set"
|
528
|
+
},
|
529
|
+
{
|
530
|
+
{"LANG", "FOO" },
|
531
|
+
{ "LC_ALL", "BAR" }
|
532
|
+
},
|
533
|
+
[&](string& line) {
|
534
|
+
vector<string> parts;
|
535
|
+
boost::split(parts, line, boost::is_any_of("="), boost::token_compress_off);
|
536
|
+
if (parts.size() != 2u) {
|
537
|
+
return true;
|
538
|
+
}
|
539
|
+
variables.emplace(make_pair(move(parts[0]), move(parts[1])));
|
540
|
+
return true;
|
541
|
+
});
|
542
|
+
REQUIRE(success);
|
543
|
+
THEN("the values should be passed to the child process") {
|
544
|
+
REQUIRE(variables.count("LC_ALL") == 1u);
|
545
|
+
REQUIRE(variables["LC_ALL"] == "BAR");
|
546
|
+
REQUIRE(variables.count("LANG") == 1u);
|
547
|
+
REQUIRE(variables["LANG"] == "FOO");
|
548
|
+
}
|
549
|
+
}
|
550
|
+
WHEN("requested to inherit locale") {
|
551
|
+
scoped_env test_var("TEST_INHERITED_VARIABLE", "TEST_INHERITED_VALUE");
|
552
|
+
scoped_env lc_all("LC_ALL", "en_US.UTF-8");
|
553
|
+
scoped_env lang("LANG", "en_US.UTF-8");
|
554
|
+
map<string, string> variables;
|
555
|
+
bool success = each_line(
|
556
|
+
"cmd.exe",
|
557
|
+
{
|
558
|
+
"/c",
|
559
|
+
"set"
|
560
|
+
},
|
561
|
+
[&](string& line) {
|
562
|
+
vector<string> parts;
|
563
|
+
boost::split(parts, line, boost::is_any_of("="), boost::token_compress_off);
|
564
|
+
if (parts.size() != 2u) {
|
565
|
+
return true;
|
566
|
+
}
|
567
|
+
variables.emplace(make_pair(move(parts[0]), move(parts[1])));
|
568
|
+
return true;
|
569
|
+
},
|
570
|
+
nullptr,
|
571
|
+
0,
|
572
|
+
{
|
573
|
+
execution_options::trim_output,
|
574
|
+
execution_options::inherit_locale
|
575
|
+
});
|
576
|
+
REQUIRE(success);
|
577
|
+
THEN("the child environment should only have LC_ALL and LANG set to en_US.UTF-8") {
|
578
|
+
// Windows adds several extra variables, such as COMSPEC, PATHEXT, and PROMPT.
|
579
|
+
// Leave some buffer room for future additions, while ensuring we don't include
|
580
|
+
// everything.
|
581
|
+
REQUIRE(variables.size() < 10u);
|
582
|
+
REQUIRE(variables.count("LC_ALL") == 1u);
|
583
|
+
REQUIRE(variables["LC_ALL"] == "en_US.UTF-8");
|
584
|
+
REQUIRE(variables.count("LANG") == 1u);
|
585
|
+
REQUIRE(variables["LANG"] == "en_US.UTF-8");
|
586
|
+
REQUIRE(variables.count("TEST_INHERITED_VARIABLE") == 0u);
|
587
|
+
}
|
588
|
+
}
|
589
|
+
WHEN("requested to inherit locale with no locale set") {
|
590
|
+
scoped_env test_var("TEST_INHERITED_VARIABLE", "TEST_INHERITED_VALUE");
|
591
|
+
scoped_env lc_all("LC_ALL");
|
592
|
+
scoped_env lang("LANG");
|
593
|
+
map<string, string> variables;
|
594
|
+
bool success = each_line(
|
595
|
+
"cmd.exe",
|
596
|
+
{
|
597
|
+
"/c",
|
598
|
+
"set"
|
599
|
+
},
|
600
|
+
[&](string& line) {
|
601
|
+
vector<string> parts;
|
602
|
+
boost::split(parts, line, boost::is_any_of("="), boost::token_compress_off);
|
603
|
+
if (parts.size() != 2u) {
|
604
|
+
return true;
|
605
|
+
}
|
606
|
+
variables.emplace(make_pair(move(parts[0]), move(parts[1])));
|
607
|
+
return true;
|
608
|
+
},
|
609
|
+
nullptr,
|
610
|
+
0,
|
611
|
+
{
|
612
|
+
execution_options::trim_output,
|
613
|
+
execution_options::inherit_locale
|
614
|
+
});
|
615
|
+
REQUIRE(success);
|
616
|
+
THEN("the child environment should only have LC_ALL and LANG set to en_US.UTF-8") {
|
617
|
+
// Windows adds several extra variables, such as COMSPEC, PATHEXT, and PROMPT.
|
618
|
+
// Leave some buffer room for future additions, while ensuring we don't include
|
619
|
+
// everything.
|
620
|
+
REQUIRE(variables.size() < 8u);
|
621
|
+
REQUIRE(variables.count("LC_ALL") == 0u);
|
622
|
+
REQUIRE(variables.count("LANG") == 0u);
|
623
|
+
REQUIRE(variables.count("TEST_INHERITED_VARIABLE") == 0u);
|
624
|
+
}
|
625
|
+
}
|
626
|
+
WHEN("requested to inherit locale with parent environment") {
|
627
|
+
scoped_env test_var("TEST_INHERITED_VARIABLE", "TEST_INHERITED_VALUE");
|
628
|
+
scoped_env lc_all("LC_ALL", "en_US.UTF-8");
|
629
|
+
scoped_env lang("LANG", "en_US.UTF-8");
|
630
|
+
map<string, string> variables;
|
631
|
+
bool success = each_line(
|
632
|
+
"cmd.exe",
|
633
|
+
{
|
634
|
+
"/c",
|
635
|
+
"set"
|
636
|
+
},
|
637
|
+
[&](string& line) {
|
638
|
+
vector<string> parts;
|
639
|
+
boost::split(parts, line, boost::is_any_of("="), boost::token_compress_off);
|
640
|
+
if (parts.size() != 2u) {
|
641
|
+
return true;
|
642
|
+
}
|
643
|
+
variables.emplace(make_pair(move(parts[0]), move(parts[1])));
|
644
|
+
return true;
|
645
|
+
},
|
646
|
+
nullptr,
|
647
|
+
0,
|
648
|
+
{
|
649
|
+
execution_options::trim_output,
|
650
|
+
execution_options::merge_environment,
|
651
|
+
execution_options::inherit_locale
|
652
|
+
});
|
653
|
+
REQUIRE(success);
|
654
|
+
THEN("the child environment should contain the merged variables") {
|
655
|
+
REQUIRE(variables.size() > 3u);
|
656
|
+
REQUIRE(variables.count("TEST_INHERITED_VARIABLE") == 1);
|
657
|
+
REQUIRE(variables["TEST_INHERITED_VARIABLE"] == "TEST_INHERITED_VALUE");
|
658
|
+
}
|
659
|
+
THEN("the child environment should have LC_ALL and LANG set to en_US.UTF-8") {
|
660
|
+
REQUIRE(variables.count("LC_ALL") == 1u);
|
661
|
+
REQUIRE(variables["LC_ALL"] == "en_US.UTF-8");
|
662
|
+
REQUIRE(variables.count("LANG") == 1u);
|
663
|
+
REQUIRE(variables["LANG"] == "en_US.UTF-8");
|
664
|
+
}
|
665
|
+
}
|
666
|
+
}
|
667
|
+
GIVEN("a command that fails") {
|
668
|
+
WHEN("default options are used") {
|
669
|
+
THEN("no output is returned") {
|
670
|
+
auto success = leatherman::execution::each_line(
|
671
|
+
"cmd.exe",
|
672
|
+
{
|
673
|
+
"/c",
|
674
|
+
"dir",
|
675
|
+
"/B",
|
676
|
+
"does_not_exist"
|
677
|
+
},
|
678
|
+
[](string& line) {
|
679
|
+
FAIL("should not be called");
|
680
|
+
return true;
|
681
|
+
});
|
682
|
+
REQUIRE_FALSE(success);
|
683
|
+
}
|
684
|
+
}
|
685
|
+
WHEN("the redirect stderr option is used") {
|
686
|
+
string output;
|
687
|
+
auto result = leatherman::execution::each_line(
|
688
|
+
"cmd.exe",
|
689
|
+
{
|
690
|
+
"/c",
|
691
|
+
"dir",
|
692
|
+
"/B",
|
693
|
+
"does_not_exist"
|
694
|
+
},
|
695
|
+
[&](string& line) {
|
696
|
+
if (!output.empty()) {
|
697
|
+
output += "\n";
|
698
|
+
}
|
699
|
+
output += line;
|
700
|
+
return true;
|
701
|
+
},
|
702
|
+
[&](string&) {
|
703
|
+
FAIL("should not be called");
|
704
|
+
return true;
|
705
|
+
},
|
706
|
+
0,
|
707
|
+
{
|
708
|
+
execution_options::trim_output,
|
709
|
+
execution_options::merge_environment,
|
710
|
+
execution_options::redirect_stderr_to_stdout
|
711
|
+
});
|
712
|
+
THEN("error output is returned on stdout") {
|
713
|
+
REQUIRE_FALSE(result);
|
714
|
+
REQUIRE(output == "File Not Found");
|
715
|
+
}
|
716
|
+
}
|
717
|
+
WHEN("not redirecting stderr to null") {
|
718
|
+
string output;
|
719
|
+
auto result = leatherman::execution::each_line(
|
720
|
+
"cmd.exe",
|
721
|
+
{
|
722
|
+
"/c",
|
723
|
+
"dir",
|
724
|
+
"/B",
|
725
|
+
"does_not_exist"
|
726
|
+
},
|
727
|
+
[&](string&) {
|
728
|
+
FAIL("should not be called.");
|
729
|
+
return true;
|
730
|
+
},
|
731
|
+
[&](string& line) {
|
732
|
+
if (!output.empty()) {
|
733
|
+
output += "\n";
|
734
|
+
}
|
735
|
+
output += line;
|
736
|
+
return true;
|
737
|
+
});
|
738
|
+
THEN("error output is returned") {
|
739
|
+
REQUIRE_FALSE(result);
|
740
|
+
REQUIRE(output == "File Not Found");
|
741
|
+
}
|
742
|
+
}
|
743
|
+
WHEN("the 'throw on non-zero exit' option is used") {
|
744
|
+
THEN("a child exit exception is thrown") {
|
745
|
+
REQUIRE_THROWS_AS(each_line("cmd.exe", { "/c", "dir", "/B", "does_not_exist" }, nullptr, nullptr, 0, {execution_options::trim_output, execution_options::merge_environment, execution_options::throw_on_nonzero_exit}), child_exit_exception);
|
746
|
+
}
|
747
|
+
}
|
748
|
+
}
|
749
|
+
GIVEN("a long-running command") {
|
750
|
+
WHEN("given a timeout") {
|
751
|
+
THEN("a timeout exception should be thrown") {
|
752
|
+
string ruby = which("ruby.exe");
|
753
|
+
if (ruby.empty()) {
|
754
|
+
WARN("skipping command timeout test because no ruby was found on the PATH.");
|
755
|
+
return;
|
756
|
+
}
|
757
|
+
try {
|
758
|
+
each_line("cmd.exe", { "/c", "ruby.exe", "-e", "sleep 60" }, nullptr, nullptr, 1);
|
759
|
+
FAIL("did not throw timeout exception");
|
760
|
+
} catch (timeout_exception const& ex) {
|
761
|
+
// Verify the process was killed
|
762
|
+
REQUIRE(OpenProcess(0, FALSE, ex.pid()) == nullptr);
|
763
|
+
} catch (exception const&) {
|
764
|
+
FAIL("unexpected exception thrown");
|
765
|
+
}
|
766
|
+
}
|
767
|
+
}
|
768
|
+
}
|
769
|
+
GIVEN("stderr is redirected to null") {
|
770
|
+
WHEN("using a debug log level") {
|
771
|
+
log_capture capture(log_level::debug);
|
772
|
+
REQUIRE(leatherman::execution::each_line(EXEC_TESTS_DIRECTORY "/fixtures/windows/error_message.bat", nullptr));
|
773
|
+
THEN("stderr is logged") {
|
774
|
+
auto output = capture.result();
|
775
|
+
CAPTURE(output);
|
776
|
+
REQUIRE(re_search(output, boost::regex("DEBUG !!! - error message!")));
|
777
|
+
}
|
778
|
+
}
|
779
|
+
WHEN("not using a debug log level") {
|
780
|
+
log_capture capture(log_level::warning);
|
781
|
+
REQUIRE(leatherman::execution::each_line(EXEC_TESTS_DIRECTORY "/fixtures/windows/error_message.bat", nullptr));
|
782
|
+
THEN("stderr is not logged") {
|
783
|
+
auto output = capture.result();
|
784
|
+
CAPTURE(output);
|
785
|
+
REQUIRE_FALSE(re_search(output, boost::regex("DEBUG !!! - error message!")));
|
786
|
+
}
|
787
|
+
}
|
788
|
+
}
|
789
|
+
}
|