puppet 6.11.1-x86-mingw32 → 6.16.0-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CODEOWNERS +3 -8
- data/CONTRIBUTING.md +7 -13
- data/Gemfile +1 -0
- data/Gemfile.lock +39 -36
- data/README.md +17 -24
- data/ext/build_defaults.yaml +1 -0
- data/ext/project_data.yaml +1 -1
- data/ext/windows/service/daemon.rb +25 -20
- data/lib/puppet.rb +52 -13
- data/lib/puppet/agent.rb +20 -14
- data/lib/puppet/application/agent.rb +12 -14
- data/lib/puppet/application/describe.rb +7 -5
- data/lib/puppet/application/device.rb +2 -2
- data/lib/puppet/application/filebucket.rb +19 -15
- data/lib/puppet/application/plugin.rb +1 -0
- data/lib/puppet/application/resource.rb +1 -1
- data/lib/puppet/application/ssl.rb +4 -4
- data/lib/puppet/concurrent.rb +2 -0
- data/lib/puppet/concurrent/lock.rb +16 -0
- data/lib/puppet/concurrent/synchronized.rb +15 -0
- data/lib/puppet/concurrent/thread_local_singleton.rb +14 -0
- data/lib/puppet/configurer.rb +85 -83
- data/lib/puppet/configurer/plugin_handler.rb +10 -1
- data/lib/puppet/context/trusted_information.rb +14 -8
- data/lib/puppet/daemon.rb +13 -27
- data/lib/puppet/defaults.rb +158 -40
- data/lib/puppet/environments.rb +30 -20
- data/lib/puppet/error.rb +9 -1
- data/lib/puppet/face/facts.rb +8 -5
- data/lib/puppet/face/help.rb +29 -3
- data/lib/puppet/face/module/search.rb +5 -0
- data/lib/puppet/face/plugin.rb +2 -2
- data/lib/puppet/file_serving/http_metadata.rb +1 -1
- data/lib/puppet/file_system/file_impl.rb +13 -9
- data/lib/puppet/file_system/memory_file.rb +6 -0
- data/lib/puppet/file_system/memory_impl.rb +13 -0
- data/lib/puppet/file_system/uniquefile.rb +4 -0
- data/lib/puppet/file_system/windows.rb +7 -10
- data/lib/puppet/forge.rb +3 -3
- data/lib/puppet/forge/errors.rb +2 -2
- data/lib/puppet/forge/repository.rb +31 -86
- data/lib/puppet/functions/call.rb +1 -1
- data/lib/puppet/functions/camelcase.rb +2 -2
- data/lib/puppet/functions/epp.rb +4 -4
- data/lib/puppet/functions/eyaml_lookup_key.rb +13 -8
- data/lib/puppet/functions/filter.rb +1 -0
- data/lib/puppet/functions/find_file.rb +9 -9
- data/lib/puppet/functions/find_template.rb +63 -0
- data/lib/puppet/functions/inline_epp.rb +5 -5
- data/lib/puppet/functions/reduce.rb +2 -4
- data/lib/puppet/http.rb +7 -0
- data/lib/puppet/http/client.rb +341 -54
- data/lib/puppet/http/errors.rb +2 -0
- data/lib/puppet/http/external_client.rb +90 -0
- data/lib/puppet/http/redirector.rb +34 -0
- data/lib/puppet/http/resolver.rb +57 -1
- data/lib/puppet/http/resolver/server_list.rb +98 -0
- data/lib/puppet/http/resolver/settings.rb +23 -2
- data/lib/puppet/http/resolver/srv.rb +36 -4
- data/lib/puppet/http/response.rb +68 -1
- data/lib/puppet/http/retry_after_handler.rb +39 -0
- data/lib/puppet/http/service.rb +179 -3
- data/lib/puppet/http/service/ca.rb +84 -21
- data/lib/puppet/http/service/compiler.rb +319 -0
- data/lib/puppet/http/service/file_server.rb +206 -0
- data/lib/puppet/http/service/report.rb +66 -0
- data/lib/puppet/http/session.rb +106 -31
- data/lib/puppet/indirector/catalog/compiler.rb +10 -0
- data/lib/puppet/indirector/catalog/rest.rb +34 -0
- data/lib/puppet/indirector/facts/rest.rb +42 -0
- data/lib/puppet/indirector/file_bucket_file/file.rb +1 -1
- data/lib/puppet/indirector/file_bucket_file/rest.rb +48 -0
- data/lib/puppet/indirector/file_content/http.rb +5 -0
- data/lib/puppet/indirector/file_content/rest.rb +30 -0
- data/lib/puppet/indirector/file_metadata/http.rb +4 -4
- data/lib/puppet/indirector/file_metadata/rest.rb +52 -0
- data/lib/puppet/indirector/json.rb +1 -1
- data/lib/puppet/indirector/msgpack.rb +1 -1
- data/lib/puppet/indirector/node/rest.rb +24 -0
- data/lib/puppet/indirector/report/rest.rb +19 -0
- data/lib/puppet/indirector/report/yaml.rb +23 -0
- data/lib/puppet/indirector/rest.rb +12 -0
- data/lib/puppet/indirector/status/rest.rb +18 -0
- data/lib/puppet/loaders.rb +6 -0
- data/lib/puppet/metatype/manager.rb +80 -80
- data/lib/puppet/network/http/base_pool.rb +19 -1
- data/lib/puppet/network/http/compression.rb +7 -0
- data/lib/puppet/network/http/connection.rb +6 -0
- data/lib/puppet/network/http/connection_adapter.rb +182 -0
- data/lib/puppet/network/http/nocache_pool.rb +2 -0
- data/lib/puppet/network/http/pool.rb +13 -6
- data/lib/puppet/network/http_pool.rb +2 -1
- data/lib/puppet/node/environment.rb +24 -8
- data/lib/puppet/pal/catalog_compiler.rb +5 -0
- data/lib/puppet/pal/pal_impl.rb +9 -29
- data/lib/puppet/parser/ast/pops_bridge.rb +6 -11
- data/lib/puppet/parser/compiler.rb +42 -32
- data/lib/puppet/parser/functions.rb +18 -13
- data/lib/puppet/parser/functions/epp.rb +3 -3
- data/lib/puppet/parser/functions/filter.rb +1 -0
- data/lib/puppet/parser/functions/inline_epp.rb +5 -5
- data/lib/puppet/pops/evaluator/access_operator.rb +2 -2
- data/lib/puppet/pops/evaluator/evaluator_impl.rb +1 -1
- data/lib/puppet/pops/evaluator/runtime3_support.rb +1 -1
- data/lib/puppet/pops/loader/puppet_plan_instantiator.rb +12 -3
- data/lib/puppet/pops/loaders.rb +7 -5
- data/lib/puppet/pops/lookup/invocation.rb +10 -3
- data/lib/puppet/pops/model/pn_transformer.rb +5 -9
- data/lib/puppet/pops/parser/evaluating_parser.rb +8 -11
- data/lib/puppet/pops/serialization/json_path.rb +3 -3
- data/lib/puppet/pops/time/timespan.rb +3 -5
- data/lib/puppet/pops/types/p_object_type_extension.rb +10 -0
- data/lib/puppet/pops/types/string_converter.rb +6 -9
- data/lib/puppet/pops/types/type_calculator.rb +30 -10
- data/lib/puppet/pops/types/type_formatter.rb +9 -11
- data/lib/puppet/pops/types/type_parser.rb +3 -3
- data/lib/puppet/pops/validation/checker4_0.rb +1 -1
- data/lib/puppet/pops/validation/tasks_checker.rb +5 -1
- data/lib/puppet/provider/aix_object.rb +4 -2
- data/lib/puppet/provider/group/aix.rb +1 -0
- data/lib/puppet/provider/group/groupadd.rb +57 -24
- data/lib/puppet/provider/group/windows_adsi.rb +3 -3
- data/lib/puppet/provider/package/aix.rb +17 -2
- data/lib/puppet/provider/package/apt.rb +78 -4
- data/lib/puppet/provider/package/dnfmodule.rb +69 -15
- data/lib/puppet/provider/package/dpkg.rb +14 -7
- data/lib/puppet/provider/package/fink.rb +20 -3
- data/lib/puppet/provider/package/gem.rb +41 -7
- data/lib/puppet/provider/package/openbsd.rb +13 -1
- data/lib/puppet/provider/package/pacman.rb +2 -5
- data/lib/puppet/provider/package/pip.rb +143 -48
- data/lib/puppet/provider/package/pip3.rb +0 -2
- data/lib/puppet/provider/package/pkg.rb +18 -5
- data/lib/puppet/provider/package/pkgdmg.rb +1 -1
- data/lib/puppet/provider/package/pkgng.rb +16 -4
- data/lib/puppet/provider/package/portage.rb +5 -5
- data/lib/puppet/provider/package/puppet_gem.rb +6 -2
- data/lib/puppet/provider/package/rpm.rb +6 -213
- data/lib/puppet/provider/package/yum.rb +108 -24
- data/lib/puppet/provider/package/zypper.rb +59 -1
- data/lib/puppet/provider/package_targetable.rb +5 -4
- data/lib/puppet/provider/service/systemd.rb +23 -5
- data/lib/puppet/provider/user/aix.rb +1 -0
- data/lib/puppet/provider/user/directoryservice.rb +30 -5
- data/lib/puppet/provider/user/hpux.rb +1 -1
- data/lib/puppet/provider/user/useradd.rb +11 -8
- data/lib/puppet/reports/http.rb +13 -9
- data/lib/puppet/reports/store.rb +1 -1
- data/lib/puppet/resource/type_collection.rb +20 -16
- data/lib/puppet/runtime.rb +32 -1
- data/lib/puppet/settings.rb +4 -0
- data/lib/puppet/settings/http_extra_headers_setting.rb +25 -0
- data/lib/puppet/ssl.rb +1 -0
- data/lib/puppet/ssl/certificate.rb +2 -1
- data/lib/puppet/ssl/host.rb +4 -4
- data/lib/puppet/ssl/oids.rb +1 -0
- data/lib/puppet/ssl/ssl_provider.rb +20 -0
- data/lib/puppet/ssl/state_machine.rb +81 -35
- data/lib/puppet/ssl/verifier_adapter.rb +9 -1
- data/lib/puppet/test/test_helper.rb +7 -1
- data/lib/puppet/transaction.rb +33 -11
- data/lib/puppet/transaction/report.rb +2 -2
- data/lib/puppet/transaction/resource_harness.rb +1 -1
- data/lib/puppet/type.rb +7 -2
- data/lib/puppet/type/file.rb +13 -0
- data/lib/puppet/type/file/data_sync.rb +5 -1
- data/lib/puppet/type/file/source.rb +49 -58
- data/lib/puppet/type/group.rb +5 -4
- data/lib/puppet/type/package.rb +102 -10
- data/lib/puppet/type/service.rb +6 -8
- data/lib/puppet/type/user.rb +6 -30
- data/lib/puppet/util.rb +34 -11
- data/lib/puppet/util/at_fork.rb +1 -1
- data/lib/puppet/util/autoload.rb +4 -18
- data/lib/puppet/util/instance_loader.rb +14 -10
- data/lib/puppet/util/log/destinations.rb +2 -11
- data/lib/puppet/util/logging.rb +30 -18
- data/lib/puppet/util/package/version/debian.rb +175 -0
- data/lib/puppet/util/package/version/gem.rb +15 -0
- data/lib/puppet/util/package/version/pip.rb +167 -0
- data/lib/puppet/util/package/version/range.rb +53 -0
- data/lib/puppet/util/package/version/range/eq.rb +14 -0
- data/lib/puppet/util/package/version/range/gt.rb +14 -0
- data/lib/puppet/util/package/version/range/gt_eq.rb +14 -0
- data/lib/puppet/util/package/version/range/lt.rb +14 -0
- data/lib/puppet/util/package/version/range/lt_eq.rb +14 -0
- data/lib/puppet/util/package/version/range/min_max.rb +21 -0
- data/lib/puppet/util/package/version/range/simple.rb +11 -0
- data/lib/puppet/util/package/version/rpm.rb +73 -0
- data/lib/puppet/util/pidlock.rb +36 -10
- data/lib/puppet/util/platform.rb +5 -0
- data/lib/puppet/util/plist.rb +6 -0
- data/lib/puppet/util/rpm_compare.rb +193 -0
- data/lib/puppet/util/storage.rb +0 -1
- data/lib/puppet/util/windows/adsi.rb +50 -20
- data/lib/puppet/util/windows/process.rb +15 -14
- data/lib/puppet/util/windows/security.rb +1 -0
- data/lib/puppet/util/windows/sid.rb +3 -3
- data/lib/puppet/util/yaml.rb +1 -1
- data/lib/puppet/version.rb +1 -1
- data/lib/puppet/x509/cert_provider.rb +9 -5
- data/locales/puppet.pot +640 -521
- data/man/man5/puppet.conf.5 +88 -9
- data/man/man8/puppet-agent.8 +6 -6
- data/man/man8/puppet-apply.8 +1 -1
- data/man/man8/puppet-catalog.8 +1 -1
- data/man/man8/puppet-config.8 +1 -1
- data/man/man8/puppet-describe.8 +1 -1
- data/man/man8/puppet-device.8 +2 -2
- data/man/man8/puppet-doc.8 +1 -1
- data/man/man8/puppet-epp.8 +1 -1
- data/man/man8/puppet-facts.8 +1 -1
- data/man/man8/puppet-filebucket.8 +17 -2
- data/man/man8/puppet-generate.8 +1 -1
- data/man/man8/puppet-help.8 +6 -3
- data/man/man8/puppet-key.8 +1 -1
- data/man/man8/puppet-lookup.8 +1 -1
- data/man/man8/puppet-man.8 +1 -1
- data/man/man8/puppet-module.8 +4 -1
- data/man/man8/puppet-node.8 +1 -1
- data/man/man8/puppet-parser.8 +1 -1
- data/man/man8/puppet-plugin.8 +1 -1
- data/man/man8/puppet-report.8 +1 -1
- data/man/man8/puppet-resource.8 +1 -1
- data/man/man8/puppet-script.8 +1 -1
- data/man/man8/puppet-ssl.8 +2 -2
- data/man/man8/puppet-status.8 +1 -1
- data/man/man8/puppet.8 +2 -2
- data/spec/fixtures/ssl/unknown-127.0.0.1-key.pem +67 -0
- data/spec/fixtures/ssl/unknown-127.0.0.1.pem +48 -0
- data/spec/fixtures/ssl/unknown-ca-key.pem +67 -0
- data/spec/fixtures/ssl/unknown-ca.pem +59 -0
- data/spec/fixtures/unit/forge/bacula.json +76 -0
- data/spec/fixtures/unit/provider/package/dnfmodule/{dnf-module-list-installed.txt → dnf-module-list.txt} +8 -0
- data/spec/fixtures/unit/provider/package/pkgng/pkg.version +2 -0
- data/spec/fixtures/unit/provider/package/yum/yum-check-update-subscription-manager.txt +9 -0
- data/spec/fixtures/unit/provider/package/zypper/zypper-search-uninstalled.out +13 -0
- data/spec/fixtures/unit/provider/service/systemd/list_unit_files_services +9 -0
- data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_md5/should_fetch_if_not_on_the_local_disk.yml +1 -102
- data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_md5/should_not_update_if_content_on_disk_is_up-to-date.yml +1 -106
- data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_md5/should_update_if_content_differs_on_disk.yml +1 -106
- data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_mtime/should_fetch_if_mtime_is_older_on_disk.yml +1 -102
- data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_mtime/should_fetch_if_no_header_specified.yml +1 -98
- data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_mtime/should_fetch_if_not_on_the_local_disk.yml +1 -102
- data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_mtime/should_not_update_if_mtime_is_newer_on_disk.yml +1 -102
- data/spec/integration/application/agent_spec.rb +394 -0
- data/spec/integration/application/apply_spec.rb +132 -3
- data/spec/integration/application/filebucket_spec.rb +190 -0
- data/spec/integration/application/plugin_spec.rb +73 -0
- data/spec/integration/configurer_spec.rb +26 -7
- data/spec/integration/http/client_spec.rb +154 -0
- data/spec/integration/indirector/facts/facter_spec.rb +4 -0
- data/spec/integration/indirector/report/yaml.rb +83 -0
- data/spec/integration/module_tool/forge_spec.rb +51 -0
- data/spec/integration/network/http_pool_spec.rb +76 -20
- data/spec/integration/node/environment_spec.rb +15 -0
- data/spec/integration/util/windows/adsi_spec.rb +6 -1
- data/spec/lib/puppet/test_ca.rb +2 -2
- data/spec/lib/puppet_spec/https.rb +20 -9
- data/spec/lib/puppet_spec/puppetserver.rb +119 -0
- data/spec/shared_contexts/https.rb +29 -0
- data/spec/spec_helper.rb +6 -2
- data/spec/unit/agent_spec.rb +80 -26
- data/spec/unit/application/agent_spec.rb +9 -5
- data/spec/unit/application/apply_spec.rb +2 -12
- data/spec/unit/application/describe_spec.rb +88 -50
- data/spec/unit/application/device_spec.rb +2 -2
- data/spec/unit/application/filebucket_spec.rb +22 -2
- data/spec/unit/application/resource_spec.rb +2 -2
- data/spec/unit/concurrent/lock_spec.rb +29 -0
- data/spec/unit/configurer/fact_handler_spec.rb +0 -4
- data/spec/unit/configurer/plugin_handler_spec.rb +36 -19
- data/spec/unit/configurer_spec.rb +400 -406
- data/spec/unit/context/trusted_information_spec.rb +17 -0
- data/spec/unit/daemon_spec.rb +5 -64
- data/spec/unit/defaults_spec.rb +38 -4
- data/spec/unit/environments_spec.rb +65 -28
- data/spec/unit/face/facts_spec.rb +24 -20
- data/spec/unit/face/module/search_spec.rb +17 -0
- data/spec/unit/face/plugin_spec.rb +12 -10
- data/spec/unit/file_system/uniquefile_spec.rb +11 -0
- data/spec/unit/file_system_spec.rb +26 -2
- data/spec/unit/forge/errors_spec.rb +1 -1
- data/spec/unit/forge/forge_spec.rb +12 -54
- data/spec/unit/forge/module_release_spec.rb +19 -6
- data/spec/unit/forge/repository_spec.rb +63 -157
- data/spec/unit/forge_spec.rb +46 -116
- data/spec/unit/functions/find_template_spec.rb +69 -0
- data/spec/unit/functions/lookup_spec.rb +13 -0
- data/spec/unit/http/client_spec.rb +395 -27
- data/spec/unit/http/external_client_spec.rb +201 -0
- data/spec/unit/http/resolver_spec.rb +81 -12
- data/spec/unit/http/response_spec.rb +69 -0
- data/spec/unit/http/service/ca_spec.rb +100 -7
- data/spec/unit/http/service/compiler_spec.rb +627 -0
- data/spec/unit/http/service/file_server_spec.rb +308 -0
- data/spec/unit/http/service/report_spec.rb +118 -0
- data/spec/unit/http/service_spec.rb +117 -4
- data/spec/unit/http/session_spec.rb +237 -19
- data/spec/unit/indirector/catalog/compiler_spec.rb +47 -29
- data/spec/unit/indirector/catalog/rest_spec.rb +59 -2
- data/spec/unit/indirector/facts/rest_spec.rb +79 -24
- data/spec/unit/indirector/file_bucket_file/rest_spec.rb +82 -2
- data/spec/unit/indirector/file_content/rest_spec.rb +53 -2
- data/spec/unit/indirector/file_metadata/http_spec.rb +167 -0
- data/spec/unit/indirector/file_metadata/rest_spec.rb +110 -2
- data/spec/unit/indirector/node/rest_spec.rb +57 -2
- data/spec/unit/indirector/report/rest_spec.rb +58 -51
- data/spec/unit/indirector/resource/ral_spec.rb +7 -8
- data/spec/unit/indirector/rest_spec.rb +13 -0
- data/spec/unit/indirector/status/rest_spec.rb +43 -2
- data/spec/unit/network/http/connection_spec.rb +549 -176
- data/spec/unit/network/http/nocache_pool_spec.rb +25 -3
- data/spec/unit/network/http/pool_spec.rb +89 -11
- data/spec/unit/network/http_pool_spec.rb +63 -57
- data/spec/unit/network/http_spec.rb +1 -1
- data/spec/unit/node/environment_spec.rb +16 -0
- data/spec/unit/node/facts_spec.rb +2 -1
- data/spec/unit/node_spec.rb +7 -4
- data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +8 -3
- data/spec/unit/pops/serialization/to_from_hr_spec.rb +6 -1
- data/spec/unit/pops/validator/validator_spec.rb +7 -2
- data/spec/unit/provider/aix_object_spec.rb +16 -2
- data/spec/unit/provider/group/groupadd_spec.rb +181 -56
- data/spec/unit/provider/group/windows_adsi_spec.rb +43 -10
- data/spec/unit/provider/package/aix_spec.rb +29 -0
- data/spec/unit/provider/package/apt_spec.rb +43 -2
- data/spec/unit/provider/package/aptitude_spec.rb +1 -0
- data/spec/unit/provider/package/dnfmodule_spec.rb +76 -15
- data/spec/unit/provider/package/dpkg_spec.rb +28 -6
- data/spec/unit/provider/package/gem_spec.rb +40 -0
- data/spec/unit/provider/package/openbsd_spec.rb +17 -0
- data/spec/unit/provider/package/pacman_spec.rb +6 -21
- data/spec/unit/provider/package/pip_spec.rb +68 -19
- data/spec/unit/provider/package/pkg_spec.rb +15 -1
- data/spec/unit/provider/package/pkgdmg_spec.rb +1 -1
- data/spec/unit/provider/package/pkgng_spec.rb +38 -0
- data/spec/unit/provider/package/portage_spec.rb +9 -4
- data/spec/unit/provider/package/puppet_gem_spec.rb +8 -0
- data/spec/unit/provider/package/rpm_spec.rb +0 -212
- data/spec/unit/provider/package/yum_spec.rb +292 -0
- data/spec/unit/provider/package/zypper_spec.rb +84 -0
- data/spec/unit/provider/package_targetable_spec.rb +60 -0
- data/spec/unit/provider/service/init_spec.rb +1 -0
- data/spec/unit/provider/service/openbsd_spec.rb +9 -0
- data/spec/unit/provider/service/openwrt_spec.rb +1 -0
- data/spec/unit/provider/service/redhat_spec.rb +9 -0
- data/spec/unit/provider/service/systemd_spec.rb +92 -12
- data/spec/unit/provider/user/directoryservice_spec.rb +41 -0
- data/spec/unit/provider/user/hpux_spec.rb +2 -2
- data/spec/unit/provider/user/useradd_spec.rb +21 -8
- data/spec/unit/provider/user/windows_adsi_spec.rb +3 -3
- data/spec/unit/puppet_pal_2pec.rb +0 -26
- data/spec/unit/puppet_pal_catalog_spec.rb +46 -0
- data/spec/unit/puppet_spec.rb +47 -0
- data/spec/unit/reports/http_spec.rb +70 -52
- data/spec/unit/settings/autosign_setting_spec.rb +1 -1
- data/spec/unit/settings/http_extra_headers_spec.rb +64 -0
- data/spec/unit/ssl/certificate_spec.rb +7 -0
- data/spec/unit/ssl/host_spec.rb +4 -2
- data/spec/unit/ssl/oids_spec.rb +1 -0
- data/spec/unit/ssl/ssl_provider_spec.rb +71 -0
- data/spec/unit/ssl/state_machine_spec.rb +99 -13
- data/spec/unit/transaction/persistence_spec.rb +1 -10
- data/spec/unit/transaction/report_spec.rb +4 -0
- data/spec/unit/transaction_spec.rb +45 -1
- data/spec/unit/type/file/content_spec.rb +9 -3
- data/spec/unit/type/file/ensure_spec.rb +1 -2
- data/spec/unit/type/file/source_spec.rb +86 -35
- data/spec/unit/type/package_spec.rb +8 -0
- data/spec/unit/type/service_spec.rb +9 -8
- data/spec/unit/type/user_spec.rb +1 -2
- data/spec/unit/util/at_fork_spec.rb +3 -2
- data/spec/unit/util/autoload_spec.rb +2 -1
- data/spec/unit/util/log/destinations_spec.rb +1 -29
- data/spec/unit/util/log_spec.rb +0 -138
- data/spec/unit/util/logging_spec.rb +200 -0
- data/spec/unit/util/package/version/debian_spec.rb +83 -0
- data/spec/unit/util/package/version/pip_spec.rb +464 -0
- data/spec/unit/util/package/version/range_spec.rb +175 -0
- data/spec/unit/util/package/version/rpm_spec.rb +121 -0
- data/spec/unit/util/pidlock_spec.rb +112 -42
- data/spec/unit/util/plist_spec.rb +20 -0
- data/spec/unit/util/rpm_compare_spec.rb +196 -0
- data/spec/unit/util/storage_spec.rb +1 -8
- data/spec/unit/util/windows/adsi_spec.rb +55 -4
- data/spec/unit/util/windows/sid_spec.rb +2 -2
- data/spec/unit/x509/cert_provider_spec.rb +24 -4
- data/tasks/generate_cert_fixtures.rake +15 -1
- data/tasks/manpages.rake +6 -35
- metadata +92 -12
- data/COMMITTERS.md +0 -244
- data/spec/integration/faces/plugin_spec.rb +0 -61
- data/spec/lib/puppet_spec/validators.rb +0 -37
@@ -90,6 +90,23 @@ describe Puppet::Context::TrustedInformation, :unless => RUBY_PLATFORM == 'java'
|
|
90
90
|
|
91
91
|
expect(trusted.external).to eq(external_data)
|
92
92
|
end
|
93
|
+
|
94
|
+
it 'does not run the trusted external command when creating a trusted context' do
|
95
|
+
Puppet[:trusted_external_command] = '/usr/bin/generate_data.sh'
|
96
|
+
|
97
|
+
expect(Puppet::Util::Execution).to receive(:execute).never
|
98
|
+
Puppet::Context::TrustedInformation.remote(true, 'cert name', cert)
|
99
|
+
end
|
100
|
+
|
101
|
+
it 'only runs the trusted external command the first time it is invoked' do
|
102
|
+
Puppet[:trusted_external_command] = '/usr/bin/generate_data.sh'
|
103
|
+
|
104
|
+
expect(Puppet::Util::Execution).to receive(:execute).with(['/usr/bin/generate_data.sh', 'cert name'], anything).and_return(JSON.dump(external_data)).once
|
105
|
+
|
106
|
+
trusted = Puppet::Context::TrustedInformation.remote(true, 'cert name', cert)
|
107
|
+
trusted.external
|
108
|
+
trusted.external
|
109
|
+
end
|
93
110
|
end
|
94
111
|
|
95
112
|
context "when local" do
|
data/spec/unit/daemon_spec.rb
CHANGED
@@ -32,13 +32,17 @@ describe Puppet::Daemon, :unless => Puppet::Util::Platform.windows? do
|
|
32
32
|
let(:pidfile) { double("PidFile", :lock => true, :unlock => true, :file_path => 'fake.pid') }
|
33
33
|
let(:scheduler) { RecordingScheduler.new }
|
34
34
|
|
35
|
-
let(:daemon) { Puppet::Daemon.new(pidfile, scheduler) }
|
35
|
+
let(:daemon) { Puppet::Daemon.new(agent, pidfile, scheduler) }
|
36
36
|
|
37
37
|
before(:each) do
|
38
38
|
allow(Signal).to receive(:trap)
|
39
39
|
allow(daemon).to receive(:close_streams).and_return(nil)
|
40
40
|
end
|
41
41
|
|
42
|
+
it "should fail when no agent is provided" do
|
43
|
+
expect { Puppet::Daemon.new(nil, pidfile, scheduler) }.to raise_error(Puppet::DevError)
|
44
|
+
end
|
45
|
+
|
42
46
|
it "should reopen the Log logs when told to reopen logs" do
|
43
47
|
expect(Puppet::Util::Log).to receive(:reopen)
|
44
48
|
daemon.reopen_logs
|
@@ -72,65 +76,21 @@ describe Puppet::Daemon, :unless => Puppet::Util::Platform.windows? do
|
|
72
76
|
allow(daemon).to receive(:set_signal_traps)
|
73
77
|
end
|
74
78
|
|
75
|
-
it "should fail if it has neither agent nor server" do
|
76
|
-
expect { daemon.start }.to raise_error(Puppet::DevError)
|
77
|
-
end
|
78
|
-
|
79
79
|
it "should create its pidfile" do
|
80
80
|
expect(pidfile).to receive(:lock).and_return(true)
|
81
|
-
|
82
|
-
daemon.agent = agent
|
83
81
|
daemon.start
|
84
82
|
end
|
85
83
|
|
86
84
|
it "should fail if it cannot lock" do
|
87
85
|
expect(pidfile).to receive(:lock).and_return(false)
|
88
|
-
daemon.agent = agent
|
89
|
-
|
90
86
|
expect { daemon.start }.to raise_error(RuntimeError, "Could not create PID file: #{pidfile.file_path}")
|
91
87
|
end
|
92
88
|
|
93
|
-
it "should start its server if one is configured" do
|
94
|
-
daemon.server = server
|
95
|
-
|
96
|
-
expect(server).to receive(:start)
|
97
|
-
|
98
|
-
daemon.start
|
99
|
-
end
|
100
|
-
|
101
89
|
it "disables the reparse of configs if the filetimeout is 0" do
|
102
90
|
Puppet[:filetimeout] = 0
|
103
|
-
daemon.agent = agent
|
104
|
-
|
105
91
|
daemon.start
|
106
|
-
|
107
92
|
expect(scheduler.jobs[0]).not_to be_enabled
|
108
93
|
end
|
109
|
-
|
110
|
-
it "disables the agent run when there is no agent" do
|
111
|
-
Puppet[:filetimeout] = 0
|
112
|
-
daemon.server = server
|
113
|
-
|
114
|
-
daemon.start
|
115
|
-
|
116
|
-
expect(scheduler.jobs[1]).not_to be_enabled
|
117
|
-
end
|
118
|
-
|
119
|
-
it "waits for the server to shutdown when there is one" do
|
120
|
-
daemon.server = server
|
121
|
-
|
122
|
-
expect(server).to receive(:wait_for_shutdown)
|
123
|
-
|
124
|
-
daemon.start
|
125
|
-
end
|
126
|
-
|
127
|
-
it "waits for the server to shutdown when there is one" do
|
128
|
-
daemon.server = server
|
129
|
-
|
130
|
-
expect(server).to receive(:wait_for_shutdown)
|
131
|
-
|
132
|
-
daemon.start
|
133
|
-
end
|
134
94
|
end
|
135
95
|
|
136
96
|
describe "when stopping" do
|
@@ -146,14 +106,6 @@ describe Puppet::Daemon, :unless => Puppet::Util::Platform.windows? do
|
|
146
106
|
without_warnings { Puppet::Application = Puppet::Application.superclass }
|
147
107
|
end
|
148
108
|
|
149
|
-
it "should stop its server if one is configured" do
|
150
|
-
expect(server).to receive(:stop)
|
151
|
-
|
152
|
-
daemon.server = server
|
153
|
-
|
154
|
-
expect { daemon.stop }.to exit_with 0
|
155
|
-
end
|
156
|
-
|
157
109
|
it 'should request a stop from Puppet::Application' do
|
158
110
|
expect(Puppet::Application).to receive(:stop!)
|
159
111
|
expect { daemon.stop }.to exit_with 0
|
@@ -161,7 +113,6 @@ describe Puppet::Daemon, :unless => Puppet::Util::Platform.windows? do
|
|
161
113
|
|
162
114
|
it "should remove its pidfile" do
|
163
115
|
expect(pidfile).to receive(:unlock)
|
164
|
-
|
165
116
|
expect { daemon.stop }.to exit_with 0
|
166
117
|
end
|
167
118
|
|
@@ -188,8 +139,6 @@ describe Puppet::Daemon, :unless => Puppet::Util::Platform.windows? do
|
|
188
139
|
expect(agent).to receive(:run).with({:splay => false}).and_raise(Puppet::LockError, 'Failed to aquire lock')
|
189
140
|
expect(Puppet).to receive(:notice).with('Not triggering already-running agent')
|
190
141
|
|
191
|
-
daemon.agent = agent
|
192
|
-
|
193
142
|
daemon.reload
|
194
143
|
end
|
195
144
|
|
@@ -197,8 +146,6 @@ describe Puppet::Daemon, :unless => Puppet::Util::Platform.windows? do
|
|
197
146
|
expect(agent).to receive(:run).with({:splay => false})
|
198
147
|
expect(Puppet).not_to receive(:notice).with('Not triggering already-running agent')
|
199
148
|
|
200
|
-
daemon.agent = agent
|
201
|
-
|
202
149
|
daemon.reload
|
203
150
|
end
|
204
151
|
end
|
@@ -220,15 +167,11 @@ describe Puppet::Daemon, :unless => Puppet::Util::Platform.windows? do
|
|
220
167
|
|
221
168
|
it "should reexec itself if no agent is available" do
|
222
169
|
expect(daemon).to receive(:reexec)
|
223
|
-
|
224
170
|
daemon.restart
|
225
171
|
end
|
226
172
|
|
227
173
|
it "should reexec itself if the agent is not running" do
|
228
|
-
expect(agent).to receive(:running?).and_return(false)
|
229
|
-
daemon.agent = agent
|
230
174
|
expect(daemon).to receive(:reexec)
|
231
|
-
|
232
175
|
daemon.restart
|
233
176
|
end
|
234
177
|
end
|
@@ -247,14 +190,12 @@ describe Puppet::Daemon, :unless => Puppet::Util::Platform.windows? do
|
|
247
190
|
it "should shut down without exiting" do
|
248
191
|
daemon.argv = %w{foo}
|
249
192
|
expect(daemon).to receive(:stop).with(:exit => false)
|
250
|
-
|
251
193
|
daemon.reexec
|
252
194
|
end
|
253
195
|
|
254
196
|
it "should call 'exec' with the original executable and arguments" do
|
255
197
|
daemon.argv = %w{foo}
|
256
198
|
expect(daemon).to receive(:exec).with($0 + " foo")
|
257
|
-
|
258
199
|
daemon.reexec
|
259
200
|
end
|
260
201
|
end
|
data/spec/unit/defaults_spec.rb
CHANGED
@@ -139,7 +139,7 @@ describe "Defaults" do
|
|
139
139
|
let(:installdir) { 'C:\Program Files\Puppet Labs\Puppet' }
|
140
140
|
|
141
141
|
it 'includes user and system modules' do
|
142
|
-
allow(
|
142
|
+
allow(ENV).to receive(:[]).with("FACTER_env_windows_installdir").and_return(installdir)
|
143
143
|
|
144
144
|
expect(
|
145
145
|
Puppet.default_basemodulepath
|
@@ -147,7 +147,7 @@ describe "Defaults" do
|
|
147
147
|
end
|
148
148
|
|
149
149
|
it 'includes user modules if installdir fact is missing' do
|
150
|
-
allow(
|
150
|
+
allow(ENV).to receive(:[]).with("FACTER_env_windows_installdir").and_return(nil)
|
151
151
|
|
152
152
|
expect(
|
153
153
|
Puppet.default_basemodulepath
|
@@ -167,7 +167,7 @@ describe "Defaults" do
|
|
167
167
|
let(:installdir) { 'C:\Program Files\Puppet Labs\Puppet' }
|
168
168
|
|
169
169
|
it 'includes the default vendormoduledir' do
|
170
|
-
allow(
|
170
|
+
allow(ENV).to receive(:[]).with("FACTER_env_windows_installdir").and_return(installdir)
|
171
171
|
|
172
172
|
expect(
|
173
173
|
Puppet.default_vendormoduledir
|
@@ -175,10 +175,44 @@ describe "Defaults" do
|
|
175
175
|
end
|
176
176
|
|
177
177
|
it 'is nil if installdir fact is missing' do
|
178
|
-
allow(
|
178
|
+
allow(ENV).to receive(:[]).with("FACTER_env_windows_installdir").and_return(nil)
|
179
179
|
|
180
180
|
expect(Puppet.default_vendormoduledir).to be_nil
|
181
181
|
end
|
182
182
|
end
|
183
183
|
end
|
184
|
+
|
185
|
+
describe "facterng" do
|
186
|
+
it "defaults to false" do
|
187
|
+
expect(Puppet[:facterng]).to be_falsey
|
188
|
+
end
|
189
|
+
|
190
|
+
it "raises an exception if facter-ng could not be loaded" do
|
191
|
+
allow_any_instance_of(Puppet::Settings::BooleanSetting).to receive(:require).with('facter-ng').and_raise(LoadError)
|
192
|
+
|
193
|
+
expect{ Puppet.settings[:facterng] = true }.to raise_exception ArgumentError, 'facter-ng could not be loaded'
|
194
|
+
end
|
195
|
+
|
196
|
+
context 'set logger' do
|
197
|
+
before do
|
198
|
+
@original_facter = Object.const_get(:Facter)
|
199
|
+
|
200
|
+
Object.send(:remove_const, :Facter)
|
201
|
+
Object.const_set(:Facter, Module.new)
|
202
|
+
|
203
|
+
allow_any_instance_of(Puppet::Settings::BooleanSetting).to receive(:require).with('facter-ng').and_return(true)
|
204
|
+
allow(Facter).to receive(:respond_to?).and_return(false)
|
205
|
+
end
|
206
|
+
|
207
|
+
after do
|
208
|
+
Object.const_set(:Facter, @original_facter)
|
209
|
+
end
|
210
|
+
|
211
|
+
it 'calls setup_facter_logging!' do
|
212
|
+
allow(Puppet::Util::Logging).to receive(:setup_facter_logging!).and_return(true)
|
213
|
+
Puppet.settings[:facterng] = true
|
214
|
+
expect(Puppet::Util::Logging).to have_received(:setup_facter_logging!).once
|
215
|
+
end
|
216
|
+
end
|
217
|
+
end
|
184
218
|
end
|
@@ -13,20 +13,29 @@ describe Puppet::Environments do
|
|
13
13
|
before(:each) do
|
14
14
|
Puppet.settings.initialize_global_settings
|
15
15
|
Puppet[:environment_timeout] = "unlimited"
|
16
|
+
Puppet[:versioned_environment_dirs] = true
|
16
17
|
end
|
17
18
|
|
18
19
|
let(:directory_tree) do
|
19
|
-
FS::MemoryFile.a_directory(File.expand_path("
|
20
|
-
FS::MemoryFile.
|
21
|
-
|
22
|
-
FS::MemoryFile.
|
20
|
+
FS::MemoryFile.a_directory(File.expand_path("top_level_dir"), [
|
21
|
+
FS::MemoryFile.a_directory("envdir", [
|
22
|
+
FS::MemoryFile.a_regular_file_containing("ignored_file", ''),
|
23
|
+
FS::MemoryFile.a_directory("an_environment", [
|
24
|
+
FS::MemoryFile.a_missing_file("environment.conf"),
|
25
|
+
FS::MemoryFile.a_directory("modules"),
|
26
|
+
FS::MemoryFile.a_directory("manifests"),
|
27
|
+
]),
|
28
|
+
FS::MemoryFile.a_directory("another_environment", [
|
29
|
+
FS::MemoryFile.a_missing_file("environment.conf"),
|
30
|
+
]),
|
31
|
+
FS::MemoryFile.a_missing_file("doesnotexist"),
|
32
|
+
FS::MemoryFile.a_symlink("symlinked_environment", File.expand_path(File.join("top_level_dir", "versioned_env")))]),
|
33
|
+
FS::MemoryFile.a_directory("versioned_env", [
|
34
|
+
FS::MemoryFile.a_regular_file_containing("environment.conf", ''),
|
23
35
|
FS::MemoryFile.a_directory("modules"),
|
24
36
|
FS::MemoryFile.a_directory("manifests"),
|
25
37
|
]),
|
26
|
-
FS::MemoryFile.
|
27
|
-
FS::MemoryFile.a_missing_file("environment.conf"),
|
28
|
-
]),
|
29
|
-
FS::MemoryFile.a_missing_file("doesnotexist"),
|
38
|
+
FS::MemoryFile.a_missing_file("missing")
|
30
39
|
])
|
31
40
|
end
|
32
41
|
|
@@ -38,22 +47,27 @@ describe Puppet::Environments do
|
|
38
47
|
global_path_2 = FS::MemoryFile.a_directory(global_path_2_location)
|
39
48
|
|
40
49
|
loader_from(:filesystem => [directory_tree, global_path_1, global_path_2],
|
41
|
-
:directory => directory_tree,
|
50
|
+
:directory => directory_tree.children.first,
|
42
51
|
:modulepath => [global_path_1_location, global_path_2_location]) do |loader|
|
43
52
|
expect(loader.list).to include_in_any_order(
|
44
53
|
environment(:an_environment).
|
45
|
-
with_manifest("#{FS.path_string(directory_tree)}/an_environment/manifests").
|
46
|
-
with_modulepath(["#{FS.path_string(directory_tree)}/an_environment/modules",
|
54
|
+
with_manifest("#{FS.path_string(directory_tree)}/envdir/an_environment/manifests").
|
55
|
+
with_modulepath(["#{FS.path_string(directory_tree)}/envdir/an_environment/modules",
|
47
56
|
global_path_1_location,
|
48
57
|
global_path_2_location]),
|
49
|
-
environment(:another_environment)
|
58
|
+
environment(:another_environment),
|
59
|
+
environment(:symlinked_environment).
|
60
|
+
with_manifest("#{FS.path_string(directory_tree)}/versioned_env/manifests").
|
61
|
+
with_modulepath(["#{FS.path_string(directory_tree)}/versioned_env/modules",
|
62
|
+
global_path_1_location,
|
63
|
+
global_path_2_location]))
|
50
64
|
end
|
51
65
|
end
|
52
66
|
|
53
67
|
it "has search_paths" do
|
54
68
|
loader_from(:filesystem => [directory_tree],
|
55
|
-
:directory => directory_tree) do |loader|
|
56
|
-
expect(loader.search_paths).to eq(["file://#{directory_tree}"])
|
69
|
+
:directory => directory_tree.children.first) do |loader|
|
70
|
+
expect(loader.search_paths).to eq(["file://#{directory_tree.children.first}"])
|
57
71
|
end
|
58
72
|
end
|
59
73
|
|
@@ -77,16 +91,38 @@ describe Puppet::Environments do
|
|
77
91
|
end
|
78
92
|
end
|
79
93
|
|
94
|
+
it "proceeds with non-existant env dir" do
|
95
|
+
loader_from(:filesystem => [directory_tree],
|
96
|
+
:directory => directory_tree.children.last) do |loader|
|
97
|
+
expect(loader.list).to eq([])
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
80
101
|
it "gets a particular environment" do
|
81
102
|
loader_from(:filesystem => [directory_tree],
|
82
|
-
:directory => directory_tree) do |loader|
|
103
|
+
:directory => directory_tree.children.first) do |loader|
|
83
104
|
expect(loader.get("an_environment")).to environment(:an_environment)
|
84
105
|
end
|
85
106
|
end
|
86
107
|
|
108
|
+
it "gets a symlinked environment" do
|
109
|
+
loader_from(:filesystem => [directory_tree],
|
110
|
+
:directory => directory_tree.children.first) do |loader|
|
111
|
+
expect(loader.get("symlinked_environment")).to environment(:symlinked_environment)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
it "ignores symlinked environments when `:versioned_environment_dirs` is false" do
|
116
|
+
Puppet[:versioned_environment_dirs] = false
|
117
|
+
loader_from(:filesystem => [directory_tree],
|
118
|
+
:directory => directory_tree.children.first) do |loader|
|
119
|
+
expect(loader.get("symlinked_environment")).to be_nil
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
87
123
|
it "raises error when environment not found" do
|
88
124
|
loader_from(:filesystem => [directory_tree],
|
89
|
-
:directory => directory_tree) do |loader|
|
125
|
+
:directory => directory_tree.children.first) do |loader|
|
90
126
|
expect do
|
91
127
|
loader.get!("doesnotexist")
|
92
128
|
end.to raise_error(Puppet::Environments::EnvironmentNotFound)
|
@@ -95,7 +131,7 @@ describe Puppet::Environments do
|
|
95
131
|
|
96
132
|
it "returns nil if an environment can't be found" do
|
97
133
|
loader_from(:filesystem => [directory_tree],
|
98
|
-
:directory => directory_tree) do |loader|
|
134
|
+
:directory => directory_tree.children.first) do |loader|
|
99
135
|
expect(loader.get("doesnotexist")).to be_nil
|
100
136
|
end
|
101
137
|
end
|
@@ -404,7 +440,7 @@ config_version=$vardir/random/scripts
|
|
404
440
|
context "custom cache expiration service" do
|
405
441
|
it "consults the custom service to expire the cache" do
|
406
442
|
loader_from(:filesystem => [directory_tree],
|
407
|
-
:directory => directory_tree) do |loader|
|
443
|
+
:directory => directory_tree.children.first) do |loader|
|
408
444
|
service = ReplayExpirationService.new([true])
|
409
445
|
using_expiration_service(service) do
|
410
446
|
|
@@ -541,22 +577,23 @@ config_version=$vardir/random/scripts
|
|
541
577
|
|
542
578
|
describe "cached loaders" do
|
543
579
|
it "lists environments" do
|
544
|
-
loader_from(:filesystem => [directory_tree], :directory => directory_tree) do |loader|
|
580
|
+
loader_from(:filesystem => [directory_tree], :directory => directory_tree.children.first) do |loader|
|
545
581
|
expect(Puppet::Environments::Cached.new(loader).list).to include_in_any_order(
|
546
582
|
environment(:an_environment),
|
547
|
-
environment(:another_environment)
|
583
|
+
environment(:another_environment),
|
584
|
+
environment(:symlinked_environment))
|
548
585
|
end
|
549
586
|
end
|
550
587
|
|
551
588
|
it "has search_paths" do
|
552
|
-
loader_from(:filesystem => [directory_tree], :directory => directory_tree) do |loader|
|
553
|
-
expect(Puppet::Environments::Cached.new(loader).search_paths).to eq(["file://#{directory_tree}"])
|
589
|
+
loader_from(:filesystem => [directory_tree], :directory => directory_tree.children.first) do |loader|
|
590
|
+
expect(Puppet::Environments::Cached.new(loader).search_paths).to eq(["file://#{directory_tree.children.first}"])
|
554
591
|
end
|
555
592
|
end
|
556
593
|
|
557
594
|
context "#get" do
|
558
595
|
it "gets an environment" do
|
559
|
-
loader_from(:filesystem => [directory_tree], :directory => directory_tree) do |loader|
|
596
|
+
loader_from(:filesystem => [directory_tree], :directory => directory_tree.children.first) do |loader|
|
560
597
|
expect(Puppet::Environments::Cached.new(loader).get(:an_environment)).to environment(:an_environment)
|
561
598
|
end
|
562
599
|
end
|
@@ -574,7 +611,7 @@ config_version=$vardir/random/scripts
|
|
574
611
|
end
|
575
612
|
|
576
613
|
it "returns nil if env not found" do
|
577
|
-
loader_from(:filesystem => [directory_tree], :directory => directory_tree) do |loader|
|
614
|
+
loader_from(:filesystem => [directory_tree], :directory => directory_tree.children.first) do |loader|
|
578
615
|
expect(Puppet::Environments::Cached.new(loader).get(:doesnotexist)).to be_nil
|
579
616
|
end
|
580
617
|
end
|
@@ -582,7 +619,7 @@ config_version=$vardir/random/scripts
|
|
582
619
|
|
583
620
|
context "#get!" do
|
584
621
|
it "gets an environment" do
|
585
|
-
loader_from(:filesystem => [directory_tree], :directory => directory_tree) do |loader|
|
622
|
+
loader_from(:filesystem => [directory_tree], :directory => directory_tree.children.first) do |loader|
|
586
623
|
expect(Puppet::Environments::Cached.new(loader).get!(:an_environment)).to environment(:an_environment)
|
587
624
|
end
|
588
625
|
end
|
@@ -600,7 +637,7 @@ config_version=$vardir/random/scripts
|
|
600
637
|
end
|
601
638
|
|
602
639
|
it "raises error if environment is not found" do
|
603
|
-
loader_from(:filesystem => [directory_tree], :directory => directory_tree) do |loader|
|
640
|
+
loader_from(:filesystem => [directory_tree], :directory => directory_tree.children.first) do |loader|
|
604
641
|
expect do
|
605
642
|
Puppet::Environments::Cached.new(loader).get!(:doesnotexist)
|
606
643
|
end.to raise_error(Puppet::Environments::EnvironmentNotFound)
|
@@ -609,9 +646,9 @@ config_version=$vardir/random/scripts
|
|
609
646
|
end
|
610
647
|
|
611
648
|
it "gets an environment.conf" do
|
612
|
-
loader_from(:filesystem => [directory_tree], :directory => directory_tree) do |loader|
|
649
|
+
loader_from(:filesystem => [directory_tree], :directory => directory_tree.children.first) do |loader|
|
613
650
|
expect(Puppet::Environments::Cached.new(loader).get_conf(:an_environment)).to match_environment_conf(:an_environment).
|
614
|
-
with_env_path(directory_tree).
|
651
|
+
with_env_path(directory_tree.children.first).
|
615
652
|
with_global_module_path([])
|
616
653
|
end
|
617
654
|
end
|
@@ -12,9 +12,12 @@ describe Puppet::Face[:facts, '0.0.1'] do
|
|
12
12
|
let(:model) { Puppet::Node::Facts }
|
13
13
|
let(:test_data) { model.new('puppet.node.test', {test_fact: 'test value'}) }
|
14
14
|
let(:facter_terminus) { model.indirection.terminus(:facter) }
|
15
|
-
let(:rest_terminus) { model.indirection.terminus(:rest) }
|
16
15
|
|
17
16
|
before(:each) do
|
17
|
+
Puppet[:facts_terminus] = :memory
|
18
|
+
Puppet::Node::Facts.indirection.save(test_data)
|
19
|
+
allow(Puppet::Node::Facts.indirection).to receive(:terminus_class=).with(:facter)
|
20
|
+
|
18
21
|
Puppet.settings.parse_config(<<-CONF)
|
19
22
|
[main]
|
20
23
|
server=puppet.server.invalid
|
@@ -26,45 +29,46 @@ CONF
|
|
26
29
|
|
27
30
|
# Faces start in :user run mode
|
28
31
|
Puppet.settings.preferred_run_mode = :user
|
29
|
-
|
30
|
-
allow(facter_terminus).to receive(:find).with(instance_of(Puppet::Indirector::Request)).and_return(test_data)
|
31
|
-
allow(rest_terminus).to receive(:save).with(instance_of(Puppet::Indirector::Request)).and_return(nil)
|
32
|
-
end
|
33
|
-
|
34
|
-
it { is_expected.to be_action :upload }
|
35
|
-
|
36
|
-
it "finds facts from terminus_class :facter" do
|
37
|
-
expect(facter_terminus).to receive(:find).with(instance_of(Puppet::Indirector::Request)).and_return(test_data)
|
38
|
-
|
39
|
-
subject.upload
|
40
32
|
end
|
41
33
|
|
42
|
-
it "
|
43
|
-
|
34
|
+
it "uploads facts as application/json" do
|
35
|
+
stub_request(:put, 'https://puppet.server.test:8140/puppet/v3/facts/puppet.node.test?environment=*root*')
|
36
|
+
.with(
|
37
|
+
headers: { 'Content-Type' => 'application/json' },
|
38
|
+
body: hash_including(
|
39
|
+
{
|
40
|
+
"name" => "puppet.node.test",
|
41
|
+
"values" => {
|
42
|
+
"test_fact" => "test value"
|
43
|
+
}
|
44
|
+
}
|
45
|
+
)
|
46
|
+
)
|
44
47
|
|
45
48
|
subject.upload
|
46
49
|
end
|
47
50
|
|
48
51
|
it "passes the current environment" do
|
49
|
-
|
50
|
-
expect(model.indirection).to receive(:save).with(anything, nil, :environment => env)
|
52
|
+
stub_request(:put, 'https://puppet.server.test:8140/puppet/v3/facts/puppet.node.test?environment=qa')
|
51
53
|
|
52
|
-
Puppet.override(:current_environment =>
|
54
|
+
Puppet.override(:current_environment => Puppet::Node::Environment.remote('qa')) do
|
53
55
|
subject.upload
|
54
56
|
end
|
55
57
|
end
|
56
58
|
|
57
|
-
it "uses settings from the agent section of puppet.conf" do
|
58
|
-
|
59
|
+
it "uses settings from the agent section of puppet.conf to resolve the node name" do
|
60
|
+
stub_request(:put, /puppet.node.test/)
|
59
61
|
|
60
62
|
subject.upload
|
61
63
|
end
|
62
64
|
|
63
65
|
it "logs the name of the server that received the upload" do
|
66
|
+
stub_request(:put, 'https://puppet.server.test:8140/puppet/v3/facts/puppet.node.test?environment=*root*')
|
67
|
+
|
64
68
|
subject.upload
|
65
69
|
|
66
70
|
expect(@logs).to be_any {|log| log.level == :notice &&
|
67
|
-
log.message =~ /Uploading facts for '.*' to
|
71
|
+
log.message =~ /Uploading facts for '.*' to 'puppet\.server\.test'/}
|
68
72
|
end
|
69
73
|
end
|
70
74
|
end
|