puppet 3.2.4 → 3.3.0.rc2
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.
- data/COMMITTERS.md +101 -42
- data/Gemfile +15 -4
- data/README.md +5 -1
- data/README_DEVELOPER.md +117 -54
- data/Rakefile +4 -0
- data/ext/build_defaults.yaml +3 -2
- data/ext/debian/puppet-common.manpages +33 -1
- data/ext/gentoo/init.d/puppet +1 -1
- data/ext/gentoo/init.d/puppetmaster +1 -1
- data/ext/redhat/puppet.spec.erb +0 -1
- data/install.rb +2 -1
- data/lib/hiera/backend/puppet_backend.rb +1 -1
- data/lib/puppet/application.rb +10 -9
- data/lib/puppet/application/agent.rb +87 -93
- data/lib/puppet/application/apply.rb +0 -2
- data/lib/puppet/application/device.rb +3 -3
- data/lib/puppet/application/kick.rb +2 -2
- data/lib/puppet/application/master.rb +41 -19
- data/lib/puppet/application/queue.rb +5 -3
- data/lib/puppet/bindings.rb +147 -0
- data/lib/puppet/configurer.rb +25 -15
- data/lib/puppet/configurer/fact_handler.rb +2 -9
- data/lib/puppet/daemon.rb +44 -33
- data/lib/puppet/defaults.rb +57 -26
- data/lib/puppet/error.rb +1 -1
- data/lib/puppet/external/dot.rb +2 -2
- data/lib/puppet/external/nagios/base.rb +1 -6
- data/lib/puppet/external/pson/common.rb +2 -2
- data/lib/puppet/external/pson/pure/generator.rb +2 -2
- data/lib/puppet/external/pson/pure/parser.rb +1 -1
- data/lib/puppet/face/ca.rb +1 -1
- data/lib/puppet/face/config.rb +1 -1
- data/lib/puppet/face/help.rb +2 -2
- data/lib/puppet/face/module/list.rb +2 -2
- data/lib/puppet/feature/rails.rb +1 -1
- data/lib/puppet/file_bucket/dipper.rb +0 -1
- data/lib/puppet/file_serving/base.rb +1 -1
- data/lib/puppet/file_serving/configuration/parser.rb +20 -14
- data/lib/puppet/forge.rb +0 -32
- data/lib/puppet/forge/cache.rb +1 -1
- data/lib/puppet/forge/errors.rb +3 -3
- data/lib/puppet/forge/repository.rb +7 -42
- data/lib/puppet/graph.rb +11 -0
- data/lib/puppet/graph/key.rb +26 -0
- data/lib/puppet/graph/prioritizer.rb +29 -0
- data/lib/puppet/graph/random_prioritizer.rb +16 -0
- data/lib/puppet/{rb_tree_map.rb → graph/rb_tree_map.rb} +3 -3
- data/lib/puppet/graph/relationship_graph.rb +246 -0
- data/lib/puppet/graph/sequential_prioritizer.rb +31 -0
- data/lib/puppet/{simple_graph.rb → graph/simple_graph.rb} +22 -3
- data/lib/puppet/graph/title_hash_prioritizer.rb +16 -0
- data/lib/puppet/indirector.rb +2 -2
- data/lib/puppet/indirector/catalog/compiler.rb +10 -7
- data/lib/puppet/indirector/catalog/static_compiler.rb +50 -0
- data/lib/puppet/indirector/certificate/rest.rb +1 -1
- data/lib/puppet/indirector/exec.rb +1 -1
- data/lib/puppet/indirector/facts/facter.rb +2 -2
- data/lib/puppet/indirector/facts/inventory_active_record.rb +0 -1
- data/lib/puppet/indirector/facts/network_device.rb +1 -1
- data/lib/puppet/indirector/file_bucket_file/file.rb +0 -1
- data/lib/puppet/indirector/indirection.rb +2 -2
- data/lib/puppet/indirector/memory.rb +9 -0
- data/lib/puppet/indirector/node/ldap.rb +2 -4
- data/lib/puppet/indirector/report/processor.rb +1 -2
- data/lib/puppet/indirector/report/rest.rb +1 -1
- data/lib/puppet/indirector/request.rb +32 -10
- data/lib/puppet/indirector/resource/rest.rb +1 -1
- data/lib/puppet/indirector/resource_type/parser.rb +31 -12
- data/lib/puppet/interface.rb +1 -1
- data/lib/puppet/interface/documentation.rb +7 -11
- data/lib/puppet/interface/option.rb +1 -1
- data/lib/puppet/interface/option_builder.rb +1 -1
- data/lib/puppet/metatype/manager.rb +2 -2
- data/lib/puppet/module.rb +7 -1
- data/lib/puppet/module_tool.rb +1 -1
- data/lib/puppet/module_tool/applications/application.rb +10 -0
- data/lib/puppet/module_tool/applications/installer.rb +6 -3
- data/lib/puppet/module_tool/dependency.rb +2 -0
- data/lib/puppet/module_tool/errors/upgrader.rb +1 -1
- data/lib/puppet/module_tool/metadata.rb +25 -13
- data/lib/puppet/module_tool/modulefile.rb +7 -7
- data/lib/puppet/module_tool/shared_behaviors.rb +4 -2
- data/lib/puppet/module_tool/skeleton.rb +1 -1
- data/lib/puppet/module_tool/skeleton/templates/generator/manifests/init.pp.erb +5 -5
- data/lib/puppet/module_tool/skeleton/templates/generator/tests/init.pp.erb +5 -4
- data/lib/puppet/network/auth_config_parser.rb +3 -0
- data/lib/puppet/network/authconfig.rb +0 -1
- data/lib/puppet/network/authorization.rb +1 -1
- data/lib/puppet/network/authstore.rb +2 -2
- data/lib/puppet/network/format_handler.rb +25 -114
- data/lib/puppet/network/format_support.rb +106 -0
- data/lib/puppet/network/formats.rb +10 -4
- data/lib/puppet/network/http/compression.rb +1 -1
- data/lib/puppet/network/http/connection.rb +76 -32
- data/lib/puppet/network/http/handler.rb +122 -61
- data/lib/puppet/network/http/rack/rest.rb +1 -1
- data/lib/puppet/network/http/webrick/rest.rb +9 -3
- data/lib/puppet/network/http_pool.rb +2 -2
- data/lib/puppet/network/resolver.rb +1 -0
- data/lib/puppet/network/server.rb +5 -81
- data/lib/puppet/node/environment.rb +256 -13
- data/lib/puppet/node/facts.rb +28 -2
- data/lib/puppet/parameter.rb +27 -18
- data/lib/puppet/parameter/boolean.rb +20 -0
- data/lib/puppet/parameter/path.rb +1 -1
- data/lib/puppet/parameter/value.rb +1 -1
- data/lib/puppet/parameter/value_collection.rb +1 -1
- data/lib/puppet/parser/ast/arithmetic_operator.rb +8 -0
- data/lib/puppet/parser/ast/casestatement.rb +0 -3
- data/lib/puppet/parser/ast/lambda.rb +25 -6
- data/lib/puppet/parser/ast/leaf.rb +10 -3
- data/lib/puppet/parser/ast/nop.rb +1 -1
- data/lib/puppet/parser/ast/resource_override.rb +0 -2
- data/lib/puppet/parser/compiler.rb +92 -34
- data/lib/puppet/parser/files.rb +0 -5
- data/lib/puppet/parser/functions/create_resources.rb +23 -46
- data/lib/puppet/parser/functions/each.rb +0 -2
- data/lib/puppet/parser/functions/extlookup.rb +2 -2
- data/lib/puppet/parser/functions/foreach.rb +0 -2
- data/lib/puppet/parser/functions/hiera_include.rb +1 -1
- data/lib/puppet/parser/functions/lookup.rb +44 -0
- data/lib/puppet/parser/functions/slice.rb +1 -1
- data/lib/puppet/parser/grammar.ra +0 -1
- data/lib/puppet/parser/lexer.rb +0 -1
- data/lib/puppet/parser/parser.rb +0 -1
- data/lib/puppet/parser/parser_factory.rb +3 -2
- data/lib/puppet/parser/parser_support.rb +1 -1
- data/lib/puppet/parser/relationship.rb +1 -1
- data/lib/puppet/parser/scope.rb +49 -24
- data/lib/puppet/parser/type_loader.rb +13 -18
- data/lib/puppet/pops.rb +45 -0
- data/lib/puppet/pops/adaptable.rb +2 -2
- data/lib/puppet/pops/adapters.rb +4 -0
- data/lib/puppet/pops/binder/binder.rb +421 -0
- data/lib/puppet/pops/binder/binder_issues.rb +142 -0
- data/lib/puppet/pops/binder/bindings_checker.rb +217 -0
- data/lib/puppet/pops/binder/bindings_composer.rb +241 -0
- data/lib/puppet/pops/binder/bindings_factory.rb +847 -0
- data/lib/puppet/pops/binder/bindings_label_provider.rb +46 -0
- data/lib/puppet/pops/binder/bindings_loader.rb +79 -0
- data/lib/puppet/pops/binder/bindings_model.rb +215 -0
- data/lib/puppet/pops/binder/bindings_model_dumper.rb +205 -0
- data/lib/puppet/pops/binder/bindings_validator_factory.rb +28 -0
- data/lib/puppet/pops/binder/config/binder_config.rb +139 -0
- data/lib/puppet/pops/binder/config/binder_config_checker.rb +183 -0
- data/lib/puppet/pops/binder/config/diagnostic_producer.rb +32 -0
- data/lib/puppet/pops/binder/config/issues.rb +106 -0
- data/lib/puppet/pops/binder/hiera2.rb +10 -0
- data/lib/puppet/pops/binder/hiera2/bindings_provider.rb +148 -0
- data/lib/puppet/pops/binder/hiera2/config.rb +69 -0
- data/lib/puppet/pops/binder/hiera2/config_checker.rb +68 -0
- data/lib/puppet/pops/binder/hiera2/diagnostic_producer.rb +36 -0
- data/lib/puppet/pops/binder/hiera2/issues.rb +67 -0
- data/lib/puppet/pops/binder/hiera2/json_backend.rb +18 -0
- data/lib/puppet/pops/binder/hiera2/yaml_backend.rb +21 -0
- data/lib/puppet/pops/binder/injector.rb +688 -0
- data/lib/puppet/pops/binder/injector_entry.rb +53 -0
- data/lib/puppet/pops/binder/key_factory.rb +61 -0
- data/lib/puppet/pops/binder/producers.rb +829 -0
- data/lib/puppet/pops/binder/scheme_handler/confdir_hiera_scheme.rb +67 -0
- data/lib/puppet/pops/binder/scheme_handler/confdir_scheme.rb +34 -0
- data/lib/puppet/pops/binder/scheme_handler/module_hiera_scheme.rb +92 -0
- data/lib/puppet/pops/binder/scheme_handler/module_scheme.rb +84 -0
- data/lib/puppet/pops/binder/scheme_handler/symbolic_scheme.rb +54 -0
- data/lib/puppet/pops/binder/system_bindings.rb +72 -0
- data/lib/puppet/pops/issue_reporter.rb +75 -0
- data/lib/puppet/pops/issues.rb +9 -5
- data/lib/puppet/pops/model/ast_transformer.rb +4 -4
- data/lib/puppet/pops/model/ast_tree_dumper.rb +1 -1
- data/lib/puppet/pops/model/factory.rb +25 -13
- data/lib/puppet/pops/model/model.rb +1 -1
- data/lib/puppet/pops/model/tree_dumper.rb +2 -2
- data/lib/puppet/pops/parser/egrammar.ra +0 -1
- data/lib/puppet/pops/parser/eparser.rb +1 -2
- data/lib/puppet/pops/parser/evaluating_parser.rb +162 -0
- data/lib/puppet/pops/parser/lexer.rb +8 -6
- data/lib/puppet/pops/types/class_loader.rb +118 -0
- data/lib/puppet/pops/types/type_calculator.rb +557 -0
- data/lib/puppet/pops/types/type_factory.rb +147 -0
- data/lib/puppet/pops/types/type_parser.rb +117 -0
- data/lib/puppet/pops/types/types.rb +132 -0
- data/lib/puppet/pops/validation.rb +146 -17
- data/lib/puppet/pops/validation/checker3_1.rb +1 -1
- data/lib/puppet/pops/validation/validator_factory_3_1.rb +6 -16
- data/lib/puppet/property.rb +3 -3
- data/lib/puppet/property/keyvalue.rb +1 -1
- data/lib/puppet/provider.rb +2 -2
- data/lib/puppet/provider/aixobject.rb +19 -21
- data/lib/puppet/provider/augeas/augeas.rb +3 -1
- data/lib/puppet/provider/command.rb +2 -2
- data/lib/puppet/provider/group/aix.rb +1 -1
- data/lib/puppet/provider/group/ldap.rb +1 -1
- data/lib/puppet/provider/macauthorization/macauthorization.rb +1 -1
- data/lib/puppet/provider/mailalias/aliases.rb +3 -8
- data/lib/puppet/provider/mcx/mcxcontent.rb +7 -1
- data/lib/puppet/provider/mount.rb +8 -3
- data/lib/puppet/provider/nameservice.rb +1 -1
- data/lib/puppet/provider/nameservice/directoryservice.rb +5 -5
- data/lib/puppet/provider/package/appdmg.rb +1 -1
- data/lib/puppet/provider/package/apt.rb +0 -1
- data/lib/puppet/provider/package/dpkg.rb +86 -32
- data/lib/puppet/provider/package/fink.rb +0 -2
- data/lib/puppet/provider/package/freebsd.rb +0 -2
- data/lib/puppet/provider/package/openbsd.rb +57 -10
- data/lib/puppet/provider/package/opkg.rb +0 -1
- data/lib/puppet/provider/package/pacman.rb +0 -1
- data/lib/puppet/provider/package/pip.rb +1 -1
- data/lib/puppet/provider/package/pkgdmg.rb +17 -6
- data/lib/puppet/provider/package/pkgutil.rb +1 -1
- data/lib/puppet/provider/package/portage.rb +9 -1
- data/lib/puppet/provider/package/ports.rb +2 -2
- data/lib/puppet/provider/package/rpm.rb +29 -12
- data/lib/puppet/provider/package/rug.rb +1 -1
- data/lib/puppet/provider/package/urpmi.rb +11 -15
- data/lib/puppet/provider/package/windows/exe_package.rb +1 -1
- data/lib/puppet/provider/package/windows/package.rb +1 -26
- data/lib/puppet/provider/package/yum.rb +1 -1
- data/lib/puppet/provider/package/zypper.rb +22 -3
- data/lib/puppet/provider/parsedfile.rb +1 -12
- data/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb +1 -1
- data/lib/puppet/provider/service/base.rb +1 -1
- data/lib/puppet/provider/service/daemontools.rb +3 -3
- data/lib/puppet/provider/service/debian.rb +1 -1
- data/lib/puppet/provider/service/init.rb +14 -20
- data/lib/puppet/provider/service/openrc.rb +3 -1
- data/lib/puppet/provider/service/redhat.rb +5 -8
- data/lib/puppet/provider/service/runit.rb +3 -2
- data/lib/puppet/provider/service/systemd.rb +1 -1
- data/lib/puppet/provider/ssh_authorized_key/parsed.rb +1 -1
- data/lib/puppet/provider/sshkey/parsed.rb +0 -2
- data/lib/puppet/provider/user/aix.rb +25 -12
- data/lib/puppet/provider/user/directoryservice.rb +4 -7
- data/lib/puppet/provider/user/ldap.rb +0 -1
- data/lib/puppet/provider/user/user_role_add.rb +2 -0
- data/lib/puppet/provider/user/useradd.rb +1 -1
- data/lib/puppet/provider/zone/solaris.rb +1 -2
- data/lib/puppet/reference/metaparameter.rb +1 -1
- data/lib/puppet/reference/type.rb +1 -1
- data/lib/puppet/reports/rrdgraph.rb +1 -1
- data/lib/puppet/reports/tagmail.rb +1 -1
- data/lib/puppet/resource.rb +16 -4
- data/lib/puppet/resource/catalog.rb +111 -173
- data/lib/puppet/resource/status.rb +42 -3
- data/lib/puppet/resource/type.rb +33 -46
- data/lib/puppet/resource/type_collection.rb +19 -15
- data/lib/puppet/run.rb +5 -1
- data/lib/puppet/scheduler/scheduler.rb +14 -15
- data/lib/puppet/settings.rb +78 -41
- data/lib/puppet/settings/boolean_setting.rb +0 -2
- data/lib/puppet/settings/config_file.rb +0 -2
- data/lib/puppet/settings/directory_setting.rb +0 -2
- data/lib/puppet/settings/duration_setting.rb +0 -2
- data/lib/puppet/settings/enum_setting.rb +16 -0
- data/lib/puppet/settings/file_setting.rb +0 -2
- data/lib/puppet/settings/path_setting.rb +0 -2
- data/lib/puppet/settings/string_setting.rb +0 -3
- data/lib/puppet/settings/terminus_setting.rb +0 -2
- data/lib/puppet/ssl/certificate_authority.rb +102 -9
- data/lib/puppet/test/test_helper.rb +1 -0
- data/lib/puppet/transaction.rb +130 -292
- data/lib/puppet/transaction/additional_resource_generator.rb +126 -0
- data/lib/puppet/transaction/event.rb +16 -1
- data/lib/puppet/transaction/report.rb +34 -14
- data/lib/puppet/transaction/resource_harness.rb +16 -19
- data/lib/puppet/type.rb +59 -53
- data/lib/puppet/type/component.rb +0 -2
- data/lib/puppet/type/cron.rb +13 -2
- data/lib/puppet/type/exec.rb +5 -7
- data/lib/puppet/type/file.rb +9 -32
- data/lib/puppet/type/file/content.rb +4 -1
- data/lib/puppet/type/file/ctime.rb +3 -1
- data/lib/puppet/type/file/ensure.rb +1 -1
- data/lib/puppet/type/file/mode.rb +0 -1
- data/lib/puppet/type/file/mtime.rb +2 -1
- data/lib/puppet/type/group.rb +7 -9
- data/lib/puppet/type/host.rb +1 -2
- data/lib/puppet/type/mcx.rb +0 -1
- data/lib/puppet/type/mount.rb +38 -6
- data/lib/puppet/type/package.rb +2 -2
- data/lib/puppet/type/resources.rb +5 -4
- data/lib/puppet/type/schedule.rb +1 -4
- data/lib/puppet/type/selmodule.rb +1 -1
- data/lib/puppet/type/service.rb +1 -3
- data/lib/puppet/type/tidy.rb +3 -3
- data/lib/puppet/type/user.rb +9 -13
- data/lib/puppet/type/yumrepo.rb +11 -7
- data/lib/puppet/util.rb +14 -7
- data/lib/puppet/util/autoload.rb +0 -1
- data/lib/puppet/util/backups.rb +1 -3
- data/lib/puppet/util/classgen.rb +1 -1
- data/lib/puppet/util/command_line/puppet_option_parser.rb +1 -3
- data/lib/puppet/util/command_line/trollop.rb +1 -1
- data/lib/puppet/util/constant_inflector.rb +1 -2
- data/lib/puppet/util/errors.rb +1 -0
- data/lib/puppet/util/file_watcher.rb +28 -0
- data/lib/puppet/util/fileparsing.rb +1 -3
- data/lib/puppet/util/filetype.rb +0 -1
- data/lib/puppet/util/http_proxy.rb +38 -0
- data/lib/puppet/util/ldap/manager.rb +1 -2
- data/lib/puppet/util/log.rb +31 -10
- data/lib/puppet/util/log/destinations.rb +0 -50
- data/lib/puppet/util/metric.rb +8 -1
- data/lib/puppet/util/monkey_patches.rb +14 -148
- data/lib/puppet/util/network_device/cisco/facts.rb +1 -1
- data/lib/puppet/util/network_device/config.rb +6 -9
- data/lib/puppet/util/network_device/transport/ssh.rb +1 -1
- data/lib/puppet/util/pidlock.rb +3 -0
- data/lib/puppet/util/posix.rb +1 -1
- data/lib/puppet/util/profiler.rb +1 -1
- data/lib/puppet/util/rdoc.rb +1 -1
- data/lib/puppet/util/rdoc/generators/puppet_generator.rb +0 -1
- data/lib/puppet/util/rdoc/generators/template/puppet/puppet.rb +50 -42
- data/lib/puppet/util/retryaction.rb +0 -1
- data/lib/puppet/util/symbolic_file_mode.rb +5 -1
- data/lib/puppet/util/tagging.rb +0 -2
- data/lib/puppet/util/warnings.rb +3 -0
- data/lib/puppet/util/watched_file.rb +37 -0
- data/lib/puppet/util/watcher.rb +17 -0
- data/lib/puppet/util/watcher/change_watcher.rb +33 -0
- data/lib/puppet/util/watcher/periodic_watcher.rb +37 -0
- data/lib/puppet/util/watcher/timer.rb +19 -0
- data/lib/puppet/util/windows/user.rb +1 -1
- data/lib/puppet/version.rb +1 -1
- data/lib/puppetx.rb +109 -0
- data/lib/puppetx/puppet/bindings_scheme_handler.rb +130 -0
- data/lib/puppetx/puppet/hiera2_backend.rb +31 -0
- data/lib/puppetx/puppet/syntax_checker.rb +91 -0
- data/lib/puppetx/puppetlabs/syntax_checkers/json.rb +39 -0
- data/lib/semver.rb +1 -1
- data/man/man8/puppet-kick.8 +1 -1
- data/spec/fixtures/integration/provider/cron/crontab/unspecialized +15 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/hiera1config/binder_config.yaml +18 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/hiera1config/hiera.yaml +8 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/hiera1config/modules/good/common.yaml +1 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/hiera1config/modules/good/hiera.yaml +10 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/binder_config.yaml +19 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/common.yaml +1 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/hiera.yaml +11 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/localhost.yaml +1 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/awesome/common.yaml +3 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/awesome/hiera.yaml +13 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/awesome/lib/puppet/bindings/awesome/default.rb +4 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/awesome/lib/puppetx/awesome/echo_backend.rb +11 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/awesome/lib/puppetx/awesome/echo_scheme_handler.rb +18 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/awesome/localhost.yaml +1 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/bad/common.yaml +3 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/bad/hiera_config.yaml +9 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/good/common.yaml +2 -0
- data/spec/fixtures/unit/pops/binder/bindings_composer/ok/modules/good/hiera.yaml +11 -0
- data/spec/fixtures/unit/pops/binder/config/binder_config/ok/binder_config.yaml +9 -0
- data/spec/fixtures/unit/pops/binder/hiera2/bindings_provider/ok/hiera.yaml +9 -0
- data/spec/fixtures/unit/pops/binder/hiera2/bindings_provider/ok/node.example.com.json +9 -0
- data/spec/fixtures/unit/pops/binder/hiera2/bindings_provider/ok/node.example.com.yaml +5 -0
- data/spec/fixtures/unit/pops/binder/hiera2/config/bad_syntax/hiera.yaml +10 -0
- data/spec/fixtures/unit/pops/binder/hiera2/config/malformed_hierarchy/hiera.yaml +8 -0
- data/spec/fixtures/unit/pops/binder/hiera2/config/missing/foo.txt +1 -0
- data/spec/fixtures/unit/pops/binder/hiera2/config/no_backends/hiera.yaml +7 -0
- data/spec/fixtures/unit/pops/binder/hiera2/config/no_hierarchy/hiera.yaml +4 -0
- data/spec/fixtures/unit/pops/binder/hiera2/config/not_a_hash/hiera.yaml +2 -0
- data/spec/fixtures/unit/pops/binder/hiera2/config/ok/hiera.yaml +8 -0
- data/spec/fixtures/unit/pops/binder/hiera2/yaml_backend/empty/common.yaml +0 -0
- data/spec/fixtures/unit/pops/binder/hiera2/yaml_backend/invalid/common.yaml +1 -0
- data/spec/fixtures/unit/pops/binder/hiera2/yaml_backend/ok/common.yaml +2 -0
- data/spec/fixtures/unit/provider/package/openbsd/pkginfo_flavors.list +2 -0
- data/spec/integration/agent/logging_spec.rb +178 -0
- data/spec/integration/configurer_spec.rb +1 -1
- data/spec/integration/defaults_spec.rb +0 -6
- data/spec/integration/network/authconfig_spec.rb +19 -0
- data/spec/integration/network/server/webrick_spec.rb +10 -11
- data/spec/integration/parser/catalog_spec.rb +85 -0
- data/spec/integration/provider/cron/crontab_spec.rb +11 -0
- data/spec/integration/provider/mount_spec.rb +1 -0
- data/spec/integration/transaction_spec.rb +8 -8
- data/spec/integration/type/file_spec.rb +1 -1
- data/spec/integration/util/settings_spec.rb +58 -11
- data/spec/lib/matchers/include_in_order.rb +21 -0
- data/spec/lib/matchers/include_in_order_spec.rb +30 -0
- data/spec/lib/matchers/relationship_graph_matchers.rb +48 -0
- data/spec/lib/puppet_spec/compiler.rb +24 -0
- data/spec/lib/puppet_spec/pops.rb +16 -0
- data/spec/spec_helper.rb +0 -1
- data/spec/unit/application/agent_spec.rb +145 -145
- data/spec/unit/application/apply_spec.rb +1 -1
- data/spec/unit/application/doc_spec.rb +1 -1
- data/spec/unit/application/face_base_spec.rb +3 -3
- data/spec/unit/application/facts_spec.rb +1 -0
- data/spec/unit/application/master_spec.rb +0 -15
- data/spec/unit/application/queue_spec.rb +6 -12
- data/spec/unit/application/resource_spec.rb +1 -1
- data/spec/unit/configurer/fact_handler_spec.rb +19 -50
- data/spec/unit/configurer_spec.rb +23 -7
- data/spec/unit/daemon_spec.rb +97 -121
- data/spec/unit/defaults_spec.rb +44 -0
- data/spec/unit/face/node_spec.rb +2 -2
- data/spec/unit/file_serving/configuration/parser_spec.rb +23 -33
- data/spec/unit/file_serving/configuration_spec.rb +2 -2
- data/spec/unit/file_serving/mount/file_spec.rb +4 -4
- data/spec/unit/forge/repository_spec.rb +9 -29
- data/spec/unit/graph/key_spec.rb +41 -0
- data/spec/unit/{rb_tree_map_spec.rb → graph/rb_tree_map_spec.rb} +7 -7
- data/spec/unit/graph/relationship_graph_spec.rb +393 -0
- data/spec/unit/graph/sequential_prioritizer_spec.rb +32 -0
- data/spec/unit/{simple_graph_spec.rb → graph/simple_graph.rb} +42 -254
- data/spec/unit/graph/title_hash_prioritizer_spec.rb +49 -0
- data/spec/unit/hiera_puppet_spec.rb +1 -1
- data/spec/unit/indirector/catalog/active_record_spec.rb +4 -2
- data/spec/unit/indirector/catalog/compiler_spec.rb +20 -26
- data/spec/unit/indirector/face_spec.rb +1 -1
- data/spec/unit/indirector/facts/facter_spec.rb +11 -1
- data/spec/unit/indirector/facts/network_device_spec.rb +11 -1
- data/spec/unit/indirector/hiera_spec.rb +1 -1
- data/spec/unit/indirector/instrumentation_data/local_spec.rb +1 -1
- data/spec/unit/indirector/instrumentation_listener/local_spec.rb +1 -1
- data/spec/unit/indirector/request_spec.rb +92 -39
- data/spec/unit/indirector/rest_spec.rb +1 -0
- data/spec/unit/indirector_spec.rb +2 -2
- data/spec/unit/interface/option_builder_spec.rb +1 -0
- data/spec/unit/interface/option_spec.rb +1 -0
- data/spec/unit/interface_spec.rb +2 -2
- data/spec/unit/module_tool/applications/installer_spec.rb +49 -2
- data/spec/unit/module_tool/metadata_spec.rb +13 -0
- data/spec/unit/network/authstore_spec.rb +1 -1
- data/spec/unit/network/format_handler_spec.rb +33 -282
- data/spec/unit/network/format_support_spec.rb +199 -0
- data/spec/unit/network/formats_spec.rb +2 -2
- data/spec/unit/network/http/connection_spec.rb +88 -7
- data/spec/unit/network/http/handler_spec.rb +271 -249
- data/spec/unit/network/http/rack/rest_spec.rb +1 -1
- data/spec/unit/network/http/webrick/rest_spec.rb +73 -22
- data/spec/unit/network/http_pool_spec.rb +40 -0
- data/spec/unit/network/server_spec.rb +18 -207
- data/spec/unit/node/facts_spec.rb +68 -17
- data/spec/unit/other/selinux_spec.rb +24 -20
- data/spec/unit/parameter/boolean_spec.rb +25 -0
- data/spec/unit/parameter/value_collection_spec.rb +7 -7
- data/spec/unit/parameter_spec.rb +10 -13
- data/spec/unit/parser/ast/function_spec.rb +4 -4
- data/spec/unit/parser/ast/leaf_spec.rb +45 -6
- data/spec/unit/parser/collector_spec.rb +3 -3
- data/spec/unit/parser/compiler_spec.rb +4 -3
- data/spec/unit/parser/functions/create_resources_spec.rb +9 -25
- data/spec/unit/parser/functions/extlookup_spec.rb +2 -2
- data/spec/unit/parser/functions/hiera_include_spec.rb +12 -0
- data/spec/unit/parser/functions/lookup_spec.rb +96 -0
- data/spec/unit/parser/functions/regsubst_spec.rb +2 -2
- data/spec/unit/parser/functions/split_spec.rb +2 -2
- data/spec/unit/parser/functions/sprintf_spec.rb +1 -1
- data/spec/unit/parser/functions/versioncmp_spec.rb +2 -2
- data/spec/unit/parser/functions_spec.rb +7 -7
- data/spec/unit/parser/lexer_spec.rb +1 -1
- data/spec/unit/parser/methods/collect_spec.rb +43 -0
- data/spec/unit/parser/resource_spec.rb +9 -9
- data/spec/unit/parser/scope_spec.rb +45 -2
- data/spec/unit/parser/type_loader_spec.rb +159 -175
- data/spec/unit/pops/binder/binder_spec.rb +62 -0
- data/spec/unit/pops/binder/bindings_checker_spec.rb +196 -0
- data/spec/unit/pops/binder/bindings_composer_spec.rb +89 -0
- data/spec/unit/pops/binder/bindings_validator_factory_spec.rb +18 -0
- data/spec/unit/pops/binder/config/binder_config_spec.rb +48 -0
- data/spec/unit/pops/binder/hiera2/bindings_provider_spec.rb +74 -0
- data/spec/unit/pops/binder/hiera2/config_spec.rb +61 -0
- data/spec/unit/pops/binder/hiera2/yaml_backend_spec.rb +33 -0
- data/spec/unit/pops/binder/injector_spec.rb +789 -0
- data/spec/unit/pops/containment_spec.rb +1 -0
- data/spec/unit/pops/issues_spec.rb +1 -1
- data/spec/unit/pops/parser/evaluating_parser_spec.rb +88 -0
- data/spec/unit/pops/parser/lexer_spec.rb +1 -1
- data/spec/unit/pops/parser/parse_calls_spec.rb +4 -0
- data/spec/unit/pops/parser/parser_spec.rb +1 -1
- data/spec/unit/pops/types/type_calculator_spec.rb +484 -0
- data/spec/unit/pops/types/type_factory_spec.rb +65 -0
- data/spec/unit/pops/types/type_parser_spec.rb +93 -0
- data/spec/unit/property/list_spec.rb +1 -1
- data/spec/unit/property/ordered_list_spec.rb +1 -1
- data/spec/unit/provider/aixobject_spec.rb +101 -0
- data/spec/unit/provider/augeas/augeas_spec.rb +14 -3
- data/spec/unit/provider/mcx/mcxcontent_spec.rb +52 -16
- data/spec/unit/provider/mount/parsed_spec.rb +44 -56
- data/spec/unit/provider/mount_spec.rb +11 -2
- data/spec/unit/provider/naginator_spec.rb +8 -0
- data/spec/unit/provider/package/apt_spec.rb +5 -1
- data/spec/unit/provider/package/aptitude_spec.rb +9 -5
- data/spec/unit/provider/package/aptrpm_spec.rb +2 -2
- data/spec/unit/provider/package/dpkg_spec.rb +274 -99
- data/spec/unit/provider/package/openbsd_spec.rb +84 -1
- data/spec/unit/provider/package/opkg_spec.rb +3 -3
- data/spec/unit/provider/package/pip_spec.rb +16 -0
- data/spec/unit/provider/package/pkgdmg_spec.rb +62 -7
- data/spec/unit/provider/package/rpm_spec.rb +112 -21
- data/spec/unit/provider/package/urpmi.rb +80 -0
- data/spec/unit/provider/package/windows/exe_package_spec.rb +1 -1
- data/spec/unit/provider/package/yum_spec.rb +85 -0
- data/spec/unit/provider/package/zypper_spec.rb +25 -6
- data/spec/unit/provider/parsedfile_spec.rb +3 -2
- data/spec/unit/provider/service/init_spec.rb +10 -10
- data/spec/unit/provider/service/openrc_spec.rb +16 -0
- data/spec/unit/provider/service/openwrt_spec.rb +1 -1
- data/spec/unit/provider/service/redhat_spec.rb +7 -0
- data/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +2 -2
- data/spec/unit/provider/user/aix_spec.rb +89 -0
- data/spec/unit/provider/user/directoryservice_spec.rb +11 -4
- data/spec/unit/provider/user/user_role_add_spec.rb +18 -0
- data/spec/unit/provider_spec.rb +2 -13
- data/spec/unit/reports/http_spec.rb +1 -1
- data/spec/unit/resource/catalog_spec.rb +23 -97
- data/spec/unit/resource/resource_type.json +34 -0
- data/spec/unit/resource/status_spec.rb +56 -0
- data/spec/unit/resource/type_collection_spec.rb +6 -6
- data/spec/unit/resource/type_spec.rb +25 -5
- data/spec/unit/resource_spec.rb +68 -24
- data/spec/unit/run_spec.rb +16 -0
- data/spec/unit/scheduler/scheduler_spec.rb +14 -27
- data/spec/unit/semver_spec.rb +5 -0
- data/spec/unit/settings/enum_setting_spec.rb +27 -0
- data/spec/unit/settings_spec.rb +53 -44
- data/spec/unit/ssl/certificate_authority_spec.rb +155 -19
- data/spec/unit/transaction/additional_resource_generator_spec.rb +419 -0
- data/spec/unit/transaction/event_manager_spec.rb +2 -2
- data/spec/unit/transaction/event_spec.rb +57 -0
- data/spec/unit/transaction/report_spec.rb +66 -0
- data/spec/unit/transaction/resource_harness_spec.rb +27 -20
- data/spec/unit/transaction_spec.rb +182 -390
- data/spec/unit/type/augeas_spec.rb +3 -3
- data/spec/unit/type/component_spec.rb +0 -9
- data/spec/unit/type/computer_spec.rb +1 -1
- data/spec/unit/type/cron_spec.rb +2 -2
- data/spec/unit/type/exec_spec.rb +4 -2
- data/spec/unit/type/file/content_spec.rb +11 -0
- data/spec/unit/type/file/group_spec.rb +1 -1
- data/spec/unit/type/file_spec.rb +16 -8
- data/spec/unit/type/mount_spec.rb +445 -259
- data/spec/unit/type/package_spec.rb +4 -4
- data/spec/unit/type/resources_spec.rb +30 -1
- data/spec/unit/type/user_spec.rb +26 -3
- data/spec/unit/type/yumrepo_spec.rb +7 -27
- data/spec/unit/type/zone_spec.rb +4 -1
- data/spec/unit/type_spec.rb +66 -33
- data/spec/unit/util/backups_spec.rb +3 -3
- data/spec/unit/util/http_proxy_spec.rb +83 -0
- data/spec/unit/util/log_spec.rb +79 -8
- data/spec/unit/util/metric_spec.rb +12 -0
- data/spec/unit/util/monkey_patches_spec.rb +6 -0
- data/spec/unit/util/network_device/config_spec.rb +26 -64
- data/spec/unit/util/pidlock_spec.rb +4 -1
- data/spec/unit/util/tagging_spec.rb +5 -9
- data/spec/unit/util/warnings_spec.rb +1 -1
- data/spec/unit/util/watched_file_spec.rb +52 -0
- data/spec/unit/util/watcher/periodic_watcher_spec.rb +52 -0
- data/spec/unit/util/watcher_spec.rb +56 -0
- data/spec/unit/util_spec.rb +16 -0
- metadata +2767 -2576
- data/ext/debian/puppet.manpages +0 -32
- data/ext/osx/PackageInfo.plist +0 -36
- data/ext/osx/createpackage.sh +0 -187
- data/ext/redhat/rundir-perms.patch +0 -28
- data/lib/puppet/external/base64.rb +0 -19
- data/lib/puppet/util/graph.rb +0 -27
- data/lib/puppet/util/loadedfile.rb +0 -61
- data/lib/puppet/util/log_paths.rb +0 -22
- data/lib/puppet/util/subclass_loader.rb +0 -78
- data/spec/monkey_patches/publicize_methods.rb +0 -11
- data/spec/unit/util/loadedfile_spec.rb +0 -71
@@ -0,0 +1,130 @@
|
|
1
|
+
module Puppetx::Puppet
|
2
|
+
# BindingsSchemeHandler is a Puppet Extension Point for the purpose of extending Puppet with a
|
3
|
+
# handler of a URI scheme used in the Puppet Bindings / Injector system.
|
4
|
+
# The intended use is to create a class derived from this class and then register it with the
|
5
|
+
# Puppet Binder.
|
6
|
+
#
|
7
|
+
# Creating the Extension Class
|
8
|
+
# ----------------------------
|
9
|
+
# As an example, a class for getting LDAP data and transforming into bindings based on an LDAP URI scheme (such as RFC 2255, 4516)
|
10
|
+
# may be authored in say a puppet module called 'exampleorg/ldap'. The name of the class should start with `Puppetx::<user>::<module>`,
|
11
|
+
# e.g. 'Puppetx::Exampleorg::Ldap::LdapBindingsSchemeHandler" and
|
12
|
+
# be located in `lib/puppetx/exampleorg/Ldap/LdapBindingsSchemeHandler.rb`. (These rules are not enforced, but it make the class
|
13
|
+
# both auto-loadable, and guaranteed to not have a name that clashes with some other LdapBindingsSchemeHandler from some other
|
14
|
+
# author/organization.
|
15
|
+
#
|
16
|
+
# The Puppet Binder will auto-load the file when it
|
17
|
+
# has a binding to the class `Puppetx::Exampleorg::Ldap::LdapBindingsSchemeHandler'
|
18
|
+
# The Ruby Module `Puppetx` is created by Puppet, the remaining modules should be created by the loaded logic - e.g.:
|
19
|
+
#
|
20
|
+
# @example Defining an LdapBindingsSchemeHandler
|
21
|
+
# module Puppetx::Exampleorg
|
22
|
+
# module Ldap
|
23
|
+
# class LdapBindingsSchemeHandler < Puppetx::Puppetlabs::BindingsSchemeHandler
|
24
|
+
# # implement the methods
|
25
|
+
# end
|
26
|
+
# end
|
27
|
+
# end
|
28
|
+
#
|
29
|
+
#
|
30
|
+
# The expand_included method
|
31
|
+
# --------------------------
|
32
|
+
# This method is given a URI (as entred by a user in a bindings configuration) and the handler's first task is to
|
33
|
+
# perform checking, transformation, and possible expansion into multiple URIs for loading. The result is always an array
|
34
|
+
# of URIs. This method allows users to enter wild-cards, or to represent something symbolic that is transformed into one or
|
35
|
+
# more "real URIs" to load. (It is allowed to change scheme!).
|
36
|
+
# If the "optional" feature is supported, the handler should not include the URI in the result unless it will be able to produce
|
37
|
+
# bindings for the given URI (as an option it may produce an empty set of bindings).
|
38
|
+
#
|
39
|
+
# The expand_excluded method
|
40
|
+
# ---------------------------
|
41
|
+
# This method is given an URI (as entered by the user in a bindings configuration), and it is the handler's second task
|
42
|
+
# to perform checking, transformation, and possible expansion into multiple URIs that should not be loaded. The result is always
|
43
|
+
# an array of URIs. The user may be allowed to enter wild-cards etc. The URIs produced by this method should have the same syntax
|
44
|
+
# as those produced by {#expand_included} since they are excluded by comparison.
|
45
|
+
#
|
46
|
+
# The contributed_bindings method
|
47
|
+
# -------------------------------
|
48
|
+
# As the last step, the handler is being called once per URI that was included, and not later excluded to produce the
|
49
|
+
# contributed bindings. It is given three arguments, uri (the uri to load), scope (to provide access to the rest of the
|
50
|
+
# environment), and an acceptor (of issues), on which issues can be recorded.
|
51
|
+
#
|
52
|
+
# Reporting Errors/Issues
|
53
|
+
# -----------------------
|
54
|
+
# Issues are reported by calling the given composer's acceptor, which takes a severity (e.g. `:error`,
|
55
|
+
# `:warning`, or `:ignore`), an {Puppet::Pops::Issues::Issue Issue} instance, and a {Puppet::Pops::Adapters::SourcePosAdapter
|
56
|
+
# SourcePosAdapter} (which describes details about linenumber, position, and length of the problem area). If the scheme is
|
57
|
+
# not based on file, line, pos - nil can be passed. The URI itself can be passed as file.
|
58
|
+
#
|
59
|
+
# @example Reporting an issue
|
60
|
+
# # create an issue with a symbolic name (that can serve as a reference to more details about the problem),
|
61
|
+
# # make the name unique
|
62
|
+
# issue = Puppet::Pops::Issues::issue(:EXAMPLEORG_LDAP_ILLEGAL_URI) { "The URI is not a valid Ldap URI" }
|
63
|
+
# source_pos = nil
|
64
|
+
#
|
65
|
+
# # report it
|
66
|
+
# composer.acceptor.accept(Puppet::Pops::Validation::Diagnostic.new(:error, issue, uri.to_s, source_pos, {}))
|
67
|
+
#
|
68
|
+
# Instead of reporting issues, an exception can be raised.
|
69
|
+
#
|
70
|
+
# @abstract
|
71
|
+
# @api public
|
72
|
+
#
|
73
|
+
class BindingsSchemeHandler
|
74
|
+
|
75
|
+
# Produces the bindings contributed to the binding system based on the given URI.
|
76
|
+
# @param uri [URI] the URI to load bindings from
|
77
|
+
# @param scope [Puppet::Pops::Parser::Scope] access to scope and the rest of the environment
|
78
|
+
# @param composer [Puppet::Pops::Binder::BindingsComposer] a composer giving access to modules by name, and a diagnostics acceptor
|
79
|
+
# @return [Puppet::Pops::Binder::Bindings::ContributedBindings] the bindings to contribute, most conveniently
|
80
|
+
# created by calling {Puppet::Pops::Binder::BindingsFactory.contributed_bindings}.
|
81
|
+
# @api public
|
82
|
+
#
|
83
|
+
def contributed_bindings(uri, scope, composer)
|
84
|
+
raise NotImplementedError, "The BindingsProviderScheme for uri: '#{uri}' must implement 'contributed_bindings'"
|
85
|
+
end
|
86
|
+
|
87
|
+
# Expands the given URI for the purpose of including the bindings it refers to. The input may contain
|
88
|
+
# wild-cards (if supported by this handler), and it is this methods responsibility to transform such into
|
89
|
+
# real loadable URIs.
|
90
|
+
#
|
91
|
+
# A scheme handler that does not support optionality, or wildcards should simply return the given URI
|
92
|
+
# in an Array.
|
93
|
+
#
|
94
|
+
# @param uri [URI] the uri for which bindings are to be produced.
|
95
|
+
# @param composer [Puppet::Pops::Binder::BindingsComposer] a composer giving access to modules by name, and a diagnostics acceptor
|
96
|
+
# @return [Array<URI>] the transformed, and possibly expanded set of URIs to include.
|
97
|
+
# @api public
|
98
|
+
#
|
99
|
+
def expand_included(uri, composer)
|
100
|
+
[uri]
|
101
|
+
end
|
102
|
+
|
103
|
+
# Expands the given URI for the purpose of excluding the bindings it refers to. The input may contain
|
104
|
+
# wild-cards (if supported by this handler), and it is this methods responsibility to transform such into
|
105
|
+
# real loadable URIs (that match those produced by {#expand_included} that should be excluded from the result.
|
106
|
+
#
|
107
|
+
# A scheme handler that does not support optionality, or wildcards should simply return the given URI
|
108
|
+
# in an Array.
|
109
|
+
#
|
110
|
+
# @param uri [URI] the uri for which bindings are to be produced.
|
111
|
+
# @param composer [Puppet::Pops::Binder::BindingsComposer] a composer giving access to modules by name, and a diagnostics acceptor
|
112
|
+
# @return [Array<URI>] the transformed, and possibly expanded set of URIs to include-
|
113
|
+
# @api public
|
114
|
+
#
|
115
|
+
def expand_excluded(uri, composer)
|
116
|
+
[uri]
|
117
|
+
end
|
118
|
+
|
119
|
+
# Returns whether the uri is optional or not. A scheme handler does not have to use this method
|
120
|
+
# to determine optionality, but if it supports such a feature, and there is no technical problem in supporting
|
121
|
+
# it this way, it should be done the same (or at least similar) way across all scheme handlers.
|
122
|
+
#
|
123
|
+
# This method interprets a URI ending with `?` or has query that is '?optional' as optional.
|
124
|
+
#
|
125
|
+
# @return [Boolean] whether the uri is an optional reference or not.
|
126
|
+
def is_optional?(uri)
|
127
|
+
(query = uri.query) && query == '' || query == 'optional'
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Puppetx::Puppet
|
2
|
+
|
3
|
+
# Hiera2Backend is a Puppet Extension Point for the purpose of extending Puppet with a hiera data compatible
|
4
|
+
# backend. The intended use is to create a class derived from this class and then register it with the
|
5
|
+
# Puppet Binder under a backend name in the `binder_config.yaml` file to map symbolic name to class name.
|
6
|
+
#
|
7
|
+
# The responsibility of a Hiera2 backend is minimal. It should read the given file (with some extesion(s) determined by
|
8
|
+
# the backend, and return a hash of the content. If the directory does not exist, or the file does not exist an empty
|
9
|
+
# hash should be produced.
|
10
|
+
#
|
11
|
+
# @abstract
|
12
|
+
# @api public
|
13
|
+
#
|
14
|
+
class Hiera2Backend
|
15
|
+
# Produces a hash with data read from the file in the given
|
16
|
+
# directory having the given file_name (with extensions appended under the discretion of this
|
17
|
+
# backend).
|
18
|
+
#
|
19
|
+
# Should return an empty hash if the directory or the file does not exist. May raise exception on other types of errors, but
|
20
|
+
# not return nil.
|
21
|
+
#
|
22
|
+
# @param directory [String] the path to the directory containing the file to read
|
23
|
+
# @param file_name [String] the file name (without extension) that should be read
|
24
|
+
# @return [Hash<String, Object>, Hash<Symbol, Object>] the produced hash with data, may be empty if there was no file
|
25
|
+
# @api public
|
26
|
+
#
|
27
|
+
def read_data(directory, file_name)
|
28
|
+
raise NotImplementedError, "The class #{self.class.name} should have implemented the method 'read_data(directory, file_name)'"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
module Puppetx::Puppet
|
2
|
+
# SyntaxChecker is a Puppet Extension Point for the purpose of extending Puppet with syntax checkers.
|
3
|
+
# The intended use is to create a class derived from this class and then register it with the
|
4
|
+
# Puppet Binder.
|
5
|
+
#
|
6
|
+
# Creating the Extension Class
|
7
|
+
# ----------------------------
|
8
|
+
# As an example, a class for checking custom xml (aware of some custom schemes) may be authored in
|
9
|
+
# say a puppet module called 'exampleorg/xmldata'. The name of the class should start with `Puppetx::<user>::<module>`,
|
10
|
+
# e.g. 'Puppetx::Exampleorg::XmlData::XmlChecker" and
|
11
|
+
# be located in `lib/puppetx/exampleorg/xml_data/xml_checker.rb`. The Puppet Binder will auto-load this file when it
|
12
|
+
# has a binding to the class `Puppetx::Exampleorg::XmlData::XmlChecker'
|
13
|
+
# The Ruby Module `Puppetx` is created by Puppet, the remaining modules should be created by the loaded logic - e.g.:
|
14
|
+
#
|
15
|
+
# @example Defining an XmlChecker
|
16
|
+
# module Puppetx::Exampleorg
|
17
|
+
# module XmlData
|
18
|
+
# class XmlChecker < Puppetx::Puppetlabs::SyntaxCheckers::SyntaxChecker
|
19
|
+
# def check(text, syntax_identifier, acceptor, location_hash)
|
20
|
+
# # do the checking
|
21
|
+
# end
|
22
|
+
# end
|
23
|
+
# end
|
24
|
+
# end
|
25
|
+
#
|
26
|
+
# Implementing the check method
|
27
|
+
# -----------------------------
|
28
|
+
# The implementation of the {#check} method should naturally perform syntax checking of the given text/string and
|
29
|
+
# produce found issues on the given `acceptor`. These can be warnings or errors. The method should return `false` if
|
30
|
+
# any warnings or errors were produced (it is up to the caller to check for error/warning conditions and report them
|
31
|
+
# to the user).
|
32
|
+
#
|
33
|
+
# Issues are reported by calling the given `acceptor`, which takes a severity (e.g. `:error`,
|
34
|
+
# or `:warning), an {Puppet::Pops::Issues::Issue} instance, and a {Puppet::Pops::Adapters::SourcePosAdapter}
|
35
|
+
# (which describes details about linenumber, position, and length of the problem area). Note that the
|
36
|
+
# `location_info` given to the check method holds information about the location of the string in its *container*
|
37
|
+
# (e.g. the source position of a Heredoc); this information can be used if more detailed information is not
|
38
|
+
# available, or combined if there are more details (relative to the start of the checked string).
|
39
|
+
#
|
40
|
+
# @example Reporting an issue
|
41
|
+
# # create an issue with a symbolic name (that can serve as a reference to more details about the problem),
|
42
|
+
# # make the name unique
|
43
|
+
# issue = Puppet::Pops::Issues::issue(:EXAMPLEORG_XMLDATA_ILLEGAL_XML) { "syntax error found in xml text" }
|
44
|
+
# source_pos = Puppet::Pops::Adapters::SourcePosAdapter.new()
|
45
|
+
# source_pos.line = info[:line] # use this if there is no detail from the used parser
|
46
|
+
# source_pos.pos = info[:pos] # use this pos if there is no detail from used parser
|
47
|
+
#
|
48
|
+
# # report it
|
49
|
+
# acceptor.accept(Puppet::Pops::Validation::Diagnostic.new(:error, issue, info[:file], source_pos, {}))
|
50
|
+
#
|
51
|
+
# There is usually a cap on the number of errors/warnings that are presented to the user, this is handled by the
|
52
|
+
# reporting logic, but care should be taken to not generate too many as the issues are kept in memory until
|
53
|
+
# the checker returns. The acceptor may set a limit and simply ignore issues past a certain (high) number of reported
|
54
|
+
# issues (this number is typically higher than the cap on issues reported to the user).
|
55
|
+
#
|
56
|
+
# The `syntax_identifier`
|
57
|
+
# -----------------------
|
58
|
+
# The extension makes use of a syntax identifier written in mime-style. This identifier can be something simple
|
59
|
+
# as 'xml', or 'json', but can also consist of several segments joined with '+' where the most specific syntax variant
|
60
|
+
# is placed first. When searching for a syntax checker; say for JSON having some special traits, say 'userdata', the
|
61
|
+
# author of the text may indicate this as the text having the syntax "userdata+json" - when a checker is looked up it is
|
62
|
+
# first checked if there is a checker for "userdata+json", if none is found, a lookup is made for "json" (since the text
|
63
|
+
# must at least be valid json). The given identifier is passed to the checker (to allow the same checker to check for
|
64
|
+
# several dialects/specializations).
|
65
|
+
#
|
66
|
+
# Use in Puppet DSL
|
67
|
+
# -----------------
|
68
|
+
# The Puppet DSL Heredoc support and Puppet Templates makes use of the syntax checker extension. A user of a
|
69
|
+
# heredoc can specify the syntax in the heredoc tag, e.g.`@(END:userdata+json)`.
|
70
|
+
#
|
71
|
+
#
|
72
|
+
# @abstract
|
73
|
+
#
|
74
|
+
class SyntaxChecker
|
75
|
+
# Checks the text for syntax issues and reports them to the given acceptor.
|
76
|
+
# This implementation is abstract, it raises {NotImplementedError} since a subclass should have implemented the
|
77
|
+
# method.
|
78
|
+
#
|
79
|
+
# @param text [String] The text to check
|
80
|
+
# @param syntax_identifier [String] The syntax identifier in mime style (e.g. 'json', 'json-patch+json', 'xml', 'myapp+xml'
|
81
|
+
# @option location_info [String] :file The filename where the string originates
|
82
|
+
# @option location_info [Integer] :line The line number identifying the location where the string is being used/checked
|
83
|
+
# @option location_info [Integer] :position The position on the line identifying the location where the string is being used/checked
|
84
|
+
# @return [Boolean] Whether the checked string had issues (warnings and/or errors) or not.
|
85
|
+
# @api public
|
86
|
+
#
|
87
|
+
def check(text, syntax_identifier, acceptor, location_info)
|
88
|
+
raise NotImplementedError, "The class #{self.class.name} should have implemented the method check()"
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# A syntax checker for JSON.
|
2
|
+
# @api public
|
3
|
+
class Puppetx::Puppetlabs::SyntaxCheckers::Json < Puppetx::Puppet::SyntaxChecker
|
4
|
+
|
5
|
+
# Checks the text for JSON syntax issues and reports them to the given acceptor.
|
6
|
+
# This implementation is abstract, it raises {NotImplementedError} since a subclass should have implemented the
|
7
|
+
# method.
|
8
|
+
#
|
9
|
+
# @param text [String] The text to check
|
10
|
+
# @param syntax [String] The syntax identifier in mime style (e.g. 'json', 'json-patch+json', 'xml', 'myapp+xml'
|
11
|
+
# @option location_info [String] :file The filename where the string originates
|
12
|
+
# @option location_info [Integer] :line The line number identifying the location where the string is being used/checked
|
13
|
+
# @option location_info [Integer] :position The position on the line identifying the location where the string is being used/checked
|
14
|
+
# @return [Boolean] Whether the checked string had issues (warnings and/or errors) or not.
|
15
|
+
# @api public
|
16
|
+
#
|
17
|
+
def check(text, syntax, acceptor, location_info={})
|
18
|
+
raise ArgumentError.new("Json syntax checker: the text to check must be a String.") unless text.is_a?(String)
|
19
|
+
raise ArgumentError.new("Json syntax checker: the syntax identifier must be a String, e.g. json, data+json") unless syntax.is_a?(String)
|
20
|
+
raise ArgumentError.new("Json syntax checker: invalid Acceptor, got: '#{acceptor.class.name}'.") unless acceptor.is_a?(Puppet::Pops::Validation::Acceptor)
|
21
|
+
raise ArgumentError.new("Json syntax checker: location_info must be a Hash") unless info.is_a?(Hash)
|
22
|
+
|
23
|
+
begin
|
24
|
+
JSON.parse(text)
|
25
|
+
rescue => e
|
26
|
+
# Cap the message to 100 chars and replace newlines
|
27
|
+
msg = "Json syntax checker:: Cannot parse invalid JSON string. \"#{e.message().slice(0,100).gsub(/\r?\n/, "\\n")}\""
|
28
|
+
|
29
|
+
# TODO: improve the pops API to allow simpler diagnostic creation while still maintaining capabilities
|
30
|
+
# and the issue code. (In this case especially, where there is only a single error message being issued).
|
31
|
+
#
|
32
|
+
issue = Puppet::Pops::Issues::issue(:ILLEGAL_JSON) { msg }
|
33
|
+
source_pos = Puppet::Pops::Adapters::SourcePosAdapter.new()
|
34
|
+
source_pos.line = location_info[:line]
|
35
|
+
source_pos.pos = location_info[:pos]
|
36
|
+
acceptor.accept(Puppet::Pops::Validation::Diagnostic.new(:error, issue, location_info[:file], source_pos, {}))
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/lib/semver.rb
CHANGED
@@ -119,6 +119,6 @@ class SemVer < Numeric
|
|
119
119
|
MIN.instance_variable_set(:@vstring, 'vMIN')
|
120
120
|
|
121
121
|
MAX = SemVer.new('8.0.0')
|
122
|
-
MAX.instance_variable_set(:@major,
|
122
|
+
MAX.instance_variable_set(:@major, Float::INFINITY) # => Infinity
|
123
123
|
MAX.instance_variable_set(:@vstring, 'vMAX')
|
124
124
|
end
|
data/man/man8/puppet-kick.8
CHANGED
@@ -114,7 +114,7 @@ Print the hosts you would connect to but do not actually connect\. This option r
|
|
114
114
|
.
|
115
115
|
.TP
|
116
116
|
\-\-ping
|
117
|
-
Do
|
117
|
+
Do an ICMP echo against the target host\. Skip hosts that don\'t respond to ping\.
|
118
118
|
.
|
119
119
|
.SH "EXAMPLE"
|
120
120
|
.
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# HEADER: some simple
|
2
|
+
# HEADER: header
|
3
|
+
@daily /bin/unnamed_special_command >> /dev/null 2>&1
|
4
|
+
|
5
|
+
# commend with blankline above and below
|
6
|
+
|
7
|
+
17-19,22 0-23/2 * * 2 /bin/unnamed_regular_command
|
8
|
+
|
9
|
+
# Puppet Name: My daily failure
|
10
|
+
MAILTO=""
|
11
|
+
* * * * * /bin/false
|
12
|
+
# Puppet Name: Monthly job
|
13
|
+
SHELL=/bin/sh
|
14
|
+
MAILTO=mail@company.com
|
15
|
+
15 14 1 * * $HOME/bin/monthly
|
@@ -0,0 +1,18 @@
|
|
1
|
+
---
|
2
|
+
version: 1
|
3
|
+
layers:
|
4
|
+
[{name: site, include: 'confdir-hiera:/'},
|
5
|
+
{name: modules, include: ['module-hiera:/*/', 'module:/*::default'] }
|
6
|
+
]
|
7
|
+
categories:
|
8
|
+
[['node', '$fqdn'],
|
9
|
+
['environment', '${environment}'],
|
10
|
+
['osfamily', '${osfamily}'],
|
11
|
+
['common', 'true']
|
12
|
+
]
|
13
|
+
#extensions:
|
14
|
+
# scheme_handlers:
|
15
|
+
# echo: 'Puppetx::Awesome::EchoSchemeHandler'
|
16
|
+
#
|
17
|
+
# hiera_backends:
|
18
|
+
# echo: 'Puppetx::Awesome::EchoBackend'
|
@@ -0,0 +1 @@
|
|
1
|
+
the_meaning_of_life: 300
|
@@ -0,0 +1,19 @@
|
|
1
|
+
---
|
2
|
+
version: 1
|
3
|
+
layers:
|
4
|
+
[{name: site, include: 'confdir-hiera:/'},
|
5
|
+
{name: test, include: 'echo:/quick/brown/fox'},
|
6
|
+
{name: modules, include: ['module-hiera:/*/', 'module:/*::default'], exclude: 'module-hiera:/bad/' }
|
7
|
+
]
|
8
|
+
categories:
|
9
|
+
[['node', '$fqdn'],
|
10
|
+
['environment', '${environment}'],
|
11
|
+
['osfamily', '${osfamily}'],
|
12
|
+
['common', 'true']
|
13
|
+
]
|
14
|
+
extensions:
|
15
|
+
scheme_handlers:
|
16
|
+
echo: 'Puppetx::Awesome::EchoSchemeHandler'
|
17
|
+
|
18
|
+
hiera_backends:
|
19
|
+
echo: 'Puppetx::Awesome::EchoBackend'
|
@@ -0,0 +1 @@
|
|
1
|
+
has_funny_hat: 'the pope'
|
@@ -0,0 +1 @@
|
|
1
|
+
the_meaning_of_life: 42
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'puppetx/puppet/hiera2_backend'
|
2
|
+
|
3
|
+
module Puppetx
|
4
|
+
module Awesome
|
5
|
+
class EchoBackend < Puppetx::Puppet::Hiera2Backend
|
6
|
+
def read_data(directory, file_name)
|
7
|
+
{"echo::#{file_name}" => "echo... #{File.basename(directory)}/#{file_name}"}
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|