puppet 4.5.3-x86-mingw32 → 4.6.1-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 +7 -0
- data/Gemfile +10 -1
- data/ext/debian/control +2 -4
- data/ext/project_data.yaml +4 -4
- data/install.rb +6 -2
- data/lib/puppet.rb +3 -1
- data/lib/puppet/agent/locker.rb +1 -1
- data/lib/puppet/application.rb +6 -4
- data/lib/puppet/application/agent.rb +2 -1
- data/lib/puppet/application/cert.rb +35 -2
- data/lib/puppet/application/device.rb +1 -1
- data/lib/puppet/application/generate.rb +5 -0
- data/lib/puppet/application/lookup.rb +3 -3
- data/lib/puppet/application_support.rb +1 -1
- data/lib/puppet/compilable_resource_type.rb +15 -0
- data/lib/puppet/configurer.rb +67 -10
- data/lib/puppet/configurer/plugin_handler.rb +2 -4
- data/lib/puppet/data_providers/hiera_config.rb +1 -1
- data/lib/puppet/defaults.rb +34 -7
- data/lib/puppet/environments.rb +4 -2
- data/lib/puppet/error.rb +1 -1
- data/lib/puppet/external/dot.rb +1 -1
- data/lib/puppet/face/ca.rb +4 -1
- data/lib/puppet/face/certificate.rb +7 -1
- data/lib/puppet/face/epp.rb +5 -5
- data/lib/puppet/face/generate.rb +64 -0
- data/lib/puppet/face/help.rb +19 -13
- data/lib/puppet/face/man.rb +1 -1
- data/lib/puppet/feature/external_facts.rb +1 -1
- data/lib/puppet/file_system.rb +16 -0
- data/lib/puppet/file_system/file_impl.rb +5 -0
- data/lib/puppet/file_system/memory_impl.rb +4 -0
- data/lib/puppet/file_system/path_pattern.rb +1 -0
- data/lib/puppet/file_system/windows.rb +19 -0
- data/lib/puppet/functions.rb +3 -5
- data/lib/puppet/functions/assert_type.rb +1 -1
- data/lib/puppet/functions/defined.rb +7 -5
- data/lib/puppet/functions/dig.rb +2 -18
- data/lib/puppet/functions/hiera.rb +1 -1
- data/lib/puppet/functions/lest.rb +1 -37
- data/lib/puppet/functions/new.rb +2 -473
- data/lib/puppet/functions/reverse_each.rb +2 -59
- data/lib/puppet/functions/scanf.rb +4 -4
- data/lib/puppet/functions/step.rb +1 -63
- data/lib/puppet/functions/then.rb +1 -61
- data/lib/puppet/functions/type.rb +1 -40
- data/lib/puppet/functions/unwrap.rb +40 -0
- data/lib/puppet/generate/models/type/property.rb +70 -0
- data/lib/puppet/generate/models/type/type.rb +57 -0
- data/lib/puppet/generate/templates/type/pcore.erb +41 -0
- data/lib/puppet/generate/type.rb +239 -0
- data/lib/puppet/graph/simple_graph.rb +2 -6
- data/lib/puppet/indirector/catalog/static_compiler.rb +5 -2
- data/lib/puppet/indirector/facts/facter.rb +1 -1
- data/lib/puppet/indirector/key/ca.rb +2 -2
- data/lib/puppet/indirector/request.rb +25 -4
- data/lib/puppet/indirector/rest.rb +73 -3
- data/lib/puppet/info_service/class_information_service.rb +1 -2
- data/lib/puppet/interface/documentation.rb +1 -1
- data/lib/puppet/loaders.rb +2 -0
- data/lib/puppet/metatype/manager.rb +6 -6
- data/lib/puppet/module.rb +8 -1
- data/lib/puppet/module_tool.rb +2 -2
- data/lib/puppet/module_tool/checksums.rb +1 -1
- data/lib/puppet/module_tool/errors/installer.rb +2 -2
- data/lib/puppet/module_tool/metadata.rb +1 -1
- data/lib/puppet/network/http/api/indirected_routes.rb +23 -32
- data/lib/puppet/network/http/rack/rest.rb +15 -1
- data/lib/puppet/network/rights.rb +1 -11
- data/lib/puppet/node/environment.rb +7 -3
- data/lib/puppet/node/facts.rb +1 -1
- data/lib/puppet/parameter.rb +23 -3
- data/lib/puppet/parameter/boolean.rb +1 -1
- data/lib/puppet/parameter/value.rb +1 -1
- data/lib/puppet/parser.rb +0 -1
- data/lib/puppet/parser/ast/pops_bridge.rb +1 -1
- data/lib/puppet/parser/ast/resource.rb +5 -0
- data/lib/puppet/parser/ast/resource_instance.rb +5 -1
- data/lib/puppet/parser/ast/resourceparam.rb +5 -0
- data/lib/puppet/parser/compiler.rb +14 -17
- data/lib/puppet/parser/compiler/catalog_validator/relationship_validator.rb +1 -1
- data/lib/puppet/parser/environment_compiler.rb +10 -0
- data/lib/puppet/parser/functions/create_resources.rb +39 -24
- data/lib/puppet/parser/functions/defined.rb +2 -26
- data/lib/puppet/parser/functions/dig.rb +29 -0
- data/lib/puppet/parser/functions/lest.rb +49 -0
- data/lib/puppet/parser/functions/new.rb +530 -0
- data/lib/puppet/parser/functions/require.rb +1 -1
- data/lib/puppet/parser/functions/reverse_each.rb +83 -0
- data/lib/puppet/parser/functions/scanf.rb +4 -4
- data/lib/puppet/parser/functions/step.rb +84 -0
- data/lib/puppet/parser/functions/then.rb +73 -0
- data/lib/puppet/parser/functions/type.rb +53 -0
- data/lib/puppet/parser/resource.rb +16 -7
- data/lib/puppet/parser/scope.rb +36 -28
- data/lib/puppet/parser/type_loader.rb +1 -1
- data/lib/puppet/plugins/data_providers/data_provider.rb +1 -1
- data/lib/puppet/pops.rb +13 -0
- data/lib/puppet/pops/adapters.rb +49 -49
- data/lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb +1 -1
- data/lib/puppet/pops/evaluator/access_operator.rb +39 -2
- data/lib/puppet/pops/evaluator/closure.rb +39 -13
- data/lib/puppet/pops/evaluator/collector_transformer.rb +10 -1
- data/lib/puppet/pops/evaluator/evaluator_impl.rb +16 -11
- data/lib/puppet/pops/evaluator/external_syntax_support.rb +1 -1
- data/lib/puppet/pops/evaluator/json_strict_literal_evaluator.rb +0 -1
- data/lib/puppet/pops/evaluator/literal_evaluator.rb +0 -1
- data/lib/puppet/pops/evaluator/relationship_operator.rb +1 -2
- data/lib/puppet/pops/evaluator/runtime3_resource_support.rb +119 -0
- data/lib/puppet/pops/evaluator/runtime3_support.rb +19 -45
- data/lib/puppet/pops/functions/function.rb +5 -0
- data/lib/puppet/pops/issues.rb +1 -1
- data/lib/puppet/pops/label_provider.rb +2 -2
- data/lib/puppet/pops/loader/base_loader.rb +12 -15
- data/lib/puppet/pops/loader/loader.rb +15 -50
- data/lib/puppet/pops/loader/loader_paths.rb +28 -2
- data/lib/puppet/pops/loader/module_loaders.rb +16 -1
- data/lib/puppet/pops/loader/null_loader.rb +17 -1
- data/lib/puppet/pops/loader/puppet_function_instantiator.rb +12 -11
- data/lib/puppet/pops/loader/puppet_resource_type_impl_instantiator.rb +80 -0
- data/lib/puppet/pops/loader/ruby_function_instantiator.rb +2 -3
- data/lib/puppet/pops/loader/runtime3_type_loader.rb +52 -13
- data/lib/puppet/pops/loader/static_loader.rb +55 -0
- data/lib/puppet/pops/loader/type_definition_instantiator.rb +30 -14
- data/lib/puppet/pops/loader/typed_name.rb +50 -0
- data/lib/puppet/pops/loaders.rb +64 -19
- data/lib/puppet/pops/merge_strategy.rb +7 -7
- data/lib/puppet/pops/migration/migration_checker.rb +4 -0
- data/lib/puppet/pops/model/model_label_provider.rb +2 -0
- data/lib/puppet/pops/parser/egrammar.ra +8 -5
- data/lib/puppet/pops/parser/eparser.rb +1550 -1498
- data/lib/puppet/pops/parser/evaluating_parser.rb +1 -1
- data/lib/puppet/pops/parser/interpolation_support.rb +7 -0
- data/lib/puppet/pops/parser/lexer2.rb +14 -1
- data/lib/puppet/pops/parser/locator.rb +30 -1
- data/lib/puppet/pops/parser/parser_support.rb +0 -3
- data/lib/puppet/pops/parser/slurp_support.rb +3 -3
- data/lib/puppet/pops/patterns.rb +9 -1
- data/lib/puppet/pops/pcore.rb +67 -11
- data/lib/puppet/pops/puppet_stack.rb +43 -0
- data/lib/puppet/pops/resource/param.rb +51 -0
- data/lib/puppet/pops/resource/resource_type_impl.rb +301 -0
- data/lib/puppet/pops/resource/resource_type_set.pcore +21 -0
- data/lib/puppet/pops/serialization.rb +17 -0
- data/lib/puppet/pops/serialization/abstract_reader.rb +149 -0
- data/lib/puppet/pops/serialization/abstract_writer.rb +179 -0
- data/lib/puppet/pops/serialization/deserializer.rb +60 -0
- data/lib/puppet/pops/serialization/extension.rb +126 -0
- data/lib/puppet/pops/serialization/instance_reader.rb +19 -0
- data/lib/puppet/pops/serialization/instance_writer.rb +14 -0
- data/lib/puppet/pops/serialization/json.rb +247 -0
- data/lib/puppet/pops/serialization/object.rb +63 -0
- data/lib/puppet/pops/serialization/rgen.rb +151 -0
- data/lib/puppet/pops/serialization/serializer.rb +91 -0
- data/lib/puppet/pops/serialization/time_factory.rb +66 -0
- data/lib/puppet/pops/types/annotatable.rb +36 -0
- data/lib/puppet/pops/types/implementation_registry.rb +3 -8
- data/lib/puppet/pops/types/p_meta_type.rb +83 -0
- data/lib/puppet/pops/types/p_object_type.rb +110 -117
- data/lib/puppet/pops/types/p_runtime_type.rb +13 -0
- data/lib/puppet/pops/types/p_sem_ver_range_type.rb +23 -0
- data/lib/puppet/pops/types/p_sem_ver_type.rb +30 -2
- data/lib/puppet/pops/types/p_sensitive_type.rb +69 -0
- data/lib/puppet/pops/types/p_type_set_type.rb +361 -0
- data/lib/puppet/pops/types/puppet_object.rb +0 -5
- data/lib/puppet/pops/types/ruby_generator.rb +9 -2
- data/lib/puppet/pops/types/type_calculator.rb +6 -1
- data/lib/puppet/pops/types/type_factory.rb +14 -12
- data/lib/puppet/pops/types/type_formatter.rb +78 -33
- data/lib/puppet/pops/types/type_mismatch_describer.rb +0 -2
- data/lib/puppet/pops/types/type_parser.rb +27 -2
- data/lib/puppet/pops/types/type_set_reference.rb +59 -0
- data/lib/puppet/pops/types/types.rb +366 -13
- data/lib/puppet/pops/validation.rb +4 -4
- data/lib/puppet/pops/validation/checker4_0.rb +5 -2
- data/lib/puppet/pops/visitor.rb +2 -2
- data/lib/puppet/property.rb +64 -5
- data/lib/puppet/provider.rb +1 -1
- data/lib/puppet/provider/aixobject.rb +3 -3
- data/lib/puppet/provider/group/aix.rb +4 -4
- data/lib/puppet/provider/macauthorization/macauthorization.rb +1 -1
- data/lib/puppet/provider/mailalias/aliases.rb +1 -1
- data/lib/puppet/provider/mcx/mcxcontent.rb +2 -2
- data/lib/puppet/provider/mount/parsed.rb +1 -1
- data/lib/puppet/provider/nameservice/directoryservice.rb +5 -5
- data/lib/puppet/provider/package/appdmg.rb +3 -3
- data/lib/puppet/provider/package/apple.rb +1 -1
- data/lib/puppet/provider/package/dnf.rb +5 -0
- data/lib/puppet/provider/package/nim.rb +1 -1
- data/lib/puppet/provider/package/pacman.rb +2 -2
- data/lib/puppet/provider/package/pip.rb +5 -3
- data/lib/puppet/provider/package/pip3.rb +1 -1
- data/lib/puppet/provider/package/pkg.rb +5 -5
- data/lib/puppet/provider/package/pkgdmg.rb +4 -4
- data/lib/puppet/provider/package/pkgin.rb +1 -1
- data/lib/puppet/provider/package/pkgutil.rb +1 -1
- data/lib/puppet/provider/package/portage.rb +48 -8
- data/lib/puppet/provider/package/sun.rb +1 -1
- data/lib/puppet/provider/package/tdnf.rb +28 -0
- data/lib/puppet/provider/package/yum.rb +22 -4
- data/lib/puppet/provider/parsedfile.rb +2 -2
- data/lib/puppet/provider/service/base.rb +1 -1
- data/lib/puppet/provider/service/bsd.rb +1 -1
- data/lib/puppet/provider/service/daemontools.rb +2 -2
- data/lib/puppet/provider/service/debian.rb +3 -3
- data/lib/puppet/provider/service/init.rb +5 -3
- data/lib/puppet/provider/service/launchd.rb +16 -2
- data/lib/puppet/provider/service/runit.rb +1 -1
- data/lib/puppet/provider/service/smf.rb +8 -1
- data/lib/puppet/provider/service/systemd.rb +39 -6
- data/lib/puppet/provider/ssh_authorized_key/parsed.rb +1 -1
- data/lib/puppet/provider/user/aix.rb +3 -2
- data/lib/puppet/provider/user/directoryservice.rb +4 -3
- data/lib/puppet/provider/user/hpux.rb +1 -1
- data/lib/puppet/provider/user/user_role_add.rb +1 -1
- data/lib/puppet/provider/user/windows_adsi.rb +3 -0
- data/lib/puppet/provider/zfs/zfs.rb +1 -1
- data/lib/puppet/reference/type.rb +1 -1
- data/lib/puppet/resource.rb +33 -7
- data/lib/puppet/resource/capability_finder.rb +74 -54
- data/lib/puppet/resource/status.rb +11 -2
- data/lib/puppet/settings.rb +17 -6
- data/lib/puppet/settings/environment_conf.rb +1 -1
- data/lib/puppet/settings/server_list_setting.rb +20 -0
- data/lib/puppet/ssl/certificate_authority.rb +32 -9
- data/lib/puppet/ssl/certificate_authority/interface.rb +164 -24
- data/lib/puppet/ssl/host.rb +3 -3
- data/lib/puppet/ssl/oids.rb +10 -0
- data/lib/puppet/ssl/validator/default_validator.rb +2 -2
- data/lib/puppet/test/test_helper.rb +2 -2
- data/lib/puppet/transaction.rb +12 -0
- data/lib/puppet/transaction/additional_resource_generator.rb +1 -1
- data/lib/puppet/transaction/event.rb +29 -2
- data/lib/puppet/transaction/event_manager.rb +1 -1
- data/lib/puppet/transaction/persistence.rb +84 -0
- data/lib/puppet/transaction/report.rb +49 -2
- data/lib/puppet/transaction/resource_harness.rb +98 -18
- data/lib/puppet/type.rb +63 -21
- data/lib/puppet/type/augeas.rb +3 -3
- data/lib/puppet/type/cron.rb +1 -1
- data/lib/puppet/type/file.rb +39 -2
- data/lib/puppet/type/file/data_sync.rb +13 -5
- data/lib/puppet/type/host.rb +1 -1
- data/lib/puppet/type/mount.rb +2 -6
- data/lib/puppet/type/notify.rb +1 -1
- data/lib/puppet/type/package.rb +1 -1
- data/lib/puppet/type/resources.rb +1 -1
- data/lib/puppet/type/scheduled_task.rb +1 -1
- data/lib/puppet/type/ssh_authorized_key.rb +2 -2
- data/lib/puppet/type/tidy.rb +1 -1
- data/lib/puppet/type/yumrepo.rb +3 -3
- data/lib/puppet/type/zone.rb +1 -1
- data/lib/puppet/util.rb +2 -2
- data/lib/puppet/util/classgen.rb +1 -1
- data/lib/puppet/util/command_line.rb +6 -2
- data/lib/puppet/util/command_line/trollop.rb +1 -1
- data/lib/puppet/util/execution.rb +2 -2
- data/lib/puppet/util/http_proxy.rb +1 -1
- data/lib/puppet/util/inifile.rb +1 -1
- data/lib/puppet/util/instance_loader.rb +1 -1
- data/lib/puppet/util/logging.rb +1 -1
- data/lib/puppet/util/multi_match.rb +1 -1
- data/lib/puppet/util/plist.rb +15 -5
- data/lib/puppet/util/profiler.rb +1 -1
- data/lib/puppet/util/profiler/around_profiler.rb +1 -1
- data/lib/puppet/util/psych_support.rb +1 -1
- data/lib/puppet/util/rdoc.rb +2 -2
- data/lib/puppet/util/rubygems.rb +1 -1
- data/lib/puppet/util/watcher/periodic_watcher.rb +2 -2
- data/lib/puppet/util/windows/access_control_entry.rb +1 -1
- data/lib/puppet/util/windows/adsi.rb +30 -8
- data/lib/puppet/util/windows/api_types.rb +1 -1
- data/lib/puppet/util/windows/file.rb +59 -0
- data/lib/puppet/util/windows/process.rb +10 -0
- data/lib/puppet/util/windows/security.rb +1 -1
- data/lib/puppet/util/windows/user.rb +22 -4
- data/lib/puppet/util/yaml.rb +15 -3
- data/lib/puppet/vendor/deep_merge/test/test_deep_merge.rb +1 -1
- data/lib/puppet/vendor/rgen_patch.rb +1 -1
- data/lib/puppet/version.rb +2 -2
- data/spec/fixtures/unit/pops/loaders/loaders/no_modules/manifests/site.pp +10 -0
- data/spec/integration/agent/logging_spec.rb +15 -14
- data/spec/integration/application/apply_spec.rb +1 -0
- data/spec/integration/directory_environments_spec.rb +16 -0
- data/spec/integration/environments/settings_spec.rb +32 -4
- data/spec/integration/faces/documentation_spec.rb +1 -1
- data/spec/integration/network/http/api/indirected_routes_spec.rb +33 -0
- data/spec/integration/node/environment_spec.rb +21 -0
- data/spec/integration/parser/collection_spec.rb +10 -0
- data/spec/integration/parser/compiler_spec.rb +76 -840
- data/spec/integration/parser/functions/require_spec.rb +3 -3
- data/spec/integration/parser/parameter_defaults_spec.rb +6 -2
- data/spec/integration/parser/pcore_resource_spec.rb +208 -0
- data/spec/integration/parser/resource_expressions_spec.rb +4 -2
- data/spec/integration/provider/yumrepo_spec.rb +4 -1
- data/spec/integration/transaction/report_spec.rb +666 -0
- data/spec/integration/type/file_spec.rb +11 -12
- data/spec/integration/util/windows/adsi_spec.rb +99 -0
- data/spec/integration/util/windows/principal_spec.rb +109 -60
- data/spec/integration/util/windows/process_spec.rb +4 -2
- data/spec/integration/util/windows/security_spec.rb +34 -8
- data/spec/integration/util/windows/user_spec.rb +26 -4
- data/spec/lib/puppet_spec/files.rb +2 -2
- data/spec/lib/puppet_spec/network.rb +12 -8
- data/spec/shared_examples/rhel_package_provider.rb +341 -0
- data/spec/spec_helper.rb +8 -2
- data/spec/unit/application/cert_spec.rb +20 -0
- data/spec/unit/configurer/plugin_handler_spec.rb +0 -26
- data/spec/unit/configurer_spec.rb +46 -0
- data/spec/unit/defaults_spec.rb +14 -0
- data/spec/unit/face/generate_spec.rb +230 -0
- data/spec/unit/face/help_spec.rb +53 -0
- data/spec/unit/face/parser_spec.rb +6 -0
- data/spec/unit/face/plugin_spec.rb +0 -4
- data/spec/unit/file_system_spec.rb +85 -0
- data/spec/unit/functions/lookup_spec.rb +4 -4
- data/spec/unit/functions/match_spec.rb +2 -2
- data/spec/unit/functions/regsubst_spec.rb +1 -1
- data/spec/unit/functions/split_spec.rb +1 -1
- data/spec/unit/functions/unwrap_spec.rb +29 -0
- data/spec/unit/functions/versioncmp_spec.rb +1 -1
- data/spec/unit/functions4_spec.rb +8 -8
- data/spec/unit/indirector/facts/facter_spec.rb +1 -9
- data/spec/unit/indirector/rest_spec.rb +95 -9
- data/spec/unit/module_spec.rb +43 -7
- data/spec/unit/module_tool/applications/installer_spec.rb +10 -1
- data/spec/unit/module_tool/applications/unpacker_spec.rb +2 -1
- data/spec/unit/module_tool/applications/upgrader_spec.rb +8 -0
- data/spec/unit/module_tool/tar/mini_spec.rb +3 -3
- data/spec/unit/network/http/api/indirected_routes_spec.rb +49 -58
- data/spec/unit/network/http/api/master/v3_spec.rb +7 -4
- data/spec/unit/network/rights_spec.rb +1 -1
- data/spec/unit/parameter_spec.rb +11 -0
- data/spec/unit/parser/compiler_spec.rb +19 -33
- data/spec/unit/{appmgmt_spec.rb → parser/environment_compiler_spec.rb} +12 -1
- data/spec/unit/parser/functions/create_resources_spec.rb +76 -4
- data/spec/unit/parser/functions/require_spec.rb +2 -2
- data/spec/unit/parser/resource_spec.rb +21 -11
- data/spec/unit/parser/scope_spec.rb +1 -5
- data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +1 -1
- data/spec/unit/pops/loaders/dependency_loader_spec.rb +1 -1
- data/spec/unit/pops/loaders/loader_paths_spec.rb +1 -1
- data/spec/unit/pops/loaders/loaders_spec.rb +63 -5
- data/spec/unit/pops/loaders/module_loaders_spec.rb +2 -2
- data/spec/unit/pops/loaders/static_loader_spec.rb +1 -1
- data/spec/unit/pops/parser/lexer2_spec.rb +27 -3
- data/spec/unit/pops/parser/parse_basic_expressions_spec.rb +8 -0
- data/spec/unit/pops/parser/parse_calls_spec.rb +9 -0
- data/spec/unit/pops/puppet_stack_spec.rb +79 -0
- data/spec/unit/pops/resource/resource_type_impl_spec.rb +37 -0
- data/spec/unit/pops/serialization/packer_spec.rb +153 -0
- data/spec/unit/pops/serialization/rgen_spec.rb +88 -0
- data/spec/unit/pops/serialization/serialization_spec.rb +228 -0
- data/spec/unit/pops/types/p_object_type_spec.rb +44 -2
- data/spec/unit/pops/types/p_sem_ver_type_spec.rb +42 -0
- data/spec/unit/pops/types/p_sensitive_type_spec.rb +139 -0
- data/spec/unit/pops/types/p_type_set_type_spec.rb +424 -0
- data/spec/unit/pops/types/ruby_generator_spec.rb +497 -181
- data/spec/unit/pops/types/type_calculator_spec.rb +10 -4
- data/spec/unit/pops/types/type_formatter_spec.rb +1 -1
- data/spec/unit/pops/types/type_mismatch_describer_spec.rb +2 -2
- data/spec/unit/pops/types/type_parser_spec.rb +1 -1
- data/spec/unit/pops/types/types_spec.rb +1 -1
- data/spec/unit/pops/validator/validator_spec.rb +18 -1
- data/spec/unit/property_spec.rb +48 -11
- data/spec/unit/provider/group/windows_adsi_spec.rb +11 -1
- data/spec/unit/provider/package/dnf_spec.rb +1 -99
- data/spec/unit/provider/package/pacman_spec.rb +4 -4
- data/spec/unit/provider/package/pip_spec.rb +14 -0
- data/spec/unit/provider/package/pkg_spec.rb +6 -0
- data/spec/unit/provider/package/pkgdmg_spec.rb +0 -3
- data/spec/unit/provider/package/portage_spec.rb +64 -8
- data/spec/unit/provider/package/tdnf_spec.rb +18 -0
- data/spec/unit/provider/package/windows/package_spec.rb +4 -1
- data/spec/unit/provider/package/windows_spec.rb +8 -2
- data/spec/unit/provider/package/yum_spec.rb +6 -377
- data/spec/unit/provider/service/base_spec.rb +6 -0
- data/spec/unit/provider/service/debian_spec.rb +16 -7
- data/spec/unit/provider/service/gentoo_spec.rb +6 -0
- data/spec/unit/provider/service/init_spec.rb +7 -0
- data/spec/unit/provider/service/launchd_spec.rb +35 -4
- data/spec/unit/provider/service/openrc_spec.rb +6 -0
- data/spec/unit/provider/service/smf_spec.rb +31 -6
- data/spec/unit/provider/service/src_spec.rb +6 -0
- data/spec/unit/provider/service/systemd_spec.rb +70 -20
- data/spec/unit/provider/service/upstart_spec.rb +6 -0
- data/spec/unit/provider/user/aix_spec.rb +7 -0
- data/spec/unit/provider/user/directoryservice_spec.rb +30 -1
- data/spec/unit/provider/user/windows_adsi_spec.rb +19 -0
- data/spec/unit/resource/capability_finder_spec.rb +51 -3
- data/spec/unit/resource/catalog_spec.rb +5 -0
- data/spec/unit/resource/type_spec.rb +2 -2
- data/spec/unit/resource_spec.rb +19 -0
- data/spec/unit/settings_spec.rb +13 -0
- data/spec/unit/ssl/certificate_authority/interface_spec.rb +176 -10
- data/spec/unit/ssl/certificate_authority_spec.rb +63 -22
- data/spec/unit/ssl/host_spec.rb +1 -1
- data/spec/unit/ssl/oids_spec.rb +24 -21
- data/spec/unit/transaction/event_spec.rb +3 -1
- data/spec/unit/transaction/persistence_spec.rb +173 -0
- data/spec/unit/transaction/report_spec.rb +64 -1
- data/spec/unit/transaction/resource_harness_spec.rb +91 -0
- data/spec/unit/type/file/content_spec.rb +47 -15
- data/spec/unit/type/file_spec.rb +28 -0
- data/spec/unit/type/mount_spec.rb +5 -12
- data/spec/unit/type/yumrepo_spec.rb +1 -5
- data/spec/unit/type_spec.rb +32 -0
- data/spec/unit/util/command_line_spec.rb +11 -0
- data/spec/unit/util/execution_spec.rb +1 -1
- data/spec/unit/util/plist_spec.rb +16 -3
- data/spec/unit/util/storage_spec.rb +4 -1
- data/spec/unit/util/windows/adsi_spec.rb +23 -2
- data/spec/unit/util/windows/file_spec.rb +56 -1
- data/spec/unit/util/windows/sid_spec.rb +31 -7
- data/spec/unit/util/yaml_spec.rb +12 -0
- data/spec/unit/util_spec.rb +87 -20
- metadata +91 -48
- data/ext/puppetlisten/puppetlisten.rb +0 -77
- data/ext/puppetlisten/puppetrun.rb +0 -38
- data/lib/puppet/resource/type_collection_helper.rb +0 -7
- data/spec/unit/parser/functions/defined_spec.rb +0 -120
- data/spec/unit/resource/type_collection_helper_spec.rb +0 -24
@@ -9,7 +9,7 @@
|
|
9
9
|
# in /var/db/.puppet_pkgdmg_installed_<name>
|
10
10
|
|
11
11
|
require 'puppet/provider/package'
|
12
|
-
require 'puppet/util/plist'
|
12
|
+
require 'puppet/util/plist'
|
13
13
|
require 'puppet/util/http_proxy'
|
14
14
|
|
15
15
|
Puppet::Type.type(:package).provide :pkgdmg, :parent => Puppet::Provider::Package do
|
@@ -75,7 +75,7 @@ Puppet::Type.type(:package).provide :pkgdmg, :parent => Puppet::Provider::Packag
|
|
75
75
|
end
|
76
76
|
|
77
77
|
unless source =~ /\.dmg$/i || source =~ /\.pkg$/i
|
78
|
-
raise Puppet::Error.new("Mac OS X PKG
|
78
|
+
raise Puppet::Error.new("Mac OS X PKG DMGs must specify a source string ending in .dmg or flat .pkg file")
|
79
79
|
end
|
80
80
|
require 'open-uri' # Dead code; this is never used. The File.open call 20-ish lines south of here used to be Kernel.open but changed in '09. -NF
|
81
81
|
cached_source = source
|
@@ -142,10 +142,10 @@ Puppet::Type.type(:package).provide :pkgdmg, :parent => Puppet::Provider::Packag
|
|
142
142
|
def install
|
143
143
|
source = nil
|
144
144
|
unless source = @resource[:source]
|
145
|
-
raise Puppet::Error.new("Mac OS X PKG
|
145
|
+
raise Puppet::Error.new("Mac OS X PKG DMGs must specify a package source.")
|
146
146
|
end
|
147
147
|
unless name = @resource[:name]
|
148
|
-
raise Puppet::Error.new("Mac OS X PKG
|
148
|
+
raise Puppet::Error.new("Mac OS X PKG DMGs must specify a package name.")
|
149
149
|
end
|
150
150
|
self.class.installpkgdmg(source,name)
|
151
151
|
end
|
@@ -25,7 +25,7 @@ Puppet::Type.type(:package).provide :pkgin, :parent => Puppet::Provider::Package
|
|
25
25
|
|
26
26
|
def self.prefetch(packages)
|
27
27
|
super
|
28
|
-
#
|
28
|
+
# Without -f, no fresh pkg_summary files are downloaded
|
29
29
|
pkgin("-yf", :update)
|
30
30
|
end
|
31
31
|
|
@@ -78,7 +78,7 @@ Puppet::Type.type(:package).provide :pkgutil, :parent => :sun, :source => :sun d
|
|
78
78
|
# Turn our pkgutil -c listing into a hash for a single package.
|
79
79
|
def pkgsingle(resource)
|
80
80
|
# The --single option speeds up the execution, because it queries
|
81
|
-
# the package
|
81
|
+
# the package management system for one package only.
|
82
82
|
command = ["-c", "--single", resource[:name]]
|
83
83
|
self.class.parse_pkglist(run_pkgutil(resource, command), { :justme => resource[:name] })
|
84
84
|
end
|
@@ -25,12 +25,13 @@ Puppet::Type.type(:package).provide :portage, :parent => Puppet::Provider::Packa
|
|
25
25
|
result_fields = self.eix_result_fields
|
26
26
|
|
27
27
|
version_format = self.eix_version_format
|
28
|
+
slot_versions_format = self.eix_slot_versions_format
|
28
29
|
begin
|
29
30
|
eix_file = File.directory?("/var/cache/eix") ? "/var/cache/eix/portage.eix" : "/var/cache/eix"
|
30
31
|
update_eix if !FileUtils.uptodate?(eix_file, %w{/usr/bin/eix /usr/portage/metadata/timestamp})
|
31
32
|
|
32
33
|
search_output = nil
|
33
|
-
Puppet::Util.withenv :LASTVERSION => version_format do
|
34
|
+
Puppet::Util.withenv :LASTVERSION => version_format, :LASTSLOTVERSIONS => slot_versions_format do
|
34
35
|
search_output = eix *(self.eix_search_arguments + ["--installed"])
|
35
36
|
end
|
36
37
|
|
@@ -59,7 +60,7 @@ Puppet::Type.type(:package).provide :portage, :parent => Puppet::Provider::Packa
|
|
59
60
|
name = package_name
|
60
61
|
unless should == :present or should == :latest
|
61
62
|
# We must install a specific version
|
62
|
-
name =
|
63
|
+
name = package_atom_with_version(should)
|
63
64
|
end
|
64
65
|
emerge name
|
65
66
|
end
|
@@ -69,6 +70,24 @@ Puppet::Type.type(:package).provide :portage, :parent => Puppet::Provider::Packa
|
|
69
70
|
@resource[:category] ? "#{@resource[:category]}/#{@resource[:name]}" : @resource[:name]
|
70
71
|
end
|
71
72
|
|
73
|
+
def package_name_without_slot
|
74
|
+
package_name.sub(self.class.slot_pattern, '')
|
75
|
+
end
|
76
|
+
|
77
|
+
def package_slot
|
78
|
+
if match = package_name.match(self.class.slot_pattern)
|
79
|
+
match[1]
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def package_atom_with_version(version)
|
84
|
+
if slot = package_slot
|
85
|
+
"=#{package_name_without_slot}-#{version}:#{package_slot}"
|
86
|
+
else
|
87
|
+
"=#{package_name}-#{version}"
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
72
91
|
def uninstall
|
73
92
|
emerge "--unmerge", package_name
|
74
93
|
end
|
@@ -86,15 +105,16 @@ Puppet::Type.type(:package).provide :portage, :parent => Puppet::Provider::Packa
|
|
86
105
|
result_fields = self.class.eix_result_fields
|
87
106
|
|
88
107
|
version_format = self.class.eix_version_format
|
89
|
-
|
90
|
-
|
108
|
+
slot_versions_format = self.class.eix_slot_versions_format
|
109
|
+
search_field = package_name_without_slot.count('/') > 0 ? "--category-name" : "--name"
|
110
|
+
search_value = package_name_without_slot
|
91
111
|
|
92
112
|
begin
|
93
113
|
eix_file = File.directory?("/var/cache/eix") ? "/var/cache/eix/portage.eix" : "/var/cache/eix"
|
94
114
|
update_eix if !FileUtils.uptodate?(eix_file, %w{/usr/bin/eix /usr/portage/metadata/timestamp})
|
95
115
|
|
96
116
|
search_output = nil
|
97
|
-
Puppet::Util.withenv :LASTVERSION => version_format do
|
117
|
+
Puppet::Util.withenv :LASTVERSION => version_format, :LASTSLOTVERSIONS => slot_versions_format do
|
98
118
|
search_output = eix *(self.class.eix_search_arguments + ["--exact",search_field,search_value])
|
99
119
|
end
|
100
120
|
|
@@ -107,6 +127,10 @@ Puppet::Type.type(:package).provide :portage, :parent => Puppet::Provider::Packa
|
|
107
127
|
result_fields.zip(match.captures) do |field, value|
|
108
128
|
package[field] = value unless !value or value.empty?
|
109
129
|
end
|
130
|
+
if package_slot
|
131
|
+
package[:version_available] = eix_get_version_for_slot(package[:slot_versions_available], package_slot)
|
132
|
+
package[:ensure] = eix_get_version_for_slot(package[:installed_slots], package_slot)
|
133
|
+
end
|
110
134
|
package[:ensure] = package[:ensure] ? package[:ensure] : :absent
|
111
135
|
packages << package
|
112
136
|
end
|
@@ -131,22 +155,38 @@ Puppet::Type.type(:package).provide :portage, :parent => Puppet::Provider::Packa
|
|
131
155
|
end
|
132
156
|
|
133
157
|
private
|
158
|
+
def eix_get_version_for_slot(versions_and_slots, slot)
|
159
|
+
return nil if versions_and_slots.nil?
|
160
|
+
versions_and_slots = versions_and_slots.split(",")
|
161
|
+
versions_and_slots.map! { |version_and_slot| version_and_slot.split(":") }
|
162
|
+
version_for_slot = versions_and_slots.find { |version_and_slot| version_and_slot.last == slot }
|
163
|
+
version_for_slot.first if version_for_slot
|
164
|
+
end
|
165
|
+
|
166
|
+
def self.slot_pattern
|
167
|
+
/:([\w+.\/*=-]+)$/
|
168
|
+
end
|
169
|
+
|
134
170
|
def self.eix_search_format
|
135
|
-
"'<category> <name> [<installedversions:LASTVERSION>] [<bestversion:LASTVERSION>] <homepage> <description>\n'"
|
171
|
+
"'<category> <name> [<installedversions:LASTVERSION>] [<bestversion:LASTVERSION>] [<installedversions:LASTSLOTVERSIONS>] [<bestslotversions:LASTSLOTVERSIONS>] <homepage> <description>\n'"
|
136
172
|
end
|
137
173
|
|
138
174
|
def self.eix_result_format
|
139
|
-
/^(\S+)\s+(\S+)\s+\[(\S*)\]\s+\[(\S*)\]\s+(\S+)\s+(.*)$/
|
175
|
+
/^(\S+)\s+(\S+)\s+\[(\S*)\]\s+\[(\S*)\]\s+\[(\S*)\]\s+\[(\S*)\]\s+(\S+)\s+(.*)$/
|
140
176
|
end
|
141
177
|
|
142
178
|
def self.eix_result_fields
|
143
|
-
[:category, :name, :ensure, :version_available, :vendor, :description]
|
179
|
+
[:category, :name, :ensure, :version_available, :installed_slots, :slot_versions_available, :vendor, :description]
|
144
180
|
end
|
145
181
|
|
146
182
|
def self.eix_version_format
|
147
183
|
"{last}<version>{}"
|
148
184
|
end
|
149
185
|
|
186
|
+
def self.eix_slot_versions_format
|
187
|
+
"{!first},{}<version>:<slot>"
|
188
|
+
end
|
189
|
+
|
150
190
|
def self.eix_search_arguments
|
151
191
|
["--nocolor", "--pure-packages", "--format",self.eix_search_format]
|
152
192
|
end
|
@@ -75,7 +75,7 @@ Puppet::Type.type(:package).provide :sun, :parent => Puppet::Provider::Package d
|
|
75
75
|
end
|
76
76
|
return self.class.namemap(pkgs[0]) if errmsg.nil?
|
77
77
|
# according to commit 41356a7 some errors do not raise an exception
|
78
|
-
# so
|
78
|
+
# so even though pkginfo passed, we have to check the actual output
|
79
79
|
raise Puppet::Error, "Unable to get information about package #{@resource[:name]} because of: #{errmsg}"
|
80
80
|
rescue Puppet::ExecutionFailure
|
81
81
|
return {:ensure => :absent}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
Puppet::Type.type(:package).provide :tdnf, :parent => :dnf do
|
2
|
+
desc "Support via `tdnf`.
|
3
|
+
|
4
|
+
This provider supports the `install_options` attribute, which allows command-line flags to be passed to tdnf.
|
5
|
+
These options should be spcified as a string (e.g. '--flag'), a hash (e.g. {'--flag' => 'value'}), or an
|
6
|
+
array where each element is either a string or a hash."
|
7
|
+
|
8
|
+
has_feature :install_options, :versionable, :virtual_packages
|
9
|
+
|
10
|
+
commands :cmd => "tdnf", :rpm => "rpm"
|
11
|
+
|
12
|
+
# Note: this confine was borrowed from the Yum provider. The
|
13
|
+
# original purpose (from way back in 2007) was to make sure we
|
14
|
+
# never try to use RPM on a machine without it. We think this
|
15
|
+
# has probably become obsolete with the way `commands` work, so
|
16
|
+
# we should investigate removing it at some point.
|
17
|
+
if command('rpm')
|
18
|
+
confine :true => begin
|
19
|
+
rpm('--version')
|
20
|
+
rescue Puppet::ExecutionFailure
|
21
|
+
false
|
22
|
+
else
|
23
|
+
true
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
defaultfor :operatingsystem => "PhotonOS"
|
28
|
+
end
|
@@ -130,9 +130,22 @@ Puppet::Type.type(:package).provide :yum, :parent => :rpm, :source => :rpm do
|
|
130
130
|
'0'
|
131
131
|
end
|
132
132
|
|
133
|
+
def self.update_command
|
134
|
+
# In yum both `upgrade` and `update` can be used to update packages
|
135
|
+
# `yum upgrade` == `yum --obsoletes update`
|
136
|
+
# Quote the DNF docs:
|
137
|
+
# "Yum does this if its obsoletes config option is enabled but
|
138
|
+
# the behavior is not properly documented and can be harmful."
|
139
|
+
# So we'll stick with the safter option
|
140
|
+
# If a user wants to remove obsoletes, they can use { :install_options => '--obsoletes' }
|
141
|
+
# More detail here: https://bugzilla.redhat.com/show_bug.cgi?id=1096506
|
142
|
+
'update'
|
143
|
+
end
|
144
|
+
|
133
145
|
def install
|
134
146
|
wanted = @resource[:name]
|
135
147
|
error_level = self.class.error_level
|
148
|
+
update_command = self.class.update_command
|
136
149
|
# If not allowing virtual packages, do a query to ensure a real package exists
|
137
150
|
unless @resource.allow_virtual?
|
138
151
|
execute([command(:cmd), '-d', '0', '-e', error_level, '-y', install_options, :list, wanted].compact)
|
@@ -154,10 +167,15 @@ Puppet::Type.type(:package).provide :yum, :parent => :rpm, :source => :rpm do
|
|
154
167
|
wanted.gsub!(/(.+)(#{ARCH_REGEX})(.+)/,'\1\3\2')
|
155
168
|
end
|
156
169
|
|
157
|
-
|
158
|
-
if
|
159
|
-
|
160
|
-
|
170
|
+
current_package = self.query
|
171
|
+
if current_package
|
172
|
+
if rpm_compareEVR(rpm_parse_evr(should), rpm_parse_evr(current_package[:ensure])) < 0
|
173
|
+
self.debug "Downgrading package #{@resource[:name]} from version #{current_package[:ensure]} to #{should}"
|
174
|
+
operation = :downgrade
|
175
|
+
elsif rpm_compareEVR(rpm_parse_evr(should), rpm_parse_evr(current_package[:ensure])) > 0
|
176
|
+
self.debug "Upgrading package #{@resource[:name]} from version #{current_package[:ensure]} to #{should}"
|
177
|
+
operation = update_command
|
178
|
+
end
|
161
179
|
end
|
162
180
|
end
|
163
181
|
|
@@ -109,7 +109,7 @@ class Puppet::Provider::ParsedFile < Puppet::Provider
|
|
109
109
|
# An optional regular expression matched by third party headers.
|
110
110
|
#
|
111
111
|
# For example, this can be used to filter the vixie cron headers as
|
112
|
-
#
|
112
|
+
# erroneously exported by older cron versions.
|
113
113
|
#
|
114
114
|
# @api private
|
115
115
|
# @abstract Providers based on ParsedFile may implement this to make it
|
@@ -120,7 +120,7 @@ class Puppet::Provider::ParsedFile < Puppet::Provider
|
|
120
120
|
# The expression must be tailored to match exactly one third party header.
|
121
121
|
# @see drop_native_header
|
122
122
|
# @note When specifying regular expressions in multiline mode, avoid
|
123
|
-
# greedy
|
123
|
+
# greedy repetitions such as '.*' (use .*? instead). Otherwise, the
|
124
124
|
# provider may drop file content between sparse headers.
|
125
125
|
def self.native_header_regex
|
126
126
|
nil
|
@@ -57,7 +57,7 @@ Puppet::Type.type(:service).provide :base, :parent => :service do
|
|
57
57
|
# Don't fail when the exit status is not 0.
|
58
58
|
ucommand(:status, false)
|
59
59
|
|
60
|
-
#
|
60
|
+
# Explicitly calling exitstatus to facilitate testing
|
61
61
|
if $CHILD_STATUS.exitstatus == 0
|
62
62
|
return :running
|
63
63
|
else
|
@@ -40,7 +40,7 @@ Puppet::Type.type(:service).provide :bsd, :parent => :init do
|
|
40
40
|
end
|
41
41
|
|
42
42
|
# Override stop/start commands to use one<cmd>'s and the avoid race condition
|
43
|
-
# where provider
|
43
|
+
# where provider tries to stop/start the service before it is enabled
|
44
44
|
def startcmd
|
45
45
|
[self.initscript, :onestart]
|
46
46
|
end
|
@@ -17,7 +17,7 @@ Puppet::Type.type(:service).provide :daemontools, :parent => :base do
|
|
17
17
|
* `/var/lib/service`
|
18
18
|
* `/etc`
|
19
19
|
|
20
|
-
...or this can be
|
20
|
+
...or this can be overridden in the resource's attributes:
|
21
21
|
|
22
22
|
service { 'myservice':
|
23
23
|
provider => 'daemontools',
|
@@ -106,7 +106,7 @@ Puppet::Type.type(:service).provide :daemontools, :parent => :base do
|
|
106
106
|
end
|
107
107
|
|
108
108
|
# returns the full path to the current daemon directory
|
109
|
-
# note that this path can be
|
109
|
+
# note that this path can be overridden in the resource
|
110
110
|
# definition
|
111
111
|
def daemon
|
112
112
|
File.join(resource[:path], resource[:name])
|
@@ -17,7 +17,7 @@ Puppet::Type.type(:service).provide :debian, :parent => :init do
|
|
17
17
|
commands :invoke_rc => "/usr/sbin/invoke-rc.d"
|
18
18
|
commands :service => "/usr/sbin/service"
|
19
19
|
|
20
|
-
defaultfor :operatingsystem => :cumuluslinux
|
20
|
+
defaultfor :operatingsystem => :cumuluslinux, :operatingsystemmajrelease => ['1','2']
|
21
21
|
defaultfor :operatingsystem => :debian, :operatingsystemmajrelease => ['5','6','7']
|
22
22
|
|
23
23
|
# Remove the symlinks
|
@@ -42,9 +42,9 @@ Puppet::Type.type(:service).provide :debian, :parent => :init do
|
|
42
42
|
return :true
|
43
43
|
elsif [101, 105].include?($CHILD_STATUS.exitstatus)
|
44
44
|
# 101 is action not allowed, which means we have to do the check manually.
|
45
|
-
# 105 is unknown, which generally means the
|
45
|
+
# 105 is unknown, which generally means the initscript does not support query
|
46
46
|
# The debian policy states that the initscript should support methods of query
|
47
|
-
# For those that do not,
|
47
|
+
# For those that do not, perform the checks manually
|
48
48
|
# http://www.debian.org/doc/debian-policy/ch-opersys.html
|
49
49
|
if get_start_link_count >= 4
|
50
50
|
return :true
|
@@ -11,6 +11,8 @@ Puppet::Type.type(:service).provide :init, :parent => :base do
|
|
11
11
|
"/sbin/init.d"
|
12
12
|
when "Archlinux"
|
13
13
|
"/etc/rc.d"
|
14
|
+
when "AIX"
|
15
|
+
"/etc/rc.d/init.d"
|
14
16
|
else
|
15
17
|
"/etc/init.d"
|
16
18
|
end
|
@@ -28,7 +30,7 @@ Puppet::Type.type(:service).provide :init, :parent => :base do
|
|
28
30
|
#confine :exists => defpath
|
29
31
|
|
30
32
|
# some init scripts are not safe to execute, e.g. we do not want
|
31
|
-
# to
|
33
|
+
# to suddenly run /etc/init.d/reboot.sh status and reboot our system. The
|
32
34
|
# exclude list could be platform agnostic but I assume an invalid init script
|
33
35
|
# on system A will never be a valid init script on system B
|
34
36
|
def self.excludes
|
@@ -46,7 +48,7 @@ Puppet::Type.type(:service).provide :init, :parent => :base do
|
|
46
48
|
# launchpad bug
|
47
49
|
# (https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/962047) that may
|
48
50
|
# eventually explain how to use the wait-for-state service or perhaps why
|
49
|
-
# it should remain excluded. When that bug is
|
51
|
+
# it should remain excluded. When that bug is addressed this should be
|
50
52
|
# reexamined.
|
51
53
|
excludes += %w{wait-for-state portmap-wait}
|
52
54
|
# these excludes were found with grep -r -L start /etc/init.d
|
@@ -153,7 +155,7 @@ Puppet::Type.type(:service).provide :init, :parent => :base do
|
|
153
155
|
raise Puppet::Error, "Could not find init script for '#{name}'"
|
154
156
|
end
|
155
157
|
|
156
|
-
# The start command is just the init
|
158
|
+
# The start command is just the init script with 'start'.
|
157
159
|
def startcmd
|
158
160
|
[initscript, :start]
|
159
161
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'puppet/util/plist'
|
1
|
+
require 'puppet/util/plist'
|
2
2
|
Puppet::Type.type(:service).provide :launchd, :parent => :base do
|
3
3
|
desc <<-'EOT'
|
4
4
|
This provider manages jobs with `launchd`, which is the default service
|
@@ -35,7 +35,7 @@ Puppet::Type.type(:service).provide :launchd, :parent => :base do
|
|
35
35
|
Note that this allows you to do something `launchctl` can't do, which is to
|
36
36
|
be in a state of "stopped/enabled" or "running/disabled".
|
37
37
|
|
38
|
-
Note that this provider does not support overriding 'restart'
|
38
|
+
Note that this provider does not support overriding 'restart'
|
39
39
|
|
40
40
|
EOT
|
41
41
|
|
@@ -219,6 +219,20 @@ Puppet::Type.type(:service).provide :launchd, :parent => :base do
|
|
219
219
|
[job_path, job_plist]
|
220
220
|
end
|
221
221
|
|
222
|
+
# when a service includes hasstatus=>false, we override the launchctl
|
223
|
+
# status mechanism and fall back to the base provider status method.
|
224
|
+
def status
|
225
|
+
if @resource && ((@resource[:hasstatus] == :false) || (@resource[:status]))
|
226
|
+
return super
|
227
|
+
else
|
228
|
+
if @property_hash[:status].nil?
|
229
|
+
:absent
|
230
|
+
else
|
231
|
+
@property_hash[:status]
|
232
|
+
end
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
222
236
|
# start the service. To get to a state of running/enabled, we need to
|
223
237
|
# conditionally enable at load, then disable by modifying the plist file
|
224
238
|
# directly.
|
@@ -17,7 +17,7 @@ Puppet::Type.type(:service).provide :runit, :parent => :daemontools do
|
|
17
17
|
* `/etc/sv`
|
18
18
|
* `/var/lib/service`
|
19
19
|
|
20
|
-
or this can be
|
20
|
+
or this can be overridden in the service resource parameters:
|
21
21
|
|
22
22
|
service { 'myservice':
|
23
23
|
provider => 'runit',
|
@@ -21,6 +21,8 @@ Puppet::Type.type(:service).provide :smf, :parent => :base do
|
|
21
21
|
commands :adm => "/usr/sbin/svcadm", :svcs => "/usr/bin/svcs"
|
22
22
|
commands :svccfg => "/usr/sbin/svccfg"
|
23
23
|
|
24
|
+
has_feature :refreshable
|
25
|
+
|
24
26
|
def setupservice
|
25
27
|
if resource[:manifest]
|
26
28
|
[command(:svcs), "-l", @resource[:name]]
|
@@ -64,7 +66,12 @@ Puppet::Type.type(:service).provide :smf, :parent => :base do
|
|
64
66
|
end
|
65
67
|
|
66
68
|
def restartcmd
|
67
|
-
|
69
|
+
if Puppet::Util::Package.versioncmp(Facter.value(:operatingsystemrelease), '11.2') >= 0
|
70
|
+
[command(:adm), :restart, "-s", @resource[:name]]
|
71
|
+
else
|
72
|
+
# Synchronous restart only supported in Solaris 11.2 and above
|
73
|
+
[command(:adm), :restart, @resource[:name]]
|
74
|
+
end
|
68
75
|
end
|
69
76
|
|
70
77
|
def startcmd
|
@@ -23,7 +23,8 @@ Puppet::Type.type(:service).provide :systemd, :parent => :base do
|
|
23
23
|
defaultfor :osfamily => :redhat, :operatingsystem => :fedora
|
24
24
|
defaultfor :osfamily => :suse
|
25
25
|
defaultfor :operatingsystem => :debian, :operatingsystemmajrelease => "8"
|
26
|
-
defaultfor :operatingsystem => :ubuntu, :operatingsystemmajrelease => ["15.04","15.10","16.04"]
|
26
|
+
defaultfor :operatingsystem => :ubuntu, :operatingsystemmajrelease => ["15.04","15.10","16.04","16.10"]
|
27
|
+
defaultfor :operatingsystem => :cumuluslinux, :operatingsystemmajrelease => ["3"]
|
27
28
|
|
28
29
|
def self.instances
|
29
30
|
i = []
|
@@ -72,6 +73,7 @@ Puppet::Type.type(:service).provide :systemd, :parent => :base do
|
|
72
73
|
|
73
74
|
def enabled?
|
74
75
|
output = cached_enabled?
|
76
|
+
code = $CHILD_STATUS.exitstatus
|
75
77
|
|
76
78
|
# The masked state is equivalent to the disabled state in terms of
|
77
79
|
# comparison so we only care to check if it is masked if we want to keep
|
@@ -80,9 +82,8 @@ Puppet::Type.type(:service).provide :systemd, :parent => :base do
|
|
80
82
|
# We only return :mask if we're trying to mask the service. This prevents
|
81
83
|
# flapping when simply trying to disable a masked service.
|
82
84
|
return :mask if (@resource[:enable] == :mask) && (output == 'masked')
|
83
|
-
return :true if
|
84
|
-
|
85
|
-
if (output.empty?) && (Facter.value(:osfamily).downcase == 'debian')
|
85
|
+
return :true if (code == 0)
|
86
|
+
if (output.empty?) && (code > 0) && (Facter.value(:osfamily).downcase == 'debian')
|
86
87
|
ret = debian_enabled?
|
87
88
|
return ret if ret
|
88
89
|
end
|
@@ -101,9 +102,9 @@ Puppet::Type.type(:service).provide :systemd, :parent => :base do
|
|
101
102
|
return :true
|
102
103
|
elsif [101, 105].include?($CHILD_STATUS.exitstatus)
|
103
104
|
# 101 is action not allowed, which means we have to do the check manually.
|
104
|
-
# 105 is unknown, which generally means the
|
105
|
+
# 105 is unknown, which generally means the initscript does not support query
|
105
106
|
# The debian policy states that the initscript should support methods of query
|
106
|
-
# For those that do not,
|
107
|
+
# For those that do not, perform the checks manually
|
107
108
|
# http://www.debian.org/doc/debian-policy/ch-opersys.html
|
108
109
|
if get_start_link_count >= 4
|
109
110
|
return :true
|
@@ -145,5 +146,37 @@ Puppet::Type.type(:service).provide :systemd, :parent => :base do
|
|
145
146
|
def statuscmd
|
146
147
|
[command(:systemctl), "is-active", @resource[:name]]
|
147
148
|
end
|
149
|
+
|
150
|
+
def restart
|
151
|
+
begin
|
152
|
+
super
|
153
|
+
rescue Puppet::Error => e
|
154
|
+
raise Puppet::Error.new(prepare_error_message(@resource[:name], 'restart', e))
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
def start
|
159
|
+
begin
|
160
|
+
super
|
161
|
+
rescue Puppet::Error => e
|
162
|
+
raise Puppet::Error.new(prepare_error_message(@resource[:name], 'start', e))
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
def stop
|
167
|
+
begin
|
168
|
+
super
|
169
|
+
rescue Puppet::Error => e
|
170
|
+
raise Puppet::Error.new(prepare_error_message(@resource[:name], 'stop', e))
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
def prepare_error_message(name, action, exception)
|
175
|
+
error_return = "Systemd #{action} for #{name} failed!\n"
|
176
|
+
journalctl_command = "journalctl -n 50 --since '5 minutes ago' -u #{name} --no-pager"
|
177
|
+
Puppet.debug("Runing journalctl command to get logs for systemd #{action} failure: #{journalctl_command}")
|
178
|
+
journalctl_output = execute(journalctl_command)
|
179
|
+
error_return << "journalctl log for #{name}:\n#{journalctl_output}"
|
180
|
+
end
|
148
181
|
end
|
149
182
|
|