puppet 4.2.0 → 4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CONTRIBUTING.md +1 -1
- data/Gemfile +5 -7
- data/README.md +1 -1
- data/Rakefile +20 -0
- data/ext/debian/puppet.init +0 -1
- data/ext/debian/puppet.logrotate +14 -5
- data/ext/osx/puppet.plist +2 -4
- data/ext/project_data.yaml +1 -1
- data/ext/redhat/client.init +65 -12
- data/ext/redhat/logrotate +15 -3
- data/ext/redhat/puppet.spec.erb +5 -1
- data/ext/redhat/server.init +1 -1
- data/ext/solaris/smf/puppet +44 -0
- data/ext/solaris/smf/puppet.xml +44 -0
- data/ext/suse/client.init +27 -27
- data/ext/suse/server.init +2 -2
- data/ext/systemd/puppet.service +1 -0
- data/install.rb +21 -39
- data/lib/hiera/puppet_function.rb +5 -5
- data/lib/puppet/agent/locker.rb +11 -2
- data/lib/puppet/agent.rb +4 -4
- data/lib/puppet/application/agent.rb +28 -14
- data/lib/puppet/application/apply.rb +17 -4
- data/lib/puppet/application/cert.rb +16 -0
- data/lib/puppet/application/filebucket.rb +78 -4
- data/lib/puppet/application/lookup.rb +356 -0
- data/lib/puppet/application/master.rb +5 -1
- data/lib/puppet/configurer.rb +9 -5
- data/lib/puppet/context/trusted_information.rb +21 -1
- data/lib/puppet/context.rb +16 -1
- data/lib/puppet/daemon.rb +17 -13
- data/lib/puppet/data_binding.rb +4 -2
- data/lib/puppet/data_providers/data_adapter.rb +7 -68
- data/lib/puppet/data_providers/data_function_support.rb +5 -26
- data/lib/puppet/data_providers/function_env_data_provider.rb +0 -10
- data/lib/puppet/data_providers/function_module_data_provider.rb +0 -22
- data/lib/puppet/data_providers/hiera_config.rb +106 -0
- data/lib/puppet/data_providers/hiera_env_data_provider.rb +18 -0
- data/lib/puppet/data_providers/hiera_interpolate.rb +97 -0
- data/lib/puppet/data_providers/hiera_module_data_provider.rb +23 -0
- data/lib/puppet/data_providers/hiera_support.rb +37 -0
- data/lib/puppet/data_providers/json_data_provider_factory.rb +31 -0
- data/lib/puppet/data_providers/lookup_adapter.rb +200 -0
- data/lib/puppet/data_providers/yaml_data_provider_factory.rb +32 -0
- data/lib/puppet/data_providers.rb +12 -13
- data/lib/puppet/defaults.rb +14 -3
- data/lib/puppet/environments.rb +94 -6
- data/lib/puppet/error.rb +4 -0
- data/lib/puppet/face/module/changes.rb +2 -1
- data/lib/puppet/feature/cfacter.rb +1 -0
- data/lib/puppet/file_bucket/dipper.rb +58 -2
- data/lib/puppet/file_system/windows.rb +3 -1
- data/lib/puppet/functions/assert_type.rb +48 -12
- data/lib/puppet/functions/defined.rb +79 -48
- data/lib/puppet/functions/each.rb +85 -27
- data/lib/puppet/functions/epp.rb +29 -37
- data/lib/puppet/functions/filter.rb +60 -25
- data/lib/puppet/functions/hiera.rb +76 -3
- data/lib/puppet/functions/hiera_array.rb +65 -3
- data/lib/puppet/functions/hiera_hash.rb +74 -2
- data/lib/puppet/functions/hiera_include.rb +77 -4
- data/lib/puppet/functions/inline_epp.rb +44 -71
- data/lib/puppet/functions/lookup.rb +19 -17
- data/lib/puppet/functions/map.rb +56 -21
- data/lib/puppet/functions/match.rb +29 -12
- data/lib/puppet/functions/reduce.rb +95 -58
- data/lib/puppet/functions/versioncmp.rb +36 -0
- data/lib/puppet/functions/with.rb +15 -7
- data/lib/puppet/functions.rb +2 -4
- data/lib/puppet/indirector/catalog/compiler.rb +3 -3
- data/lib/puppet/indirector/catalog/static_compiler.rb +46 -30
- data/lib/puppet/indirector/data_binding/none.rb +4 -1
- data/lib/puppet/indirector/file_bucket_file/file.rb +58 -1
- data/lib/puppet/indirector/hiera.rb +4 -0
- data/lib/puppet/indirector/indirection.rb +6 -1
- data/lib/puppet/indirector/json.rb +1 -1
- data/lib/puppet/indirector/msgpack.rb +1 -1
- data/lib/puppet/indirector/request.rb +7 -8
- data/lib/puppet/indirector/resource_type/parser.rb +5 -3
- data/lib/puppet/info_service/class_information_service.rb +111 -0
- data/lib/puppet/info_service.rb +7 -0
- data/lib/puppet/module_tool/applications/unpacker.rb +1 -1
- data/lib/puppet/module_tool/metadata.rb +32 -9
- data/lib/puppet/module_tool/skeleton/templates/generator/README.md.erb +42 -38
- data/lib/puppet/module_tool/skeleton/templates/generator/manifests/init.pp.erb +25 -18
- data/lib/puppet/network/authconfig.rb +21 -1
- data/lib/puppet/network/authorization.rb +8 -1
- data/lib/puppet/network/http/api/master/v3/environment.rb +59 -0
- data/lib/puppet/network/http/api/master/v3.rb +7 -1
- data/lib/puppet/node/environment.rb +9 -2
- data/lib/puppet/node.rb +11 -5
- data/lib/puppet/parser/ast/pops_bridge.rb +39 -1
- data/lib/puppet/parser/compiler/catalog_validator/env_relationship_validator.rb +64 -0
- data/lib/puppet/parser/compiler/catalog_validator/relationship_validator.rb +38 -0
- data/lib/puppet/parser/compiler/catalog_validator/site_validator.rb +20 -0
- data/lib/puppet/parser/compiler/catalog_validator.rb +33 -0
- data/lib/puppet/parser/compiler.rb +300 -12
- data/lib/puppet/parser/environment_compiler.rb +165 -0
- data/lib/puppet/parser/functions/assert_type.rb +46 -16
- data/lib/puppet/parser/functions/defined.rb +105 -68
- data/lib/puppet/parser/functions/each.rb +85 -27
- data/lib/puppet/parser/functions/epp.rb +29 -37
- data/lib/puppet/parser/functions/filter.rb +59 -23
- data/lib/puppet/parser/functions/hiera.rb +83 -27
- data/lib/puppet/parser/functions/hiera_array.rb +71 -28
- data/lib/puppet/parser/functions/hiera_hash.rb +81 -30
- data/lib/puppet/parser/functions/hiera_include.rb +81 -40
- data/lib/puppet/parser/functions/inline_epp.rb +35 -60
- data/lib/puppet/parser/functions/inline_template.rb +2 -2
- data/lib/puppet/parser/functions/map.rb +55 -20
- data/lib/puppet/parser/functions/match.rb +27 -12
- data/lib/puppet/parser/functions/reduce.rb +97 -60
- data/lib/puppet/parser/functions/with.rb +16 -8
- data/lib/puppet/parser/resource.rb +103 -21
- data/lib/puppet/parser.rb +3 -0
- data/lib/puppet/plugins/configuration.rb +3 -2
- data/lib/puppet/plugins/data_providers/data_provider.rb +283 -0
- data/lib/puppet/plugins/data_providers/registry.rb +84 -0
- data/lib/puppet/plugins/data_providers.rb +12 -60
- data/lib/puppet/pops/adapters.rb +12 -0
- data/lib/puppet/pops/binder/binder.rb +2 -2
- data/lib/puppet/pops/binder/bindings_checker.rb +1 -1
- data/lib/puppet/pops/binder/bindings_label_provider.rb +3 -1
- data/lib/puppet/pops/binder/bindings_loader.rb +6 -2
- data/lib/puppet/pops/binder/bindings_model_meta.rb +2 -2
- data/lib/puppet/pops/binder/config/binder_config.rb +1 -1
- data/lib/puppet/pops/binder/injector.rb +4 -4
- data/lib/puppet/pops/binder/key_factory.rb +3 -9
- data/lib/puppet/pops/binder/scheme_handler/module_scheme.rb +68 -9
- data/lib/puppet/pops/evaluator/access_operator.rb +27 -60
- data/lib/puppet/pops/evaluator/closure.rb +8 -8
- data/lib/puppet/pops/evaluator/collectors/abstract_collector.rb +1 -1
- data/lib/puppet/pops/evaluator/evaluator_impl.rb +10 -6
- data/lib/puppet/pops/evaluator/literal_evaluator.rb +87 -0
- data/lib/puppet/pops/evaluator/relationship_operator.rb +7 -1
- data/lib/puppet/pops/functions/dispatcher.rb +3 -3
- data/lib/puppet/pops/issues.rb +11 -3
- data/lib/puppet/pops/label_provider.rb +1 -1
- data/lib/puppet/pops/lookup/explainer.rb +402 -0
- data/lib/puppet/pops/lookup/invocation.rb +117 -0
- data/lib/puppet/pops/lookup.rb +25 -47
- data/lib/puppet/pops/merge_strategy.rb +73 -5
- data/lib/puppet/pops/model/factory.rb +38 -3
- data/lib/puppet/pops/model/model_label_provider.rb +10 -1
- data/lib/puppet/pops/model/model_meta.rb +19 -1
- data/lib/puppet/pops/model/model_tree_dumper.rb +18 -0
- data/lib/puppet/pops/parser/code_merger.rb +13 -1
- data/lib/puppet/pops/parser/egrammar.ra +65 -2
- data/lib/puppet/pops/parser/eparser.rb +1569 -1241
- data/lib/puppet/pops/parser/lexer2.rb +32 -1
- data/lib/puppet/pops/parser/locator.rb +1 -1
- data/lib/puppet/pops/parser/parser_support.rb +25 -13
- data/lib/puppet/pops/patterns.rb +3 -0
- data/lib/puppet/pops/types/enumeration.rb +1 -2
- data/lib/puppet/pops/types/type_asserter.rb +16 -15
- data/lib/puppet/pops/types/type_assertion_error.rb +1 -0
- data/lib/puppet/pops/types/type_calculator.rb +171 -1020
- data/lib/puppet/pops/types/type_factory.rb +87 -148
- data/lib/puppet/pops/types/type_mismatch_describer.rb +743 -0
- data/lib/puppet/pops/types/type_parser.rb +118 -129
- data/lib/puppet/pops/types/types.rb +1394 -255
- data/lib/puppet/pops/types/types_meta.rb +0 -234
- data/lib/puppet/pops/validation/checker4_0.rb +49 -1
- data/lib/puppet/pops/validation/validator_factory_4_0.rb +3 -1
- data/lib/puppet/pops/validation.rb +7 -2
- data/lib/puppet/pops.rb +19 -17
- data/lib/puppet/provider/augeas/augeas.rb +50 -0
- data/lib/puppet/provider/exec.rb +6 -1
- data/lib/puppet/provider/group/directoryservice.rb +10 -0
- data/lib/puppet/provider/package/dnf.rb +41 -0
- data/lib/puppet/provider/package/gem.rb +7 -2
- data/lib/puppet/provider/package/nim.rb +1 -1
- data/lib/puppet/provider/package/rpm.rb +1 -0
- data/lib/puppet/provider/package/windows/exe_package.rb +10 -8
- data/lib/puppet/provider/package/windows/msi_package.rb +4 -3
- data/lib/puppet/provider/package/windows/package.rb +9 -1
- data/lib/puppet/provider/package/yum.rb +20 -9
- data/lib/puppet/provider/service/bsd.rb +1 -1
- data/lib/puppet/provider/service/debian.rb +21 -0
- data/lib/puppet/provider/service/init.rb +6 -0
- data/lib/puppet/provider/service/launchd.rb +36 -7
- data/lib/puppet/provider/service/rcng.rb +51 -0
- data/lib/puppet/provider/service/redhat.rb +2 -1
- data/lib/puppet/provider/service/smf.rb +43 -2
- data/lib/puppet/provider/service/src.rb +27 -0
- data/lib/puppet/provider/service/systemd.rb +25 -5
- data/lib/puppet/provider/sshkey/parsed.rb +19 -9
- data/lib/puppet/provider/zone/solaris.rb +2 -2
- data/lib/puppet/reference/configuration.rb +10 -4
- data/lib/puppet/reference/report.rb +9 -12
- data/lib/puppet/reports.rb +5 -1
- data/lib/puppet/resource/capability_finder.rb +95 -0
- data/lib/puppet/resource/catalog.rb +47 -7
- data/lib/puppet/resource/status.rb +0 -2
- data/lib/puppet/resource/type.rb +238 -44
- data/lib/puppet/resource/type_collection.rb +60 -2
- data/lib/puppet/resource.rb +50 -73
- data/lib/puppet/settings/file_setting.rb +10 -9
- data/lib/puppet/settings.rb +2 -2
- data/lib/puppet/ssl/certificate_authority/interface.rb +2 -2
- data/lib/puppet/ssl/oids.rb +9 -1
- data/lib/puppet/transaction/additional_resource_generator.rb +71 -8
- data/lib/puppet/transaction/resource_harness.rb +9 -4
- data/lib/puppet/transaction.rb +8 -1
- data/lib/puppet/type/augeas.rb +8 -0
- data/lib/puppet/type/file/source.rb +14 -12
- data/lib/puppet/type/package.rb +9 -6
- data/lib/puppet/type/user.rb +4 -2
- data/lib/puppet/type.rb +78 -7
- data/lib/puppet/util/command_line.rb +4 -0
- data/lib/puppet/util/execution.rb +18 -2
- data/lib/puppet/util/tagging.rb +7 -1
- data/lib/puppet/util/windows/adsi.rb +5 -2
- data/lib/puppet/util/windows/security.rb +4 -1
- data/lib/puppet/util/windows/taskscheduler.rb +1 -1
- data/lib/puppet/util.rb +9 -1
- data/lib/puppet/version.rb +1 -1
- data/lib/puppet.rb +12 -0
- data/spec/fixtures/unit/application/environments/production/data/common.yaml +3 -0
- data/spec/fixtures/unit/application/environments/production/environment.conf +1 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_bad_syntax_json/data/bad.json +3 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_bad_syntax_json/environment.conf +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_bad_syntax_json/hiera.yaml +5 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_bad_syntax_json/manifests/site.pp +5 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_bad_syntax_yaml/data/bad.yaml +3 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_bad_syntax_yaml/environment.conf +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_bad_syntax_yaml/hiera.yaml +5 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_bad_syntax_yaml/manifests/site.pp +5 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_defaults/data/common.yaml +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_defaults/environment.conf +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_defaults/manifests/site.pp +1 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_defaults/modules/one/data/common.yaml +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_defaults/modules/one/manifests/init.pp +5 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_defaults/modules/one/metadata.json +9 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_env_config/data1/first.json +3 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_env_config/data1/name.yaml +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_env_config/data1/second.json +3 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_env_config/data1/single.yaml +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_env_config/data2/single.yaml +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_env_config/environment.conf +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_env_config/hiera.yaml +18 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_env_config/manifests/site.pp +5 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_misc/data/common.yaml +46 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_misc/environment.conf +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_misc/manifests/site.pp +1 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_misc/modules/one/data/common.yaml +30 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_misc/modules/one/manifests/init.pp +13 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_misc/modules/one/metadata.json +9 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/environment.conf +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/manifests/site.pp +1 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/data1/first.json +3 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/data1/name.yaml +1 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/data1/second.json +3 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/data1/single.yaml +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/data2/single.yaml +2 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/hiera.yaml +18 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/manifests/init.pp +5 -0
- data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/metadata.json +9 -0
- data/spec/fixtures/unit/data_providers/environments/sample/modules/dataprovider/lib/puppet_x/helindbe/sample_env_data.rb +1 -0
- data/spec/fixtures/unit/data_providers/environments/sample/modules/dataprovider/lib/puppet_x/helindbe/sample_module_data.rb +1 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/hieraprovider/data/first.json +3 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/hieraprovider/hiera.yaml +8 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/hieraprovider/manifests/init.pp +5 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/hieraprovider/metadata.json +9 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/meta/lib/puppet/functions/meta/data.rb +9 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/meta/manifests/init.pp +3 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/meta/metadata.json +9 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/metawcp/lib/puppet/bindings/metawcp/default.rb +10 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/metawcp/lib/puppet_x/thallgren/sample_module_data.rb +23 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/metawcp/manifests/init.pp +3 -0
- data/spec/fixtures/unit/functions/lookup/environments/production/modules/metawcp/metadata.json +9 -0
- data/spec/fixtures/unit/provider/package/yum/yum-check-update-security.txt +184 -0
- data/spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_get/should_yield_to_the_block.yml +24 -0
- data/spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_head/should_yield_to_the_block.yml +24 -0
- data/spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_post/should_yield_to_the_block.yml +24 -0
- data/spec/integration/data_binding_spec.rb +229 -0
- data/spec/integration/file_bucket/file_spec.rb +2 -2
- data/spec/integration/parser/compiler_spec.rb +30 -24
- data/spec/integration/parser/resource_expressions_spec.rb +4 -4
- data/spec/integration/parser/undef_param_spec.rb +1 -1
- data/spec/integration/provider/package_spec.rb +3 -1
- data/spec/integration/resource/catalog_spec.rb +1 -1
- data/spec/integration/ssl/certificate_authority_spec.rb +0 -1
- data/spec/integration/ssl/certificate_request_spec.rb +0 -1
- data/spec/integration/ssl/certificate_revocation_list_spec.rb +0 -1
- data/spec/integration/ssl/host_spec.rb +0 -1
- data/spec/integration/type/package_spec.rb +2 -0
- data/spec/integration/util/rdoc/parser_spec.rb +1 -1
- data/spec/integration/util/windows/security_spec.rb +18 -0
- data/spec/lib/matchers/include_in_order.rb +2 -2
- data/spec/shared_behaviours/iterative_functions.rb +8 -8
- data/spec/spec_helper.rb +7 -0
- data/spec/unit/agent/locker_spec.rb +4 -4
- data/spec/unit/agent_spec.rb +0 -8
- data/spec/unit/application/agent_spec.rb +5 -0
- data/spec/unit/application/apply_spec.rb +9 -1
- data/spec/unit/application/filebucket_spec.rb +88 -2
- data/spec/unit/application/lookup_spec.rb +195 -0
- data/spec/unit/application/master_spec.rb +2 -2
- data/spec/unit/application_spec.rb +3 -3
- data/spec/unit/appmgmt_spec.rb +657 -0
- data/spec/unit/capability_spec.rb +414 -0
- data/spec/unit/configurer_spec.rb +7 -1
- data/spec/unit/context/trusted_information_spec.rb +24 -1
- data/spec/unit/daemon_spec.rb +18 -8
- data/spec/unit/data_providers/hiera_data_provider_spec.rb +201 -0
- data/spec/unit/environments_spec.rb +2 -0
- data/spec/unit/face/node_spec.rb +1 -1
- data/spec/unit/file_bucket/dipper_spec.rb +210 -1
- data/spec/unit/file_serving/configuration_spec.rb +1 -1
- data/spec/unit/file_system_spec.rb +20 -0
- data/spec/unit/functions/assert_type_spec.rb +5 -7
- data/spec/unit/functions/defined_spec.rb +2 -2
- data/spec/unit/functions/epp_spec.rb +2 -2
- data/spec/unit/functions/filter_spec.rb +18 -0
- data/spec/unit/functions/hiera_spec.rb +2 -2
- data/spec/unit/functions/lookup_spec.rb +200 -9
- data/spec/unit/functions/regsubst_spec.rb +17 -8
- data/spec/unit/functions/scanf_spec.rb +1 -1
- data/spec/unit/functions/split_spec.rb +2 -2
- data/spec/unit/functions/versioncmp_spec.rb +36 -0
- data/spec/unit/functions4_spec.rb +58 -72
- data/spec/unit/graph/sequential_prioritizer_spec.rb +1 -1
- data/spec/unit/indirector/catalog/compiler_spec.rb +28 -8
- data/spec/unit/indirector/catalog/static_compiler_spec.rb +38 -20
- data/spec/unit/indirector/data_binding/none_spec.rb +2 -2
- data/spec/unit/indirector/file_bucket_file/file_spec.rb +52 -1
- data/spec/unit/indirector/indirection_spec.rb +13 -2
- data/spec/unit/indirector/request_spec.rb +8 -8
- data/spec/unit/indirector/ssl_file_spec.rb +1 -1
- data/spec/unit/indirector/yaml_spec.rb +1 -1
- data/spec/unit/info_service_spec.rb +236 -0
- data/spec/unit/module_tool/application_spec.rb +1 -1
- data/spec/unit/module_tool/applications/builder_spec.rb +1 -1
- data/spec/unit/module_tool/metadata_spec.rb +31 -2
- data/spec/unit/network/authconfig_spec.rb +62 -32
- data/spec/unit/network/authorization_spec.rb +30 -2
- data/spec/unit/network/authstore_spec.rb +1 -1
- data/spec/unit/network/http/compression_spec.rb +1 -1
- data/spec/unit/network/http/connection_spec.rb +14 -19
- data/spec/unit/network/http/handler_spec.rb +0 -5
- data/spec/unit/network/rights_spec.rb +3 -3
- data/spec/unit/node_spec.rb +27 -0
- data/spec/unit/parser/ast/leaf_spec.rb +1 -1
- data/spec/unit/parser/compiler_spec.rb +86 -2
- data/spec/unit/parser/functions/create_resources_spec.rb +1 -1
- data/spec/unit/parser/resource_spec.rb +2 -20
- data/spec/unit/pops/binder/config/binder_config_spec.rb +1 -1
- data/spec/unit/pops/binder/injector_spec.rb +3 -3
- data/spec/unit/pops/evaluator/access_ops_spec.rb +13 -11
- data/spec/unit/pops/evaluator/basic_expressions_spec.rb +1 -2
- data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +20 -11
- data/spec/unit/pops/evaluator/literal_evaluator_spec.rb +43 -0
- data/spec/unit/pops/label_provider_spec.rb +5 -1
- data/spec/unit/pops/parser/lexer2_spec.rb +39 -0
- data/spec/unit/pops/parser/parse_application_spec.rb +40 -0
- data/spec/unit/pops/parser/parse_basic_expressions_spec.rb +4 -0
- data/spec/unit/pops/parser/parse_capabilities_spec.rb +47 -0
- data/spec/unit/pops/parser/parse_site_spec.rb +38 -0
- data/spec/unit/pops/parser/parser_rspec_helper.rb +5 -0
- data/spec/unit/pops/parser/parser_spec.rb +18 -0
- data/spec/unit/pops/types/type_calculator_spec.rb +427 -444
- data/spec/unit/pops/types/type_factory_spec.rb +12 -12
- data/spec/unit/pops/types/type_parser_spec.rb +15 -12
- data/spec/unit/pops/validator/validator_spec.rb +68 -0
- data/spec/unit/property_spec.rb +1 -1
- data/spec/unit/provider/augeas/augeas_spec.rb +50 -0
- data/spec/unit/provider/group/directoryservice_spec.rb +33 -0
- data/spec/unit/provider/group/windows_adsi_spec.rb +3 -0
- data/spec/unit/provider/package/dnf_spec.rb +92 -0
- data/spec/unit/provider/package/gem_spec.rb +7 -0
- data/spec/unit/provider/package/nim_spec.rb +6 -6
- data/spec/unit/provider/package/rpm_spec.rb +25 -2
- data/spec/unit/provider/package/windows/package_spec.rb +41 -0
- data/spec/unit/provider/package/yum_spec.rb +35 -12
- data/spec/unit/provider/scheduled_task/win32_taskscheduler_spec.rb +10 -0
- data/spec/unit/provider/service/debian_spec.rb +28 -0
- data/spec/unit/provider/service/gentoo_spec.rb +1 -0
- data/spec/unit/provider/service/init_spec.rb +6 -0
- data/spec/unit/provider/service/launchd_spec.rb +85 -10
- data/spec/unit/provider/service/openrc_spec.rb +1 -0
- data/spec/unit/provider/service/rcng_spec.rb +41 -0
- data/spec/unit/provider/service/redhat_spec.rb +8 -1
- data/spec/unit/provider/service/smf_spec.rb +30 -5
- data/spec/unit/provider/service/src_spec.rb +20 -4
- data/spec/unit/provider/service/systemd_spec.rb +79 -29
- data/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +1 -1
- data/spec/unit/provider/sshkey/parsed_spec.rb +23 -0
- data/spec/unit/provider/user/windows_adsi_spec.rb +2 -1
- data/spec/unit/provider/zone/solaris_spec.rb +19 -0
- data/spec/unit/reports_spec.rb +10 -0
- data/spec/unit/resource/capability_finder_spec.rb +56 -0
- data/spec/unit/resource/catalog_spec.rb +31 -8
- data/spec/unit/resource/type_collection_spec.rb +23 -2
- data/spec/unit/resource/type_spec.rb +1 -1
- data/spec/unit/resource_spec.rb +23 -5
- data/spec/unit/settings/file_setting_spec.rb +31 -0
- data/spec/unit/settings_spec.rb +91 -2
- data/spec/unit/ssl/certificate_authority/interface_spec.rb +4 -3
- data/spec/unit/ssl/certificate_authority_spec.rb +5 -3
- data/spec/unit/ssl/host_spec.rb +2 -2
- data/spec/unit/ssl/oids_spec.rb +8 -0
- data/spec/unit/transaction/additional_resource_generator_spec.rb +78 -5
- data/spec/unit/transaction/report_spec.rb +24 -1
- data/spec/unit/transaction_spec.rb +7 -0
- data/spec/unit/type/exec_spec.rb +16 -8
- data/spec/unit/type/host_spec.rb +4 -4
- data/spec/unit/type/package_spec.rb +1 -0
- data/spec/unit/type/tidy_spec.rb +4 -4
- data/spec/unit/type/user_spec.rb +14 -7
- data/spec/unit/type/vlan_spec.rb +1 -1
- data/spec/unit/type_spec.rb +1 -1
- data/spec/unit/util/ldap/generator_spec.rb +1 -1
- data/spec/unit/util/network_device/cisco/device_spec.rb +1 -1
- data/spec/unit/util/network_device/transport/ssh_spec.rb +1 -1
- data/spec/unit/util/network_device_spec.rb +1 -1
- data/spec/unit/util/storage_spec.rb +5 -1
- data/spec/unit/util/windows/adsi_spec.rb +13 -0
- data/spec/unit/util_spec.rb +21 -2
- metadata +173 -7
- data/lib/puppet/pops/evaluator/callable_mismatch_describer.rb +0 -175
- data/spec/integration/data_binding.rb +0 -104
|
@@ -11,7 +11,7 @@ Puppet::Type.type(:package).provide :yum, :parent => :rpm, :source => :rpm do
|
|
|
11
11
|
|
|
12
12
|
has_feature :install_options, :versionable, :virtual_packages
|
|
13
13
|
|
|
14
|
-
commands :
|
|
14
|
+
commands :cmd => "yum", :rpm => "rpm"
|
|
15
15
|
|
|
16
16
|
if command('rpm')
|
|
17
17
|
confine :true => begin
|
|
@@ -67,7 +67,7 @@ Puppet::Type.type(:package).provide :yum, :parent => :rpm, :source => :rpm do
|
|
|
67
67
|
# @return [Hash<String, Array<Hash<String, String>>>] All packages that were
|
|
68
68
|
# found with a list of found versions for each package.
|
|
69
69
|
def self.check_updates(enablerepo, disablerepo, disableexcludes)
|
|
70
|
-
args = [command(:
|
|
70
|
+
args = [command(:cmd), 'check-update']
|
|
71
71
|
args.concat(enablerepo.map { |repo| ["--enablerepo=#{repo}"] }.flatten)
|
|
72
72
|
args.concat(disablerepo.map { |repo| ["--disablerepo=#{repo}"] }.flatten)
|
|
73
73
|
args.concat(disableexcludes.map { |repo| ["--disableexcludes=#{repo}"] }.flatten)
|
|
@@ -78,9 +78,9 @@ Puppet::Type.type(:package).provide :yum, :parent => :rpm, :source => :rpm do
|
|
|
78
78
|
if output.exitstatus == 100
|
|
79
79
|
updates = parse_updates(output)
|
|
80
80
|
elsif output.exitstatus == 0
|
|
81
|
-
self.debug "
|
|
81
|
+
self.debug "#{command(:cmd)} check-update exited with 0; no package updates available."
|
|
82
82
|
else
|
|
83
|
-
self.warn "Could not check for updates, '
|
|
83
|
+
self.warn "Could not check for updates, '#{command(:cmd)} check-update' exited with #{output.exitstatus}"
|
|
84
84
|
end
|
|
85
85
|
updates
|
|
86
86
|
end
|
|
@@ -91,7 +91,7 @@ Puppet::Type.type(:package).provide :yum, :parent => :rpm, :source => :rpm do
|
|
|
91
91
|
|
|
92
92
|
updates = Hash.new { |h, k| h[k] = [] }
|
|
93
93
|
body.split.each_slice(3) do |tuple|
|
|
94
|
-
break if tuple[0] =~ /^Obsoleting/
|
|
94
|
+
break if tuple[0] =~ /^(Obsoleting|Security:)/
|
|
95
95
|
hash = update_to_hash(*tuple[0..1])
|
|
96
96
|
# Create entries for both the package name without a version and a
|
|
97
97
|
# version since yum considers those as mostly interchangeable.
|
|
@@ -126,11 +126,16 @@ Puppet::Type.type(:package).provide :yum, :parent => :rpm, :source => :rpm do
|
|
|
126
126
|
@latest_versions = nil
|
|
127
127
|
end
|
|
128
128
|
|
|
129
|
+
def self.error_level
|
|
130
|
+
'0'
|
|
131
|
+
end
|
|
132
|
+
|
|
129
133
|
def install
|
|
130
134
|
wanted = @resource[:name]
|
|
135
|
+
error_level = self.class.error_level
|
|
131
136
|
# If not allowing virtual packages, do a query to ensure a real package exists
|
|
132
137
|
unless @resource.allow_virtual?
|
|
133
|
-
|
|
138
|
+
execute([command(:cmd), '-d', '0', '-e', error_level, '-y', install_options, :list, wanted].compact)
|
|
134
139
|
end
|
|
135
140
|
|
|
136
141
|
should = @resource.should(:ensure)
|
|
@@ -151,9 +156,15 @@ Puppet::Type.type(:package).provide :yum, :parent => :rpm, :source => :rpm do
|
|
|
151
156
|
end
|
|
152
157
|
end
|
|
153
158
|
|
|
154
|
-
|
|
155
|
-
|
|
159
|
+
# Yum on el-4 and el-5 returns exit status 0 when trying to install a package it doesn't recognize;
|
|
160
|
+
# ensure we capture output to check for errors.
|
|
161
|
+
no_debug = if Facter.value(:operatingsystemmajrelease).to_i > 5 then ["-d", "0"] else [] end
|
|
162
|
+
command = [command(:cmd)] + no_debug + ["-e", error_level, "-y", install_options, operation, wanted].compact
|
|
163
|
+
output = execute(command)
|
|
156
164
|
|
|
165
|
+
if output =~ /^No package #{wanted} available\.$/
|
|
166
|
+
raise Puppet::Error, "Could not find package #{wanted}"
|
|
167
|
+
end
|
|
157
168
|
|
|
158
169
|
# If a version was specified, query again to see if it is a matching version
|
|
159
170
|
if should
|
|
@@ -188,7 +199,7 @@ Puppet::Type.type(:package).provide :yum, :parent => :rpm, :source => :rpm do
|
|
|
188
199
|
end
|
|
189
200
|
|
|
190
201
|
def purge
|
|
191
|
-
|
|
202
|
+
execute([command(:cmd), "-y", :erase, @resource[:name]])
|
|
192
203
|
end
|
|
193
204
|
|
|
194
205
|
# parse a yum "version" specification
|
|
@@ -5,7 +5,7 @@ Puppet::Type.type(:service).provide :bsd, :parent => :init do
|
|
|
5
5
|
Uses `rc.conf.d` for service enabling and disabling.
|
|
6
6
|
EOT
|
|
7
7
|
|
|
8
|
-
confine :operatingsystem => [:freebsd, :
|
|
8
|
+
confine :operatingsystem => [:freebsd, :dragonfly]
|
|
9
9
|
|
|
10
10
|
def rcconf_dir
|
|
11
11
|
'/etc/rc.conf.d'
|
|
@@ -63,4 +63,25 @@ Puppet::Type.type(:service).provide :debian, :parent => :init do
|
|
|
63
63
|
update_rc "-f", @resource[:name], "remove"
|
|
64
64
|
update_rc @resource[:name], "defaults"
|
|
65
65
|
end
|
|
66
|
+
|
|
67
|
+
def statuscmd
|
|
68
|
+
os = Facter.value(:operatingsystem).downcase
|
|
69
|
+
|
|
70
|
+
if os == 'debian'
|
|
71
|
+
majversion = Facter.value(:operatingsystemmajrelease).to_i
|
|
72
|
+
else
|
|
73
|
+
majversion = Facter.value(:operatingsystemmajrelease).split('.')[0].to_i
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
if ((os == 'debian' && majversion >= 8) || (os == 'ubuntu' && majversion >= 15))
|
|
78
|
+
# SysVInit scripts will always return '0' for status when the service is masked,
|
|
79
|
+
# even if the service is actually stopped. Use the SysVInit-Systemd compatibility
|
|
80
|
+
# layer to determine the actual status. This is only necessary when the SysVInit
|
|
81
|
+
# version of a service is queried. I.e, 'ntp' instead of 'ntp.service'.
|
|
82
|
+
(@resource[:hasstatus] == :true) && ["systemctl", "is-active", @resource[:name]]
|
|
83
|
+
else
|
|
84
|
+
super
|
|
85
|
+
end
|
|
86
|
+
end
|
|
66
87
|
end
|
|
@@ -16,6 +16,12 @@ Puppet::Type.type(:service).provide :init, :parent => :base do
|
|
|
16
16
|
end
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
+
# Debian and Ubuntu should use the Debian provider.
|
|
20
|
+
confine :true => begin
|
|
21
|
+
os = Facter.value(:operatingsystem).downcase
|
|
22
|
+
!(os == 'debian' || os == 'ubuntu')
|
|
23
|
+
end
|
|
24
|
+
|
|
19
25
|
# We can't confine this here, because the init path can be overridden.
|
|
20
26
|
#confine :exists => defpath
|
|
21
27
|
|
|
@@ -65,12 +65,27 @@ Puppet::Type.type(:service).provide :launchd, :parent => :base do
|
|
|
65
65
|
]
|
|
66
66
|
end
|
|
67
67
|
|
|
68
|
+
# Gets the current Darwin version, example 10.6 returns 9 and 10.10 returns 14
|
|
69
|
+
# See https://en.wikipedia.org/wiki/Darwin_(operating_system)#Release_history
|
|
70
|
+
# for more information.
|
|
71
|
+
#
|
|
72
|
+
# @api private
|
|
73
|
+
def self.get_os_version
|
|
74
|
+
@os_version ||= Facter.value(:operatingsystemmajrelease).to_i
|
|
75
|
+
end
|
|
76
|
+
|
|
68
77
|
# Defines the path to the overrides plist file where service enabling
|
|
69
78
|
# behavior is defined in 10.6 and greater.
|
|
70
79
|
#
|
|
80
|
+
# With the rewrite of launchd in 10.10+, this moves and slightly changes format.
|
|
81
|
+
#
|
|
71
82
|
# @api private
|
|
72
83
|
def self.launchd_overrides
|
|
73
|
-
|
|
84
|
+
if self.get_os_version < 14
|
|
85
|
+
"/var/db/launchd.db/com.apple.launchd/overrides.plist"
|
|
86
|
+
else
|
|
87
|
+
"/var/db/com.apple.xpc.launchd/disabled.plist"
|
|
88
|
+
end
|
|
74
89
|
end
|
|
75
90
|
|
|
76
91
|
# Caching is enabled through the following three methods. Self.prefetch will
|
|
@@ -219,8 +234,10 @@ Puppet::Type.type(:service).provide :launchd, :parent => :base do
|
|
|
219
234
|
did_enable_job = false
|
|
220
235
|
cmds = []
|
|
221
236
|
cmds << :launchctl << :load
|
|
237
|
+
# always add -w so it always starts the job, it is a noop if it is not needed, this means we do
|
|
238
|
+
# not have to rescan all launchd plists.
|
|
239
|
+
cmds << "-w"
|
|
222
240
|
if self.enabled? == :false || self.status == :stopped # launchctl won't load disabled jobs
|
|
223
|
-
cmds << "-w"
|
|
224
241
|
did_enable_job = true
|
|
225
242
|
end
|
|
226
243
|
cmds << job_path
|
|
@@ -277,7 +294,11 @@ Puppet::Type.type(:service).provide :launchd, :parent => :base do
|
|
|
277
294
|
|
|
278
295
|
if FileTest.file?(self.class.launchd_overrides) and overrides = self.class.read_plist(self.class.launchd_overrides)
|
|
279
296
|
if overrides.has_key?(resource[:name])
|
|
280
|
-
|
|
297
|
+
if self.class.get_os_version < 14
|
|
298
|
+
overrides_disabled = overrides[resource[:name]]["Disabled"] if overrides[resource[:name]].has_key?("Disabled")
|
|
299
|
+
else
|
|
300
|
+
overrides_disabled = overrides[resource[:name]]
|
|
301
|
+
end
|
|
281
302
|
end
|
|
282
303
|
end
|
|
283
304
|
|
|
@@ -296,13 +317,21 @@ Puppet::Type.type(:service).provide :launchd, :parent => :base do
|
|
|
296
317
|
# without actually loading/unloading the job.
|
|
297
318
|
def enable
|
|
298
319
|
overrides = self.class.read_plist(self.class.launchd_overrides)
|
|
299
|
-
|
|
320
|
+
if self.class.get_os_version < 14
|
|
321
|
+
overrides[resource[:name]] = { "Disabled" => false }
|
|
322
|
+
else
|
|
323
|
+
overrides[resource[:name]] = false
|
|
324
|
+
end
|
|
300
325
|
Plist::Emit.save_plist(overrides, self.class.launchd_overrides)
|
|
301
326
|
end
|
|
302
327
|
|
|
303
328
|
def disable
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
329
|
+
overrides = self.class.read_plist(self.class.launchd_overrides)
|
|
330
|
+
if self.class.get_os_version < 14
|
|
331
|
+
overrides[resource[:name]] = { "Disabled" => true }
|
|
332
|
+
else
|
|
333
|
+
overrides[resource[:name]] = true
|
|
334
|
+
end
|
|
335
|
+
Plist::Emit.save_plist(overrides, self.class.launchd_overrides)
|
|
307
336
|
end
|
|
308
337
|
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
Puppet::Type.type(:service).provide :rcng, :parent => :bsd do
|
|
2
|
+
desc <<-EOT
|
|
3
|
+
RCng service management with rc.d
|
|
4
|
+
EOT
|
|
5
|
+
|
|
6
|
+
defaultfor :operatingsystem => [:netbsd, :cargos]
|
|
7
|
+
confine :operatingsystem => [:netbsd, :cargos]
|
|
8
|
+
|
|
9
|
+
def self.defpath
|
|
10
|
+
"/etc/rc.d"
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# if the service file exists in rc.conf.d AND matches an expected pattern
|
|
14
|
+
# then it's already enabled
|
|
15
|
+
def enabled?
|
|
16
|
+
rcfile = File.join(rcconf_dir, @resource[:name])
|
|
17
|
+
if Puppet::FileSystem.exist?(rcfile)
|
|
18
|
+
File.open(rcfile).readlines.each do |line|
|
|
19
|
+
# Now look for something that looks like "service=${service:=YES}" or "service=YES"
|
|
20
|
+
if line.match(/^\s*#{@resource[:name]}=(?:YES|\${#{@resource[:name]}:=YES})/)
|
|
21
|
+
return :true
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
:false
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# enable service by creating a service file under rc.conf.d with the
|
|
30
|
+
# proper contents, or by modifying it's contents to to enable the service.
|
|
31
|
+
def enable
|
|
32
|
+
Dir.mkdir(rcconf_dir) if not Puppet::FileSystem.exist?(rcconf_dir)
|
|
33
|
+
rcfile = File.join(rcconf_dir, @resource[:name])
|
|
34
|
+
if Puppet::FileSystem.exist?(rcfile)
|
|
35
|
+
newcontents = []
|
|
36
|
+
File.open(rcfile).readlines.each do |line|
|
|
37
|
+
if line.match(/^\s*#{@resource[:name]}=(NO|\$\{#{@resource[:name]}:NO\})/)
|
|
38
|
+
line = "#{@resource[:name]}=${#{@resource[:name]}:=YES}"
|
|
39
|
+
end
|
|
40
|
+
newcontents.push(line)
|
|
41
|
+
end
|
|
42
|
+
Puppet::Util.replace_file(rcfile, 0644) do |f|
|
|
43
|
+
f.puts newcontents
|
|
44
|
+
end
|
|
45
|
+
else
|
|
46
|
+
Puppet::Util.replace_file(rcfile, 0644) do |f|
|
|
47
|
+
f.puts "%s=${%s:=YES}\n" % [@resource[:name], @resource[:name]]
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
@@ -8,7 +8,8 @@ Puppet::Type.type(:service).provide :redhat, :parent => :init, :source => :init
|
|
|
8
8
|
|
|
9
9
|
commands :chkconfig => "/sbin/chkconfig", :service => "/sbin/service"
|
|
10
10
|
|
|
11
|
-
defaultfor :osfamily =>
|
|
11
|
+
defaultfor :osfamily => :redhat
|
|
12
|
+
defaultfor :osfamily => :suse, :operatingsystemmajrelease => ["10", "11"]
|
|
12
13
|
|
|
13
14
|
# Remove the symlinks
|
|
14
15
|
def disable
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require 'timeout'
|
|
2
|
+
|
|
1
3
|
# Solaris 10 SMF-style services.
|
|
2
4
|
Puppet::Type.type(:service).provide :smf, :parent => :base do
|
|
3
5
|
desc <<-EOT
|
|
@@ -32,7 +34,7 @@ Puppet::Type.type(:service).provide :smf, :parent => :base do
|
|
|
32
34
|
end
|
|
33
35
|
|
|
34
36
|
def self.instances
|
|
35
|
-
svcs.split("\n").select{|l| l !~ /^legacy_run/ }.collect do |line|
|
|
37
|
+
svcs("-H").split("\n").select{|l| l !~ /^legacy_run/ }.collect do |line|
|
|
36
38
|
state,stime,fmri = line.split(/\s+/)
|
|
37
39
|
status = case state
|
|
38
40
|
when /online/; :running
|
|
@@ -74,6 +76,45 @@ Puppet::Type.type(:service).provide :smf, :parent => :base do
|
|
|
74
76
|
end
|
|
75
77
|
end
|
|
76
78
|
|
|
79
|
+
# Wait for the service to transition into the specified state before returning.
|
|
80
|
+
# This is necessary due to the asynchronous nature of SMF services.
|
|
81
|
+
# desired_state should be online, offline, disabled, or uninitialized.
|
|
82
|
+
# See PUP-5474 for long-term solution to this issue.
|
|
83
|
+
def wait(*desired_state)
|
|
84
|
+
Timeout.timeout(60) do
|
|
85
|
+
loop do
|
|
86
|
+
states = self.service_states
|
|
87
|
+
break if desired_state.include?(states[0]) && states[1] == '-'
|
|
88
|
+
sleep(1)
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
rescue Timeout::Error
|
|
92
|
+
raise Puppet::Error.new("Timed out waiting for #{@resource[:name]} to transition states")
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
def start
|
|
96
|
+
# Wait for the service to actually start before returning.
|
|
97
|
+
super
|
|
98
|
+
self.wait('online')
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def stop
|
|
102
|
+
# Wait for the service to actually stop before returning.
|
|
103
|
+
super
|
|
104
|
+
self.wait('offline', 'disabled', 'uninitialized')
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def restart
|
|
108
|
+
# Wait for the service to actually start before returning.
|
|
109
|
+
super
|
|
110
|
+
self.wait('online')
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# Determine the current and next states of a service.
|
|
114
|
+
def service_states
|
|
115
|
+
svcs("-H", "-o", "state,nstate", @resource[:name]).chomp.split
|
|
116
|
+
end
|
|
117
|
+
|
|
77
118
|
def status
|
|
78
119
|
if @resource[:status]
|
|
79
120
|
super
|
|
@@ -83,7 +124,7 @@ Puppet::Type.type(:service).provide :smf, :parent => :base do
|
|
|
83
124
|
begin
|
|
84
125
|
# get the current state and the next state, and if the next
|
|
85
126
|
# state is set (i.e. not "-") use it for state comparison
|
|
86
|
-
states =
|
|
127
|
+
states = service_states
|
|
87
128
|
state = states[1] == "-" ? states[0] : states[1]
|
|
88
129
|
rescue Puppet::ExecutionFailure
|
|
89
130
|
info "Could not get status on service #{self.name}"
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require 'timeout'
|
|
2
|
+
|
|
1
3
|
# AIX System Resource controller (SRC)
|
|
2
4
|
Puppet::Type.type(:service).provide :src, :parent => :base do
|
|
3
5
|
|
|
@@ -63,6 +65,31 @@ Puppet::Type.type(:service).provide :src, :parent => :base do
|
|
|
63
65
|
rmitab(@resource[:name])
|
|
64
66
|
end
|
|
65
67
|
|
|
68
|
+
# Wait for the service to transition into the specified state before returning.
|
|
69
|
+
# This is necessary due to the asynchronous nature of AIX services.
|
|
70
|
+
# desired_state should either be :running or :stopped.
|
|
71
|
+
def wait(desired_state)
|
|
72
|
+
Timeout.timeout(60) do
|
|
73
|
+
loop do
|
|
74
|
+
status = self.status
|
|
75
|
+
break if status == desired_state.to_sym
|
|
76
|
+
sleep(1)
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
rescue Timeout::Error
|
|
80
|
+
raise Puppet::Error.new("Timed out waiting for #{@resource[:name]} to transition states")
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def start
|
|
84
|
+
super
|
|
85
|
+
self.wait(:running)
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def stop
|
|
89
|
+
super
|
|
90
|
+
self.wait(:stopped)
|
|
91
|
+
end
|
|
92
|
+
|
|
66
93
|
def restart
|
|
67
94
|
execute([command(:lssrc), "-Ss", @resource[:name]]).each_line do |line|
|
|
68
95
|
args = line.split(":")
|
|
@@ -10,7 +10,7 @@ Puppet::Type.type(:service).provide :systemd, :parent => :base do
|
|
|
10
10
|
defaultfor :osfamily => [:archlinux]
|
|
11
11
|
defaultfor :osfamily => :redhat, :operatingsystemmajrelease => "7"
|
|
12
12
|
defaultfor :osfamily => :redhat, :operatingsystem => :fedora
|
|
13
|
-
defaultfor :osfamily => :suse
|
|
13
|
+
defaultfor :osfamily => :suse
|
|
14
14
|
defaultfor :operatingsystem => :debian, :operatingsystemmajrelease => "8"
|
|
15
15
|
defaultfor :operatingsystem => :ubuntu, :operatingsystemmajrelease => "15.04"
|
|
16
16
|
|
|
@@ -32,7 +32,14 @@ Puppet::Type.type(:service).provide :systemd, :parent => :base do
|
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
def get_start_link_count
|
|
35
|
-
|
|
35
|
+
# Start links don't include '.service'. Just search for the service name.
|
|
36
|
+
if @resource[:name].match(/\.service/)
|
|
37
|
+
link_name = @resource[:name].split('.')[0]
|
|
38
|
+
else
|
|
39
|
+
link_name = @resource[:name]
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
Dir.glob("/etc/rc*.d/S??#{link_name}").length
|
|
36
43
|
end
|
|
37
44
|
|
|
38
45
|
def enabled?
|
|
@@ -59,7 +66,7 @@ Puppet::Type.type(:service).provide :systemd, :parent => :base do
|
|
|
59
66
|
# flapping when simply trying to disable a masked service.
|
|
60
67
|
return :mask if (@resource[:enable] == :mask) && (svc_info[:LoadState] == 'masked')
|
|
61
68
|
return :true if svc_info[:UnitFileState] == 'enabled'
|
|
62
|
-
if Facter.value(:osfamily) == 'debian'
|
|
69
|
+
if Facter.value(:osfamily).downcase == 'debian'
|
|
63
70
|
ret = debian_enabled?(svc_info)
|
|
64
71
|
return ret if ret
|
|
65
72
|
end
|
|
@@ -72,6 +79,11 @@ Puppet::Type.type(:service).provide :systemd, :parent => :base do
|
|
|
72
79
|
return :false
|
|
73
80
|
end
|
|
74
81
|
|
|
82
|
+
# This method is required for Debian systems due to the way the SysVInit-Systemd
|
|
83
|
+
# compatibility layer works. When we are trying to manage a service which does not
|
|
84
|
+
# have a Systemd unit file, we need to go through the old init script to determine
|
|
85
|
+
# whether it is enabled or not. See PUP-5016 for more details.
|
|
86
|
+
#
|
|
75
87
|
def debian_enabled?(svc_info)
|
|
76
88
|
# If UnitFileState == UnitFileState then we query the older way.
|
|
77
89
|
if svc_info[:UnitFileState] == 'UnitFileState'
|
|
@@ -105,7 +117,7 @@ Puppet::Type.type(:service).provide :systemd, :parent => :base do
|
|
|
105
117
|
end
|
|
106
118
|
|
|
107
119
|
def enable
|
|
108
|
-
|
|
120
|
+
self.unmask
|
|
109
121
|
output = systemctl("enable", @resource[:name])
|
|
110
122
|
rescue Puppet::ExecutionFailure
|
|
111
123
|
raise Puppet::Error, "Could not enable #{self.name}: #{output}", $!.backtrace
|
|
@@ -113,7 +125,6 @@ Puppet::Type.type(:service).provide :systemd, :parent => :base do
|
|
|
113
125
|
|
|
114
126
|
def mask
|
|
115
127
|
self.disable
|
|
116
|
-
|
|
117
128
|
begin
|
|
118
129
|
output = systemctl("mask", @resource[:name])
|
|
119
130
|
rescue Puppet::ExecutionFailure
|
|
@@ -121,11 +132,20 @@ Puppet::Type.type(:service).provide :systemd, :parent => :base do
|
|
|
121
132
|
end
|
|
122
133
|
end
|
|
123
134
|
|
|
135
|
+
def unmask
|
|
136
|
+
begin
|
|
137
|
+
output = systemctl("unmask", @resource[:name])
|
|
138
|
+
rescue Puppet::ExecutionFailure
|
|
139
|
+
raise Puppet::Error, "Could not unmask #{self.name}: #{output}", $!.backtrace
|
|
140
|
+
end
|
|
141
|
+
end
|
|
142
|
+
|
|
124
143
|
def restartcmd
|
|
125
144
|
[command(:systemctl), "restart", @resource[:name]]
|
|
126
145
|
end
|
|
127
146
|
|
|
128
147
|
def startcmd
|
|
148
|
+
self.unmask
|
|
129
149
|
[command(:systemctl), "start", @resource[:name]]
|
|
130
150
|
end
|
|
131
151
|
|
|
@@ -1,17 +1,8 @@
|
|
|
1
1
|
require 'puppet/provider/parsedfile'
|
|
2
2
|
|
|
3
|
-
known = nil
|
|
4
|
-
case Facter.value(:operatingsystem)
|
|
5
|
-
when "Darwin"; known = "/etc/ssh_known_hosts"
|
|
6
|
-
else
|
|
7
|
-
known = "/etc/ssh/ssh_known_hosts"
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
|
|
11
3
|
Puppet::Type.type(:sshkey).provide(
|
|
12
4
|
:parsed,
|
|
13
5
|
:parent => Puppet::Provider::ParsedFile,
|
|
14
|
-
:default_target => known,
|
|
15
6
|
:filetype => :flat
|
|
16
7
|
) do
|
|
17
8
|
desc "Parse and generate host-wide known hosts files for SSH."
|
|
@@ -36,5 +27,24 @@ Puppet::Type.type(:sshkey).provide(
|
|
|
36
27
|
def self.default_mode
|
|
37
28
|
0644
|
|
38
29
|
end
|
|
30
|
+
|
|
31
|
+
def self.default_target
|
|
32
|
+
case Facter.value(:operatingsystem)
|
|
33
|
+
when "Darwin"
|
|
34
|
+
# Versions 10.11 and up use /etc/ssh/ssh_known_hosts
|
|
35
|
+
version = Facter.value(:macosx_productversion_major)
|
|
36
|
+
if version
|
|
37
|
+
if Puppet::Util::Package.versioncmp(version, '10.11') >= 0
|
|
38
|
+
"/etc/ssh/ssh_known_hosts"
|
|
39
|
+
else
|
|
40
|
+
"/etc/ssh_known_hosts"
|
|
41
|
+
end
|
|
42
|
+
else
|
|
43
|
+
"/etc/ssh_known_hosts"
|
|
44
|
+
end
|
|
45
|
+
else
|
|
46
|
+
"/etc/ssh/ssh_known_hosts"
|
|
47
|
+
end
|
|
48
|
+
end
|
|
39
49
|
end
|
|
40
50
|
|
|
@@ -234,10 +234,10 @@ Puppet::Type.type(:zone).provide(:solaris) do
|
|
|
234
234
|
end
|
|
235
235
|
current[$1.intern] = $2
|
|
236
236
|
else
|
|
237
|
-
|
|
237
|
+
err "Ignoring '#{line}'"
|
|
238
238
|
end
|
|
239
239
|
else
|
|
240
|
-
|
|
240
|
+
debug "Ignoring zone output '#{line}'"
|
|
241
241
|
end
|
|
242
242
|
end
|
|
243
243
|
|
|
@@ -22,10 +22,16 @@ config = Puppet::Util::Reference.newreference(:configuration, :depth => 1, :doc
|
|
|
22
22
|
|
|
23
23
|
# Now print the data about the item.
|
|
24
24
|
val = object.default
|
|
25
|
-
if name.to_s ==
|
|
26
|
-
val =
|
|
27
|
-
elsif name.to_s ==
|
|
28
|
-
val =
|
|
25
|
+
if name.to_s == 'vardir'
|
|
26
|
+
val = 'Unix/Linux: /opt/puppetlabs/puppet/cache -- Windows: C:\ProgramData\PuppetLabs\puppet\cache -- Non-root user: ~/.puppetlabs/opt/puppet/cache'
|
|
27
|
+
elsif name.to_s == 'confdir'
|
|
28
|
+
val = 'Unix/Linux: /etc/puppetlabs/puppet -- Windows: C:\ProgramData\PuppetLabs\puppet\etc -- Non-root user: ~/.puppetlabs/etc/puppet'
|
|
29
|
+
elsif name.to_s == 'codedir'
|
|
30
|
+
val = 'Unix/Linux: /etc/puppetlabs/code -- Windows: C:\ProgramData\PuppetLabs\code -- Non-root user: ~/.puppetlabs/etc/code'
|
|
31
|
+
elsif name.to_s == 'rundir'
|
|
32
|
+
val = 'Unix/Linux: /var/run/puppetlabs -- Windows: C:\ProgramData\PuppetLabs\puppet\var\run -- Non-root user: ~/.puppetlabs/var/run'
|
|
33
|
+
elsif name.to_s == 'logdir'
|
|
34
|
+
val = 'Unix/Linux: /var/log/puppetlabs/puppet -- Windows: C:\ProgramData\PuppetLabs\puppet\var\log -- Non-root user: ~/.puppetlabs/var/log'
|
|
29
35
|
end
|
|
30
36
|
|
|
31
37
|
# Leave out the section information; it was apparently confusing people.
|
|
@@ -5,19 +5,16 @@ report = Puppet::Util::Reference.newreference :report, :doc => "All available tr
|
|
|
5
5
|
end
|
|
6
6
|
|
|
7
7
|
report.header = "
|
|
8
|
-
Puppet
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
to collect. See [Reports and Reporting](http://docs.puppetlabs.com/guides/reporting.html) for more information on how to use reports.
|
|
8
|
+
Puppet can generate a report after applying a catalog. This report includes
|
|
9
|
+
events, log messages, resource statuses, and metrics and metadata about the run.
|
|
10
|
+
Puppet agent sends its report to a Puppet master server, and Puppet apply
|
|
11
|
+
processes its own reports.
|
|
13
12
|
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
Puppet master and Puppet apply will handle every report with a set of report
|
|
14
|
+
processors, configurable with the `reports` setting in puppet.conf. This page
|
|
15
|
+
documents the built-in report processors.
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
reports entirely.
|
|
20
|
-
|
|
21
|
-
Puppet provides multiple report handlers that will process client reports:
|
|
17
|
+
See [About Reporting](https://docs.puppetlabs.com/puppet/latest/reference/reporting_about.html)
|
|
18
|
+
for more details.
|
|
22
19
|
|
|
23
20
|
"
|
data/lib/puppet/reports.rb
CHANGED
|
@@ -54,7 +54,11 @@ class Puppet::Reports
|
|
|
54
54
|
def self.register_report(name, options = {}, &block)
|
|
55
55
|
name = name.intern
|
|
56
56
|
|
|
57
|
-
mod = genmodule(name,
|
|
57
|
+
mod = genmodule(name,
|
|
58
|
+
:extend => Puppet::Util::Docs,
|
|
59
|
+
:hash => instance_hash(:report),
|
|
60
|
+
:overwrite => true,
|
|
61
|
+
:block => block)
|
|
58
62
|
|
|
59
63
|
mod.useyaml = true if options[:useyaml]
|
|
60
64
|
|