puppet 3.3.2 → 3.4.0.rc1
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/CONTRIBUTING.md +22 -0
- data/Gemfile +11 -2
- data/README.md +13 -17
- data/README_DEVELOPER.md +1 -1
- data/Rakefile +1 -1
- data/examples/hiera/README.md +4 -4
- data/ext/debian/puppetmaster.init +1 -0
- data/ext/debian/rules +2 -5
- data/ext/nagios/check_puppet.rb +7 -7
- data/ext/osx/file_mapping.yaml +1 -1
- data/ext/osx/preflight.erb +34 -19
- data/ext/rack/{files/config.ru → config.ru} +0 -0
- data/ext/rack/{files/apache2.conf → example-passenger-vhost.conf} +6 -0
- data/ext/redhat/puppet.spec.erb +20 -2
- data/ext/systemd/{puppetagent.service → puppet.service} +0 -0
- data/lib/hiera_puppet.rb +2 -2
- data/lib/puppet/agent.rb +1 -6
- data/lib/puppet/application.rb +15 -2
- data/lib/puppet/application/agent.rb +2 -7
- data/lib/puppet/application/apply.rb +8 -13
- data/lib/puppet/application/cert.rb +47 -7
- data/lib/puppet/application/device.rb +1 -6
- data/lib/puppet/application/face_base.rb +1 -1
- data/lib/puppet/application/filebucket.rb +1 -1
- data/lib/puppet/application/inspect.rb +3 -12
- data/lib/puppet/application/master.rb +1 -6
- data/lib/puppet/application/queue.rb +1 -6
- data/lib/puppet/application/resource.rb +2 -6
- data/lib/puppet/coercion.rb +11 -0
- data/lib/puppet/configurer.rb +5 -3
- data/lib/puppet/configurer/downloader.rb +3 -1
- data/lib/puppet/configurer/plugin_handler.rb +10 -0
- data/lib/puppet/confine.rb +80 -0
- data/lib/puppet/{provider/confine → confine}/exists.rb +3 -3
- data/lib/puppet/{provider/confine → confine}/false.rb +2 -2
- data/lib/puppet/{provider/confine → confine}/feature.rb +2 -2
- data/lib/puppet/{provider/confine → confine}/true.rb +2 -2
- data/lib/puppet/{provider/confine → confine}/variable.rb +2 -2
- data/lib/puppet/{provider/confine_collection.rb → confine_collection.rb} +4 -4
- data/lib/puppet/{provider/confiner.rb → confiner.rb} +4 -4
- data/lib/puppet/daemon.rb +2 -6
- data/lib/puppet/data_binding.rb +2 -30
- data/lib/puppet/defaults.rb +283 -174
- data/lib/puppet/error.rb +1 -0
- data/lib/puppet/external/nagios.rb +0 -2
- data/lib/puppet/external/nagios/base.rb +4 -3
- data/lib/puppet/external/nagios/grammar.ry +173 -112
- data/lib/puppet/external/nagios/parser.rb +233 -184
- data/lib/puppet/face/file/store.rb +1 -1
- data/lib/puppet/face/module/generate.rb +5 -7
- data/lib/puppet/face/parser.rb +12 -2
- data/lib/puppet/face/plugin.rb +6 -0
- data/lib/puppet/feature/base.rb +16 -0
- data/lib/puppet/feature/external_facts.rb +5 -0
- data/lib/puppet/feature/libuser.rb +1 -1
- data/lib/puppet/feature/msgpack.rb +1 -0
- data/lib/puppet/feature/rails.rb +2 -2
- data/lib/puppet/file_bucket/dipper.rb +8 -6
- data/lib/puppet/file_bucket/file.rb +17 -1
- data/lib/puppet/file_serving/base.rb +21 -10
- data/lib/puppet/file_serving/configuration.rb +5 -7
- data/lib/puppet/file_serving/configuration/parser.rb +1 -1
- data/lib/puppet/file_serving/content.rb +1 -1
- data/lib/puppet/file_serving/fileset.rb +3 -3
- data/lib/puppet/file_serving/metadata.rb +22 -18
- data/lib/puppet/file_serving/mount/file.rb +1 -1
- data/lib/puppet/file_serving/mount/pluginfacts.rb +35 -0
- data/lib/puppet/file_system.rb +3 -0
- data/lib/puppet/file_system/file.rb +261 -0
- data/lib/puppet/file_system/file18.rb +5 -0
- data/lib/puppet/file_system/file19.rb +5 -0
- data/lib/puppet/file_system/file19windows.rb +113 -0
- data/lib/puppet/file_system/memory_file.rb +31 -0
- data/lib/puppet/file_system/tempfile.rb +20 -0
- data/lib/puppet/indirector/active_record.rb +1 -0
- data/lib/puppet/indirector/catalog/compiler.rb +28 -0
- data/lib/puppet/indirector/certificate_request/memory.rb +6 -0
- data/lib/puppet/indirector/data_binding/hiera.rb +46 -2
- data/lib/puppet/indirector/direct_file_server.rb +2 -2
- data/lib/puppet/indirector/facts/facter.rb +25 -0
- data/lib/puppet/indirector/file_bucket_file/file.rb +60 -74
- data/lib/puppet/indirector/indirection.rb +5 -1
- data/lib/puppet/indirector/json.rb +1 -1
- data/lib/puppet/indirector/key/ca.rb +4 -0
- data/lib/puppet/indirector/key/file.rb +7 -3
- data/lib/puppet/indirector/key/memory.rb +6 -0
- data/lib/puppet/indirector/node/write_only_yaml.rb +2 -2
- data/lib/puppet/indirector/request.rb +17 -11
- data/lib/puppet/indirector/resource/ral.rb +5 -0
- data/lib/puppet/indirector/resource/rest.rb +1 -0
- data/lib/puppet/indirector/resource/store_configs.rb +4 -0
- data/lib/puppet/indirector/rest.rb +2 -1
- data/lib/puppet/indirector/ssl_file.rb +7 -7
- data/lib/puppet/indirector/terminus.rb +4 -0
- data/lib/puppet/indirector/yaml.rb +3 -3
- data/lib/puppet/interface/documentation.rb +4 -11
- data/lib/puppet/module.rb +19 -6
- data/lib/puppet/module_tool/applications/builder.rb +1 -1
- data/lib/puppet/module_tool/applications/installer.rb +1 -1
- data/lib/puppet/module_tool/checksums.rb +1 -1
- data/lib/puppet/module_tool/dependency.rb +7 -3
- data/lib/puppet/module_tool/metadata.rb +6 -2
- data/lib/puppet/module_tool/tar.rb +2 -1
- data/lib/puppet/module_tool/tar/gnu.rb +6 -2
- data/lib/puppet/module_tool/tar/mini.rb +2 -0
- data/lib/puppet/module_tool/tar/solaris.rb +2 -5
- data/lib/puppet/network/authconfig.rb +0 -2
- data/lib/puppet/network/authentication.rb +1 -1
- data/lib/puppet/network/authstore.rb +6 -7
- data/lib/puppet/network/format.rb +2 -3
- data/lib/puppet/network/format_handler.rb +16 -11
- data/lib/puppet/network/format_support.rb +14 -0
- data/lib/puppet/network/formats.rb +26 -0
- data/lib/puppet/network/http/connection.rb +8 -41
- data/lib/puppet/network/http/handler.rb +28 -32
- data/lib/puppet/network/http/webrick.rb +15 -22
- data/lib/puppet/network/http_pool.rb +43 -9
- data/lib/puppet/network/rights.rb +0 -0
- data/lib/puppet/node.rb +24 -8
- data/lib/puppet/node/environment.rb +18 -20
- data/lib/puppet/node/facts.rb +23 -6
- data/lib/puppet/parameter.rb +15 -2
- data/lib/puppet/parameter/boolean.rb +5 -0
- data/lib/puppet/parameter/value_collection.rb +6 -4
- data/lib/puppet/parser/ast/resourceparam.rb +2 -1
- data/lib/puppet/parser/compiler.rb +25 -9
- data/lib/puppet/parser/files.rb +1 -1
- data/lib/puppet/parser/functions.rb +12 -21
- data/lib/puppet/parser/functions/collect.rb +6 -35
- data/lib/puppet/parser/functions/contain.rb +26 -0
- data/lib/puppet/parser/functions/create_resources.rb +5 -0
- data/lib/puppet/parser/functions/extlookup.rb +2 -2
- data/lib/puppet/parser/functions/file.rb +1 -1
- data/lib/puppet/parser/functions/{reject.rb → filter.rb} +13 -12
- data/lib/puppet/parser/functions/fqdn_rand.rb +13 -5
- data/lib/puppet/parser/functions/include.rb +18 -1
- data/lib/puppet/parser/functions/map.rb +44 -0
- data/lib/puppet/parser/functions/select.rb +6 -38
- data/lib/puppet/parser/lexer.rb +1 -1
- data/lib/puppet/parser/parser_support.rb +1 -1
- data/lib/puppet/parser/resource.rb +6 -45
- data/lib/puppet/parser/scope.rb +33 -2
- data/lib/puppet/parser/type_loader.rb +4 -60
- data/lib/puppet/pops/binder/bindings_loader.rb +1 -1
- data/lib/puppet/pops/binder/config/binder_config.rb +3 -3
- data/lib/puppet/pops/binder/hiera2/bindings_provider.rb +1 -1
- data/lib/puppet/pops/binder/scheme_handler/confdir_hiera_scheme.rb +1 -1
- data/lib/puppet/pops/binder/scheme_handler/module_hiera_scheme.rb +2 -2
- data/lib/puppet/pops/issues.rb +4 -0
- data/lib/puppet/pops/model/ast_transformer.rb +4 -1
- data/lib/puppet/pops/model/model_label_provider.rb +1 -1
- data/lib/puppet/pops/parser/egrammar.ra +5 -24
- data/lib/puppet/pops/parser/eparser.rb +859 -902
- data/lib/puppet/pops/parser/lexer.rb +48 -30
- data/lib/puppet/pops/parser/parser_support.rb +1 -1
- data/lib/puppet/pops/patterns.rb +4 -4
- data/lib/puppet/pops/utils.rb +1 -1
- data/lib/puppet/pops/validation/checker3_1.rb +25 -20
- data/lib/puppet/provider.rb +23 -6
- data/lib/puppet/provider/aixobject.rb +0 -0
- data/lib/puppet/provider/augeas/augeas.rb +21 -5
- data/lib/puppet/provider/confine.rb +5 -79
- data/lib/puppet/provider/cron/crontab.rb +0 -0
- data/lib/puppet/provider/exec.rb +9 -7
- data/lib/puppet/provider/exec/posix.rb +10 -1
- data/lib/puppet/provider/exec/windows.rb +1 -1
- data/lib/puppet/provider/file/posix.rb +1 -0
- data/lib/puppet/provider/file/windows.rb +16 -5
- data/lib/puppet/provider/group/aix.rb +0 -0
- data/lib/puppet/provider/group/windows_adsi.rb +33 -1
- data/lib/puppet/provider/macauthorization/macauthorization.rb +1 -1
- data/lib/puppet/provider/mailalias/aliases.rb +0 -0
- data/lib/puppet/provider/maillist/mailman.rb +0 -0
- data/lib/puppet/provider/mount/parsed.rb +0 -0
- data/lib/puppet/provider/nameservice/directoryservice.rb +3 -3
- data/lib/puppet/provider/package/appdmg.rb +1 -1
- data/lib/puppet/provider/package/apple.rb +1 -1
- data/lib/puppet/provider/package/apt.rb +1 -1
- data/lib/puppet/provider/package/aptitude.rb +0 -0
- data/lib/puppet/provider/package/blastwave.rb +1 -1
- data/lib/puppet/provider/package/dpkg.rb +1 -1
- data/lib/puppet/provider/package/fink.rb +1 -1
- data/lib/puppet/provider/package/freebsd.rb +0 -0
- data/lib/puppet/provider/package/gem.rb +0 -0
- data/lib/puppet/provider/package/macports.rb +0 -0
- data/lib/puppet/provider/package/msi.rb +4 -10
- data/lib/puppet/provider/package/nim.rb +8 -8
- data/lib/puppet/provider/package/openbsd.rb +1 -1
- data/lib/puppet/provider/package/opkg.rb +0 -0
- data/lib/puppet/provider/package/pacman.rb +2 -2
- data/lib/puppet/provider/package/pkgdmg.rb +1 -1
- data/lib/puppet/provider/package/pkgutil.rb +1 -1
- data/lib/puppet/provider/package/ports.rb +0 -0
- data/lib/puppet/provider/package/rpm.rb +39 -3
- data/lib/puppet/provider/package/sun.rb +3 -3
- data/lib/puppet/provider/package/sunfreeware.rb +0 -0
- data/lib/puppet/provider/package/windows.rb +12 -19
- data/lib/puppet/provider/package/windows/package.rb +1 -1
- data/lib/puppet/provider/package/yum.rb +2 -2
- data/lib/puppet/provider/parsedfile.rb +0 -0
- data/lib/puppet/provider/port/parsed.rb +0 -0
- data/lib/puppet/provider/service/base.rb +0 -0
- data/lib/puppet/provider/service/bsd.rb +3 -3
- data/lib/puppet/provider/service/daemontools.rb +8 -8
- data/lib/puppet/provider/service/debian.rb +0 -0
- data/lib/puppet/provider/service/freebsd.rb +3 -3
- data/lib/puppet/provider/service/init.rb +5 -4
- data/lib/puppet/provider/service/launchd.rb +35 -24
- data/lib/puppet/provider/service/openbsd.rb +23 -0
- data/lib/puppet/provider/service/redhat.rb +0 -0
- data/lib/puppet/provider/service/runit.rb +3 -3
- data/lib/puppet/provider/service/smf.rb +0 -0
- data/lib/puppet/provider/service/src.rb +0 -0
- data/lib/puppet/provider/service/systemd.rb +0 -0
- data/lib/puppet/provider/service/upstart.rb +3 -3
- data/lib/puppet/provider/ssh_authorized_key/parsed.rb +2 -2
- data/lib/puppet/provider/sshkey/parsed.rb +0 -0
- data/lib/puppet/provider/user/aix.rb +0 -0
- data/lib/puppet/provider/user/directoryservice.rb +1 -1
- data/lib/puppet/provider/user/useradd.rb +1 -1
- data/lib/puppet/provider/zone/solaris.rb +1 -1
- data/lib/puppet/rails/benchmark.rb +1 -1
- data/lib/puppet/reference/configuration.rb +1 -2
- data/lib/puppet/reference/indirection.rb +12 -14
- data/lib/puppet/relationship.rb +7 -4
- data/lib/puppet/reports.rb +2 -2
- data/lib/puppet/reports/rrdgraph.rb +1 -1
- data/lib/puppet/reports/store.rb +3 -3
- data/lib/puppet/reports/tagmail.rb +2 -2
- data/lib/puppet/resource.rb +66 -8
- data/lib/puppet/resource/catalog.rb +18 -25
- data/lib/puppet/resource/status.rb +10 -4
- data/lib/puppet/run.rb +6 -2
- data/lib/puppet/settings.rb +39 -119
- data/lib/puppet/settings/base_setting.rb +8 -9
- data/lib/puppet/settings/directory_setting.rb +8 -0
- data/lib/puppet/settings/file_setting.rb +35 -1
- data/lib/puppet/settings/priority_setting.rb +42 -0
- data/lib/puppet/ssl.rb +4 -0
- data/lib/puppet/ssl/certificate.rb +18 -0
- data/lib/puppet/ssl/certificate_authority.rb +101 -72
- data/lib/puppet/ssl/certificate_authority/autosign_command.rb +44 -0
- data/lib/puppet/ssl/certificate_authority/interface.rb +21 -17
- data/lib/puppet/ssl/certificate_factory.rb +38 -12
- data/lib/puppet/ssl/certificate_request.rb +201 -47
- data/lib/puppet/ssl/certificate_request_attributes.rb +34 -0
- data/lib/puppet/ssl/certificate_revocation_list.rb +2 -2
- data/lib/puppet/ssl/host.rb +21 -10
- data/lib/puppet/ssl/inventory.rb +6 -10
- data/lib/puppet/ssl/key.rb +1 -1
- data/lib/puppet/ssl/oids.rb +78 -0
- data/lib/puppet/ssl/validator.rb +41 -97
- data/lib/puppet/ssl/validator/default_validator.rb +153 -0
- data/lib/puppet/ssl/validator/no_validator.rb +17 -0
- data/lib/puppet/status.rb +4 -0
- data/lib/puppet/test/test_helper.rb +5 -0
- data/lib/puppet/transaction.rb +13 -0
- data/lib/puppet/transaction/event.rb +8 -3
- data/lib/puppet/transaction/report.rb +6 -2
- data/lib/puppet/transaction/resource_harness.rb +173 -115
- data/lib/puppet/type.rb +30 -13
- data/lib/puppet/type/augeas.rb +12 -46
- data/lib/puppet/type/component.rb +1 -7
- data/lib/puppet/type/cron.rb +0 -0
- data/lib/puppet/type/exec.rb +13 -1
- data/lib/puppet/type/file.rb +19 -10
- data/lib/puppet/type/file/checksum.rb +0 -0
- data/lib/puppet/type/file/content.rb +3 -0
- data/lib/puppet/type/file/ensure.rb +33 -15
- data/lib/puppet/type/file/group.rb +0 -0
- data/lib/puppet/type/file/mode.rb +6 -2
- data/lib/puppet/type/file/owner.rb +0 -0
- data/lib/puppet/type/file/source.rb +65 -14
- data/lib/puppet/type/file/target.rb +6 -6
- data/lib/puppet/type/file/type.rb +0 -0
- data/lib/puppet/type/filebucket.rb +0 -0
- data/lib/puppet/type/group.rb +18 -0
- data/lib/puppet/type/host.rb +0 -0
- data/lib/puppet/type/k5login.rb +4 -4
- data/lib/puppet/type/mailalias.rb +0 -0
- data/lib/puppet/type/maillist.rb +0 -0
- data/lib/puppet/type/mount.rb +15 -1
- data/lib/puppet/type/package.rb +7 -1
- data/lib/puppet/type/port.rb +0 -0
- data/lib/puppet/type/schedule.rb +9 -4
- data/lib/puppet/type/service.rb +1 -1
- data/lib/puppet/type/sshkey.rb +0 -0
- data/lib/puppet/type/tidy.rb +1 -1
- data/lib/puppet/type/user.rb +3 -0
- data/lib/puppet/type/yumrepo.rb +8 -6
- data/lib/puppet/type/zpool.rb +0 -0
- data/lib/puppet/util.rb +4 -31
- data/lib/puppet/util/adsi.rb +73 -17
- data/lib/puppet/util/autoload.rb +3 -3
- data/lib/puppet/util/backups.rb +4 -4
- data/lib/puppet/util/cacher.rb +7 -13
- data/lib/puppet/util/checksums.rb +2 -2
- data/lib/puppet/util/classgen.rb +3 -1
- data/lib/puppet/util/colors.rb +1 -0
- data/lib/puppet/util/command_line.rb +5 -0
- data/lib/puppet/util/docs.rb +33 -27
- data/lib/puppet/util/execution.rb +42 -18
- data/lib/puppet/util/filetype.rb +3 -3
- data/lib/puppet/util/instance_loader.rb +2 -2
- data/lib/puppet/util/instrumentation.rb +23 -42
- data/lib/puppet/util/instrumentation/data.rb +11 -4
- data/lib/puppet/util/instrumentation/indirection_probe.rb +11 -4
- data/lib/puppet/util/instrumentation/instrumentable.rb +7 -14
- data/lib/puppet/util/instrumentation/listener.rb +15 -8
- data/lib/puppet/util/instrumentation/listeners/log.rb +4 -10
- data/lib/puppet/util/instrumentation/listeners/performance.rb +8 -14
- data/lib/puppet/util/limits.rb +12 -0
- data/lib/puppet/util/lockfile.rb +2 -2
- data/lib/puppet/util/log.rb +14 -6
- data/lib/puppet/util/log/destinations.rb +23 -1
- data/lib/puppet/util/metric.rb +9 -3
- data/lib/puppet/util/monkey_patches.rb +7 -2
- data/lib/puppet/util/network_device/config.rb +1 -1
- data/lib/puppet/util/plugins.rb +1 -1
- data/lib/puppet/util/posix.rb +0 -0
- data/lib/puppet/util/profiler.rb +7 -2
- data/lib/puppet/util/provider_features.rb +2 -2
- data/lib/puppet/util/rdoc.rb +28 -30
- data/lib/puppet/util/rdoc/code_objects.rb +75 -25
- data/lib/puppet/util/rdoc/generators/puppet_generator.rb +1 -1
- data/lib/puppet/util/rdoc/parser.rb +12 -487
- data/lib/puppet/util/rdoc/parser/puppet_parser_core.rb +477 -0
- data/lib/puppet/util/rdoc/parser/puppet_parser_rdoc1.rb +19 -0
- data/lib/puppet/util/rdoc/parser/puppet_parser_rdoc2.rb +14 -0
- data/lib/puppet/util/reference.rb +1 -1
- data/lib/puppet/util/resource_template.rb +1 -1
- data/lib/puppet/util/selinux.rb +1 -1
- data/lib/puppet/util/storage.rb +2 -2
- data/lib/puppet/util/suidmanager.rb +1 -1
- data/lib/puppet/util/tag_set.rb +29 -0
- data/lib/puppet/util/tagging.rb +8 -24
- data/lib/puppet/util/watched_file.rb +1 -1
- data/lib/puppet/util/watcher.rb +1 -1
- data/lib/puppet/util/windows.rb +3 -0
- data/lib/puppet/util/windows/access_control_entry.rb +84 -0
- data/lib/puppet/util/windows/access_control_list.rb +106 -0
- data/lib/puppet/util/windows/file.rb +213 -0
- data/lib/puppet/util/windows/process.rb +199 -0
- data/lib/puppet/util/windows/root_certs.rb +52 -37
- data/lib/puppet/util/windows/security.rb +270 -245
- data/lib/puppet/util/windows/security_descriptor.rb +62 -0
- data/lib/puppet/util/windows/sid.rb +26 -4
- data/lib/puppet/version.rb +2 -2
- data/spec/fixtures/releases/jamtur01-apache/lib/puppet/provider/a2mod/debian.rb +1 -1
- data/spec/fixtures/unit/indirector/{hiera → data_binding/hiera}/global.yaml +0 -0
- data/spec/fixtures/unit/indirector/data_binding/hiera/invalid.yaml +1 -0
- data/spec/fixtures/unit/module/trailing-comma.json +24 -0
- data/spec/fixtures/unit/util/monkey_patches/x509.pem +32 -0
- data/spec/integration/application/apply_spec.rb +1 -1
- data/spec/integration/application/doc_spec.rb +1 -1
- data/spec/integration/configurer_spec.rb +4 -2
- data/spec/integration/data_binding.rb +100 -0
- data/spec/integration/indirector/catalog/compiler_spec.rb +16 -13
- data/spec/integration/indirector/direct_file_server_spec.rb +3 -5
- data/spec/integration/indirector/file_content/file_server_spec.rb +2 -2
- data/spec/integration/node/facts_spec.rb +1 -1
- data/spec/integration/node_spec.rb +1 -1
- data/spec/integration/parser/compiler_spec.rb +90 -0
- data/spec/integration/parser/parser_spec.rb +2 -2
- data/spec/integration/provider/cron/crontab_spec.rb +3 -5
- data/spec/integration/resource/catalog_spec.rb +1 -1
- data/spec/integration/ssl/autosign_spec.rb +90 -0
- data/spec/integration/ssl/certificate_authority_spec.rb +62 -69
- data/spec/integration/ssl/certificate_revocation_list_spec.rb +1 -1
- data/spec/integration/ssl/host_spec.rb +1 -1
- data/spec/integration/transaction_spec.rb +13 -13
- data/spec/integration/type/exec_spec.rb +2 -2
- data/spec/integration/type/file_spec.rb +287 -45
- data/spec/integration/type/tidy_spec.rb +3 -3
- data/spec/integration/util/rdoc/parser_spec.rb +236 -35
- data/spec/integration/util/settings_spec.rb +1 -1
- data/spec/integration/util/windows/process_spec.rb +22 -0
- data/spec/integration/util/windows/security_spec.rb +316 -106
- data/spec/lib/matchers/containment_matchers.rb +52 -0
- data/spec/lib/puppet_spec/compiler.rb +6 -0
- data/spec/lib/puppet_spec/files.rb +20 -21
- data/spec/shared_behaviours/documentation_on_faces.rb +3 -3
- data/spec/shared_behaviours/file_server_terminus.rb +2 -2
- data/spec/shared_contexts/platform.rb +1 -0
- data/spec/spec_helper.rb +13 -1
- data/spec/unit/agent_spec.rb +0 -12
- data/spec/unit/application/agent_spec.rb +4 -4
- data/spec/unit/application/apply_spec.rb +18 -2
- data/spec/unit/application/cert_spec.rb +8 -6
- data/spec/unit/application/device_spec.rb +1 -1
- data/spec/unit/application/filebucket_spec.rb +1 -1
- data/spec/unit/application/inspect_spec.rb +1 -1
- data/spec/unit/application_spec.rb +24 -0
- data/spec/unit/configurer/downloader_spec.rb +8 -7
- data/spec/unit/configurer/fact_handler_spec.rb +23 -0
- data/spec/unit/configurer/plugin_handler_spec.rb +7 -2
- data/spec/unit/configurer_spec.rb +15 -5
- data/spec/unit/{provider/confine → confine}/exists_spec.rb +12 -12
- data/spec/unit/{provider/confine → confine}/false_spec.rb +9 -9
- data/spec/unit/{provider/confine → confine}/feature_spec.rb +10 -10
- data/spec/unit/{provider/confine → confine}/true_spec.rb +7 -7
- data/spec/unit/{provider/confine → confine}/variable_spec.rb +16 -16
- data/spec/unit/{provider/confine_collection_spec.rb → confine_collection_spec.rb} +30 -30
- data/spec/unit/{provider/confine_spec.rb → confine_spec.rb} +11 -11
- data/spec/unit/{provider/confiner_spec.rb → confiner_spec.rb} +4 -4
- data/spec/unit/face/parser_spec.rb +54 -0
- data/spec/unit/file_bucket/dipper_spec.rb +2 -2
- data/spec/unit/file_serving/base_spec.rb +32 -9
- data/spec/unit/file_serving/configuration_spec.rb +7 -7
- data/spec/unit/file_serving/content_spec.rb +12 -7
- data/spec/unit/file_serving/fileset_spec.rb +57 -27
- data/spec/unit/file_serving/metadata_spec.rb +74 -12
- data/spec/unit/file_serving/mount/file_spec.rb +10 -10
- data/spec/unit/file_serving/mount/pluginfacts_spec.rb +73 -0
- data/spec/unit/file_system/file_spec.rb +486 -0
- data/spec/unit/file_system/tempfile_spec.rb +48 -0
- data/spec/unit/graph/relationship_graph_spec.rb +0 -6
- data/spec/unit/hiera_puppet_spec.rb +2 -2
- data/spec/unit/indirector/catalog/compiler_spec.rb +15 -19
- data/spec/unit/indirector/certificate_status/file_spec.rb +30 -40
- data/spec/unit/indirector/data_binding/hiera_spec.rb +95 -2
- data/spec/unit/indirector/direct_file_server_spec.rb +6 -6
- data/spec/unit/indirector/facts/facter_spec.rb +33 -0
- data/spec/unit/indirector/file_bucket_file/file_spec.rb +61 -52
- data/spec/unit/indirector/file_metadata/file_spec.rb +2 -2
- data/spec/unit/indirector/file_server_spec.rb +4 -4
- data/spec/unit/indirector/json_spec.rb +4 -4
- data/spec/unit/indirector/key/file_spec.rb +13 -14
- data/spec/unit/indirector/resource/ral_spec.rb +7 -0
- data/spec/unit/indirector/resource/store_configs_spec.rb +11 -0
- data/spec/unit/indirector/rest_spec.rb +7 -3
- data/spec/unit/indirector/ssl_file_spec.rb +14 -17
- data/spec/unit/indirector/yaml_spec.rb +4 -4
- data/spec/unit/module_spec.rb +43 -15
- data/spec/unit/module_tool/tar/gnu_spec.rb +2 -2
- data/spec/unit/module_tool/tar/solaris_spec.rb +2 -2
- data/spec/unit/module_tool/tar_spec.rb +45 -0
- data/spec/unit/network/authconfig_spec.rb +2 -1
- data/spec/unit/network/authentication_spec.rb +2 -2
- data/spec/unit/network/format_handler_spec.rb +2 -2
- data/spec/unit/network/formats_spec.rb +24 -0
- data/spec/unit/network/http/connection_spec.rb +76 -199
- data/spec/unit/network/http/handler_spec.rb +33 -34
- data/spec/unit/network/http_pool_spec.rb +8 -5
- data/spec/unit/node/environment_spec.rb +76 -90
- data/spec/unit/node/facts_spec.rb +20 -3
- data/spec/unit/node_spec.rb +43 -0
- data/spec/unit/parameter/boolean_spec.rb +22 -12
- data/spec/unit/parser/ast/resourceparam_spec.rb +51 -0
- data/spec/unit/parser/compiler_spec.rb +103 -35
- data/spec/unit/parser/eparser_adapter_spec.rb +12 -12
- data/spec/unit/parser/files_spec.rb +11 -11
- data/spec/unit/parser/functions/contain_spec.rb +185 -0
- data/spec/unit/parser/functions/create_resources_spec.rb +13 -5
- data/spec/unit/parser/functions/generate_spec.rb +1 -1
- data/spec/unit/parser/functions_spec.rb +2 -2
- data/spec/unit/parser/lexer_spec.rb +1 -1
- data/spec/unit/parser/methods/each_spec.rb +1 -1
- data/spec/unit/parser/methods/{select_spec.rb → filter_spec.rb} +11 -11
- data/spec/unit/parser/methods/map_spec.rb +95 -0
- data/spec/unit/parser/methods/reduce_spec.rb +12 -11
- data/spec/unit/parser/methods/shared.rb +5 -5
- data/spec/unit/parser/methods/slice_spec.rb +13 -13
- data/spec/unit/parser/parser_spec.rb +1 -1
- data/spec/unit/parser/resource/param_spec.rb +44 -0
- data/spec/unit/parser/resource_spec.rb +16 -15
- data/spec/unit/pops/model/ast_transformer_spec.rb +18 -4
- data/spec/unit/pops/parser/lexer_spec.rb +22 -5
- data/spec/unit/pops/parser/parse_calls_spec.rb +5 -5
- data/spec/unit/pops/transformer/transform_calls_spec.rb +6 -6
- data/spec/unit/pops/transformer/transform_containers_spec.rb +2 -2
- data/spec/unit/pops/validator/validator_spec.rb +31 -0
- data/spec/unit/provider/augeas/augeas_spec.rb +57 -2
- data/spec/unit/provider/exec/posix_spec.rb +8 -3
- data/spec/unit/provider/file/posix_spec.rb +2 -2
- data/spec/unit/provider/group/windows_adsi_spec.rb +70 -3
- data/spec/unit/provider/nameservice/directoryservice_spec.rb +3 -3
- data/spec/unit/provider/package/apt_spec.rb +1 -1
- data/spec/unit/provider/package/msi_spec.rb +15 -42
- data/spec/unit/provider/package/openbsd_spec.rb +3 -3
- data/spec/unit/provider/package/rpm_spec.rb +56 -13
- data/spec/unit/provider/package/windows_spec.rb +15 -19
- data/spec/unit/provider/service/base_spec.rb +1 -1
- data/spec/unit/provider/service/daemontools_spec.rb +18 -8
- data/spec/unit/provider/service/freebsd_spec.rb +3 -3
- data/spec/unit/provider/service/gentoo_spec.rb +5 -2
- data/spec/unit/provider/service/init_spec.rb +17 -17
- data/spec/unit/provider/service/launchd_spec.rb +76 -23
- data/spec/unit/provider/service/openbsd_spec.rb +125 -0
- data/spec/unit/provider/service/openwrt_spec.rb +1 -1
- data/spec/unit/provider/service/runit_spec.rb +12 -5
- data/spec/unit/provider/service/upstart_spec.rb +4 -4
- data/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +5 -5
- data/spec/unit/provider/user/directoryservice_spec.rb +4 -4
- data/spec/unit/provider/zone/solaris_spec.rb +1 -1
- data/spec/unit/provider_spec.rb +2 -2
- data/spec/unit/reports/http_spec.rb +19 -34
- data/spec/unit/reports/store_spec.rb +2 -2
- data/spec/unit/resource/catalog_spec.rb +81 -11
- data/spec/unit/resource/status_spec.rb +11 -1
- data/spec/unit/resource/type_spec.rb +30 -1
- data/spec/unit/resource_spec.rb +40 -4
- data/spec/unit/settings/file_setting_spec.rb +2 -2
- data/spec/unit/settings/path_setting_spec.rb +2 -2
- data/spec/unit/settings/priority_setting_spec.rb +66 -0
- data/spec/unit/settings_spec.rb +16 -31
- data/spec/unit/ssl/certificate_authority/autosign_command_spec.rb +30 -0
- data/spec/unit/ssl/certificate_authority_spec.rb +129 -134
- data/spec/unit/ssl/certificate_factory_spec.rb +18 -0
- data/spec/unit/ssl/certificate_request_attributes_spec.rb +61 -0
- data/spec/unit/ssl/certificate_request_spec.rb +103 -0
- data/spec/unit/ssl/certificate_spec.rb +31 -18
- data/spec/unit/ssl/host_spec.rb +34 -8
- data/spec/unit/ssl/inventory_spec.rb +27 -62
- data/spec/unit/ssl/key_spec.rb +4 -4
- data/spec/unit/ssl/oids_spec.rb +48 -0
- data/spec/unit/ssl/validator_spec.rb +49 -6
- data/spec/unit/status_spec.rb +9 -0
- data/spec/unit/transaction/event_spec.rb +1 -9
- data/spec/unit/transaction/report_spec.rb +20 -1
- data/spec/unit/transaction/resource_harness_spec.rb +60 -210
- data/spec/unit/transaction_spec.rb +54 -8
- data/spec/unit/type/component_spec.rb +2 -2
- data/spec/unit/type/exec_spec.rb +14 -7
- data/spec/unit/type/file/content_spec.rb +13 -2
- data/spec/unit/type/file/ctime_spec.rb +1 -1
- data/spec/unit/type/file/mode_spec.rb +48 -2
- data/spec/unit/type/file/mtime_spec.rb +1 -1
- data/spec/unit/type/file/source_spec.rb +177 -7
- data/spec/unit/type/file_spec.rb +63 -71
- data/spec/unit/type/group_spec.rb +20 -0
- data/spec/unit/type/k5login_spec.rb +3 -3
- data/spec/unit/type/mount_spec.rb +53 -0
- data/spec/unit/type/nagios_spec.rb +216 -0
- data/spec/unit/type/package_spec.rb +7 -1
- data/spec/unit/type/schedule_spec.rb +6 -0
- data/spec/unit/type/service_spec.rb +3 -3
- data/spec/unit/type/tidy_spec.rb +14 -14
- data/spec/unit/type/user_spec.rb +9 -0
- data/spec/unit/type_spec.rb +86 -4
- data/spec/unit/util/adsi_spec.rb +120 -12
- data/spec/unit/util/autoload_spec.rb +14 -14
- data/spec/unit/util/backups_spec.rb +29 -21
- data/spec/unit/util/checksums_spec.rb +2 -1
- data/spec/unit/util/command_line_spec.rb +41 -0
- data/spec/unit/util/docs_spec.rb +91 -0
- data/spec/unit/util/execution_spec.rb +26 -2
- data/spec/unit/util/filetype_spec.rb +7 -7
- data/spec/unit/util/lockfile_spec.rb +2 -2
- data/spec/unit/util/log/destinations_spec.rb +32 -0
- data/spec/unit/util/monkey_patches_spec.rb +41 -0
- data/spec/unit/util/pidlock_spec.rb +6 -6
- data/spec/unit/util/rdoc/parser_spec.rb +15 -13
- data/spec/unit/util/rdoc_spec.rb +18 -24
- data/spec/unit/util/resource_template_spec.rb +3 -3
- data/spec/unit/util/selinux_spec.rb +4 -2
- data/spec/unit/util/storage_spec.rb +4 -4
- data/spec/unit/util/suidmanager_spec.rb +7 -0
- data/spec/unit/util/tag_set_spec.rb +46 -0
- data/spec/unit/util/tagging_spec.rb +82 -45
- data/spec/unit/util/watcher_spec.rb +4 -1
- data/spec/unit/util/windows/access_control_entry_spec.rb +67 -0
- data/spec/unit/util/windows/access_control_list_spec.rb +133 -0
- data/spec/unit/util/windows/root_certs_spec.rb +10 -8
- data/spec/unit/util/windows/security_descriptor_spec.rb +117 -0
- data/spec/unit/util/windows/sid_spec.rb +69 -0
- data/spec/unit/util_spec.rb +7 -7
- data/tasks/ci.rake +17 -36
- metadata +2811 -2746
- checksums.yaml +0 -7
- data/examples/mac_automount.pp +0 -16
- data/examples/mcx_dock_absent.pp +0 -4
- data/examples/mcx_dock_default.pp +0 -118
- data/examples/mcx_dock_full.pp +0 -125
- data/examples/mcx_dock_invalid.pp +0 -9
- data/examples/mcx_nogroup.pp +0 -118
- data/examples/mcx_notexists_absent.pp +0 -4
- data/ext/rack/README +0 -58
- data/ext/rack/manifest.pp +0 -59
- data/lib/puppet/external/lock.rb +0 -63
- data/lib/puppet/indirector/hiera.rb +0 -39
- data/lib/puppet/parser/functions/foreach.rb +0 -95
- data/spec/integration/network/server/webrick_spec.rb +0 -76
- data/spec/integration/parser/functions_spec.rb +0 -16
- data/spec/unit/indirector/hiera_spec.rb +0 -154
- data/spec/unit/parser/methods/collect_spec.rb +0 -153
- data/spec/unit/parser/methods/foreach_spec.rb +0 -91
- data/spec/unit/parser/methods/reject_spec.rb +0 -73
- data/spec/unit/resource/resource_type.json +0 -34
@@ -44,6 +44,11 @@ Puppet::Parser::Functions::newfunction(:create_resources, :arity => -3, :doc =>
|
|
44
44
|
|
45
45
|
ENDHEREDOC
|
46
46
|
raise ArgumentError, ("create_resources(): wrong number of arguments (#{args.length}; must be 2 or 3)") if args.length > 3
|
47
|
+
raise ArgumentError, ('create_resources(): second argument must be a hash') unless args[1].is_a?(Hash)
|
48
|
+
if args.length == 3
|
49
|
+
raise ArgumentError, ('create_resources(): third argument, if provided, must be a hash') unless args[2].is_a?(Hash)
|
50
|
+
end
|
51
|
+
|
47
52
|
|
48
53
|
type, instances, defaults = args
|
49
54
|
defaults ||= {}
|
@@ -100,7 +100,7 @@ This is for back compatibility to interpolate variables with %. % interpolation
|
|
100
100
|
|
101
101
|
# if we got a custom data file, put it first in the array of search files
|
102
102
|
if datafile != ""
|
103
|
-
datafiles << extlookup_datadir + "/#{datafile}.csv" if File.
|
103
|
+
datafiles << extlookup_datadir + "/#{datafile}.csv" if Puppet::FileSystem::File.exist?(extlookup_datadir + "/#{datafile}.csv")
|
104
104
|
end
|
105
105
|
|
106
106
|
extlookup_precedence.each do |d|
|
@@ -111,7 +111,7 @@ This is for back compatibility to interpolate variables with %. % interpolation
|
|
111
111
|
|
112
112
|
datafiles.each do |file|
|
113
113
|
if desired.nil?
|
114
|
-
if File.
|
114
|
+
if Puppet::FileSystem::File.exist?(file)
|
115
115
|
result = CSV.read(file).find_all do |r|
|
116
116
|
r[0] == key
|
117
117
|
end
|
@@ -10,7 +10,7 @@ Puppet::Parser::Functions::newfunction(
|
|
10
10
|
unless Puppet::Util.absolute_path?(file)
|
11
11
|
raise Puppet::ParseError, "Files must be fully qualified"
|
12
12
|
end
|
13
|
-
if
|
13
|
+
if Puppet::FileSystem::File.exist?(file)
|
14
14
|
ret = File.read(file)
|
15
15
|
break
|
16
16
|
end
|
@@ -1,47 +1,48 @@
|
|
1
1
|
require 'puppet/parser/ast/lambda'
|
2
2
|
|
3
3
|
Puppet::Parser::Functions::newfunction(
|
4
|
-
:
|
4
|
+
:filter,
|
5
5
|
:type => :rvalue,
|
6
6
|
:arity => 2,
|
7
7
|
:doc => <<-'ENDHEREDOC') do |args|
|
8
8
|
Applies a parameterized block to each element in a sequence of entries from the first
|
9
|
-
argument and returns an array
|
9
|
+
argument and returns an array or hash (same type as left operand)
|
10
|
+
with the entries for which the block evaluates to true.
|
10
11
|
|
11
12
|
This function takes two mandatory arguments: the first should be an Array or a Hash, and the second
|
12
13
|
a parameterized block as produced by the puppet syntax:
|
13
14
|
|
14
|
-
$a.
|
15
|
+
$a.filter |$x| { ... }
|
15
16
|
|
16
17
|
When the first argument is an Array, the block is called with each entry in turn. When the first argument
|
17
|
-
is a
|
18
|
+
is a Hash the entry is an array with `[key, value]`.
|
18
19
|
|
19
20
|
The returned filtered object is of the same type as the receiver.
|
20
21
|
|
21
22
|
*Examples*
|
22
23
|
|
23
|
-
# selects all that
|
24
|
-
$a = ["
|
25
|
-
$a.
|
24
|
+
# selects all that end with berry
|
25
|
+
$a = ["raspberry", "blueberry", "orange"]
|
26
|
+
$a.filter |$x| { $x =~ /berry$/ }
|
26
27
|
|
27
|
-
- Since 3.
|
28
|
+
- Since 3.4
|
28
29
|
- requires `parser = future`.
|
29
30
|
ENDHEREDOC
|
30
31
|
|
31
32
|
receiver = args[0]
|
32
33
|
pblock = args[1]
|
33
34
|
|
34
|
-
raise ArgumentError, ("
|
35
|
+
raise ArgumentError, ("filter(): wrong argument type (#{pblock.class}; must be a parameterized block.") unless pblock.is_a? Puppet::Parser::AST::Lambda
|
35
36
|
|
36
37
|
case receiver
|
37
38
|
when Array
|
38
|
-
receiver.
|
39
|
+
receiver.select {|x| pblock.call(self, x) }
|
39
40
|
when Hash
|
40
|
-
result = receiver.
|
41
|
+
result = receiver.select {|x, y| pblock.call(self, [x, y]) }
|
41
42
|
# Ruby 1.8.7 returns Array
|
42
43
|
result = Hash[result] unless result.is_a? Hash
|
43
44
|
result
|
44
45
|
else
|
45
|
-
raise ArgumentError, ("
|
46
|
+
raise ArgumentError, ("filter(): wrong argument type (#{receiver.class}; must be an Array or a Hash.")
|
46
47
|
end
|
47
48
|
end
|
@@ -1,12 +1,20 @@
|
|
1
1
|
require 'digest/md5'
|
2
2
|
|
3
3
|
Puppet::Parser::Functions::newfunction(:fqdn_rand, :arity => -2, :type => :rvalue, :doc =>
|
4
|
-
"
|
5
|
-
|
6
|
-
The second argument specifies a number to add to the seed and is optional, for example:
|
4
|
+
"Usage: `fqdn_rand(MAX, [SEED])`. MAX is required and must be a positive
|
5
|
+
integer; SEED is optional and may be any number or string.
|
7
6
|
|
8
|
-
|
9
|
-
|
7
|
+
Generates a random whole number greater than or equal to 0 and less than MAX,
|
8
|
+
combining the `$fqdn` fact and the value of SEED for repeatable randomness.
|
9
|
+
(That is, each node will get a different random number from this function, but
|
10
|
+
a given node's result will be the same every time unless its hostname changes.)
|
11
|
+
|
12
|
+
This function is usually used for spacing out runs of resource-intensive cron
|
13
|
+
tasks that run on many nodes, which could cause a thundering herd or degrade
|
14
|
+
other services if they all fire at once. Adding a SEED can be useful when you
|
15
|
+
have more than one such task and need several unrelated random numbers per
|
16
|
+
node. (For example, `fqdn_rand(30)`, `fqdn_rand(30, 'expensive job 1')`, and
|
17
|
+
`fqdn_rand(30, 'expensive job 2')` will produce totally different numbers.)") do |args|
|
10
18
|
max = args.shift.to_i
|
11
19
|
seed = Digest::MD5.hexdigest([self['::fqdn'],args].join(':')).hex
|
12
20
|
Puppet::Util.deterministic_rand(seed,max)
|
@@ -1,5 +1,22 @@
|
|
1
1
|
# Include the specified classes
|
2
|
-
Puppet::Parser::Functions::newfunction(:include, :arity => -2, :doc => "
|
2
|
+
Puppet::Parser::Functions::newfunction(:include, :arity => -2, :doc => "Declares one or more classes, causing the resources in them to be
|
3
|
+
evaluated and added to the catalog. Accepts a class name, an array of class
|
4
|
+
names, or a comma-separated list of class names.
|
5
|
+
|
6
|
+
The `include` function can be used multiple times on the same class and will
|
7
|
+
only declare a given class once. If a class declared with `include` has any
|
8
|
+
parameters, Puppet will automatically look up values for them in Hiera, using
|
9
|
+
`<class name>::<parameter name>` as the lookup key.
|
10
|
+
|
11
|
+
Contrast this behavior with resource-like class declarations
|
12
|
+
(`class {'name': parameter => 'value',}`), which must be used in only one place
|
13
|
+
per class and can directly set parameters. You should avoid using both `include`
|
14
|
+
and resource-like declarations with the same class.
|
15
|
+
|
16
|
+
The `include` function does not cause classes to be contained in the class
|
17
|
+
where they are declared. For that, see the `contain` function. It also
|
18
|
+
does not create a dependency relationship between the declared class and th
|
19
|
+
surrounding class; for that, see the `require` function.") do |vals|
|
3
20
|
if vals.is_a?(Array)
|
4
21
|
# Protect against array inside array
|
5
22
|
vals = vals.flatten
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require 'puppet/parser/ast/lambda'
|
2
|
+
|
3
|
+
Puppet::Parser::Functions::newfunction(
|
4
|
+
:map,
|
5
|
+
:type => :rvalue,
|
6
|
+
:arity => 2,
|
7
|
+
:doc => <<-'ENDHEREDOC') do |args|
|
8
|
+
Applies a parameterized block to each element in a sequence of entries from the first
|
9
|
+
argument and returns an array with the result of each invocation of the parameterized block.
|
10
|
+
|
11
|
+
This function takes two mandatory arguments: the first should be an Array or a Hash, and the second
|
12
|
+
a parameterized block as produced by the puppet syntax:
|
13
|
+
|
14
|
+
$a.map |$x| { ... }
|
15
|
+
|
16
|
+
When the first argument `$a` is an Array, the block is called with each entry in turn. When the first argument
|
17
|
+
is a hash the entry is an array with `[key, value]`.
|
18
|
+
|
19
|
+
*Examples*
|
20
|
+
|
21
|
+
# Turns hash into array of values
|
22
|
+
$a.map |$x|{ $x[1] }
|
23
|
+
|
24
|
+
# Turns hash into array of keys
|
25
|
+
$a.map |$x| { $x[0] }
|
26
|
+
|
27
|
+
- Since 3.4
|
28
|
+
- requires `parser = future`.
|
29
|
+
ENDHEREDOC
|
30
|
+
|
31
|
+
receiver = args[0]
|
32
|
+
pblock = args[1]
|
33
|
+
|
34
|
+
raise ArgumentError, ("map(): wrong argument type (#{pblock.class}; must be a parameterized block.") unless pblock.is_a? Puppet::Parser::AST::Lambda
|
35
|
+
|
36
|
+
case receiver
|
37
|
+
when Array
|
38
|
+
when Hash
|
39
|
+
else
|
40
|
+
raise ArgumentError, ("map(): wrong argument type (#{receiver.class}; must be an Array or a Hash.")
|
41
|
+
end
|
42
|
+
|
43
|
+
receiver.to_a.map {|x| pblock.call(self, x) }
|
44
|
+
end
|
@@ -1,47 +1,15 @@
|
|
1
|
-
require 'puppet/parser/ast/lambda'
|
2
|
-
|
3
1
|
Puppet::Parser::Functions::newfunction(
|
4
2
|
:select,
|
5
3
|
:type => :rvalue,
|
6
4
|
:arity => 2,
|
7
5
|
:doc => <<-'ENDHEREDOC') do |args|
|
8
|
-
|
9
|
-
argument and returns an array with the entires for which the block evaluates to true.
|
10
|
-
|
11
|
-
This function takes two mandatory arguments: the first should be an Array or a Hash, and the second
|
12
|
-
a parameterized block as produced by the puppet syntax:
|
13
|
-
|
14
|
-
$a.select |$x| { ... }
|
15
|
-
|
16
|
-
When the first argument is an Array, the block is called with each entry in turn. When the first argument
|
17
|
-
is a hash the entry is an array with `[key, value]`.
|
18
|
-
|
19
|
-
The returned filtered object is of the same type as the receiver.
|
6
|
+
The 'select' function has been renamed to 'filter'. Please update your manifests.
|
20
7
|
|
21
|
-
|
22
|
-
|
23
|
-
# selects all that end with berry
|
24
|
-
$a = ["raspberry", "blueberry", "orange"]
|
25
|
-
$a.select |$x| { $x =~ /berry$/ }
|
26
|
-
|
27
|
-
- Since 3.2
|
8
|
+
The select function is reserved for future use.
|
9
|
+
- Removed as of 3.4
|
28
10
|
- requires `parser = future`.
|
29
11
|
ENDHEREDOC
|
30
12
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
raise ArgumentError, ("select(): wrong argument type (#{pblock.class}; must be a parameterized block.") unless pblock.is_a? Puppet::Parser::AST::Lambda
|
35
|
-
|
36
|
-
case receiver
|
37
|
-
when Array
|
38
|
-
receiver.select {|x| pblock.call(self, x) }
|
39
|
-
when Hash
|
40
|
-
result = receiver.select {|x, y| pblock.call(self, [x, y]) }
|
41
|
-
# Ruby 1.8.7 returns Array
|
42
|
-
result = Hash[result] unless result.is_a? Hash
|
43
|
-
result
|
44
|
-
else
|
45
|
-
raise ArgumentError, ("select(): wrong argument type (#{receiver.class}; must be an Array or a Hash.")
|
46
|
-
end
|
47
|
-
end
|
13
|
+
raise NotImplementedError,
|
14
|
+
"The 'select' function has been renamed to 'filter'. Please update your manifests."
|
15
|
+
end
|
data/lib/puppet/parser/lexer.rb
CHANGED
@@ -347,7 +347,7 @@ class Puppet::Parser::Lexer
|
|
347
347
|
def file=(file)
|
348
348
|
@file = file
|
349
349
|
@line = 1
|
350
|
-
contents = File.
|
350
|
+
contents = Puppet::FileSystem::File.exist?(file) ? File.read(file) : ""
|
351
351
|
@scanner = StringScanner.new(contents)
|
352
352
|
end
|
353
353
|
|
@@ -1,12 +1,9 @@
|
|
1
|
-
require 'forwardable'
|
2
1
|
require 'puppet/resource'
|
3
2
|
|
4
3
|
# The primary difference between this class and its
|
5
4
|
# parent is that this class has rules on who can set
|
6
5
|
# parameters
|
7
6
|
class Puppet::Parser::Resource < Puppet::Resource
|
8
|
-
extend Forwardable
|
9
|
-
|
10
7
|
require 'puppet/parser/resource/param'
|
11
8
|
require 'puppet/util/tagging'
|
12
9
|
require 'puppet/parser/yaml_trimmer'
|
@@ -18,7 +15,6 @@ class Puppet::Parser::Resource < Puppet::Resource
|
|
18
15
|
include Puppet::Util::MethodHelper
|
19
16
|
include Puppet::Util::Errors
|
20
17
|
include Puppet::Util::Logging
|
21
|
-
include Puppet::Util::Tagging
|
22
18
|
include Puppet::Parser::YamlTrimmer
|
23
19
|
|
24
20
|
attr_accessor :source, :scope, :collector_id
|
@@ -56,7 +52,9 @@ class Puppet::Parser::Resource < Puppet::Resource
|
|
56
52
|
end
|
57
53
|
end
|
58
54
|
|
59
|
-
|
55
|
+
def environment
|
56
|
+
scope.environment
|
57
|
+
end
|
60
58
|
|
61
59
|
# Process the stage metaparameter for a class. A containment edge
|
62
60
|
# is drawn from the class to the stage. The stage for containment
|
@@ -188,47 +186,10 @@ class Puppet::Parser::Resource < Puppet::Resource
|
|
188
186
|
end
|
189
187
|
end
|
190
188
|
|
191
|
-
|
192
|
-
# Create a Puppet::Resource instance from this parser resource.
|
193
|
-
# We plan, at some point, on not needing to do this conversion, but
|
194
|
-
# it's sufficient for now.
|
195
|
-
def to_resource
|
196
|
-
result = Puppet::Resource.new(type, title)
|
197
|
-
|
198
|
-
to_hash.each do |p, v|
|
199
|
-
if v.is_a?(Puppet::Resource)
|
200
|
-
v = Puppet::Resource.new(v.type, v.title)
|
201
|
-
elsif v.is_a?(Array)
|
202
|
-
# flatten resource references arrays
|
203
|
-
v = v.flatten if v.flatten.find { |av| av.is_a?(Puppet::Resource) }
|
204
|
-
v = v.collect do |av|
|
205
|
-
av = Puppet::Resource.new(av.type, av.title) if av.is_a?(Puppet::Resource)
|
206
|
-
av
|
207
|
-
end
|
208
|
-
end
|
209
|
-
|
210
|
-
# If the value is an array with only one value, then
|
211
|
-
# convert it to a single value. This is largely so that
|
212
|
-
# the database interaction doesn't have to worry about
|
213
|
-
# whether it returns an array or a string.
|
214
|
-
result[p] = if v.is_a?(Array) and v.length == 1
|
215
|
-
v[0]
|
216
|
-
else
|
217
|
-
v
|
218
|
-
end
|
219
|
-
end
|
220
|
-
|
221
|
-
result.file = self.file
|
222
|
-
result.line = self.line
|
223
|
-
result.exported = self.exported
|
224
|
-
result.virtual = self.virtual
|
225
|
-
result.tag(*self.tags)
|
226
|
-
|
227
|
-
result
|
228
|
-
end
|
229
|
-
|
230
189
|
# Convert this resource to a RAL resource.
|
231
|
-
|
190
|
+
def to_ral
|
191
|
+
copy_as_resource.to_ral
|
192
|
+
end
|
232
193
|
|
233
194
|
private
|
234
195
|
|
data/lib/puppet/parser/scope.rb
CHANGED
@@ -116,6 +116,9 @@ class Puppet::Parser::Scope
|
|
116
116
|
compiler.node.name
|
117
117
|
end
|
118
118
|
|
119
|
+
# TODO: 19514 - this is smelly; who uses this? functions? templates?
|
120
|
+
# What about trusted facts ? Should untrusted facts be removed from facts?
|
121
|
+
#
|
119
122
|
def facts
|
120
123
|
compiler.node.facts
|
121
124
|
end
|
@@ -195,8 +198,6 @@ class Puppet::Parser::Scope
|
|
195
198
|
|
196
199
|
extend_with_functions_module
|
197
200
|
|
198
|
-
@tags = []
|
199
|
-
|
200
201
|
# The symbol table for this scope. This is where we store variables.
|
201
202
|
@symtable = Ephemeral.new(nil, true)
|
202
203
|
|
@@ -461,6 +462,8 @@ class Puppet::Parser::Scope
|
|
461
462
|
}
|
462
463
|
end
|
463
464
|
|
465
|
+
RESERVED_VARIABLE_NAMES = ['trusted'].freeze
|
466
|
+
|
464
467
|
# Set a variable in the current scope. This will override settings
|
465
468
|
# in scopes above, but will not allow variables in the current scope
|
466
469
|
# to be reassigned.
|
@@ -474,6 +477,11 @@ class Puppet::Parser::Scope
|
|
474
477
|
raise Puppet::ParseError, "Scope variable name #{name.inspect} is a #{name.class}, not a string"
|
475
478
|
end
|
476
479
|
|
480
|
+
# Check for reserved variable names
|
481
|
+
if Puppet[:trusted_node_data] && !options[:privileged] && RESERVED_VARIABLE_NAMES.include?(name)
|
482
|
+
raise Puppet::ParseError, "Attempt to assign to a reserved variable name: '#{name}'"
|
483
|
+
end
|
484
|
+
|
477
485
|
table = effective_symtable options[:ephemeral]
|
478
486
|
if table.bound?(name)
|
479
487
|
if options[:append]
|
@@ -494,6 +502,29 @@ class Puppet::Parser::Scope
|
|
494
502
|
table[name]
|
495
503
|
end
|
496
504
|
|
505
|
+
def set_trusted(hash)
|
506
|
+
setvar('trusted', deep_freeze(hash), :privileged => true)
|
507
|
+
end
|
508
|
+
|
509
|
+
# Deeply freezes the given object. The object and its content must be of the types:
|
510
|
+
# Array, Hash, Numeric, Boolean, Symbol, Regexp, NilClass, or String. All other types raises an Error.
|
511
|
+
# (i.e. if they are assignable to Puppet::Pops::Types::Data type).
|
512
|
+
#
|
513
|
+
def deep_freeze(object)
|
514
|
+
case object
|
515
|
+
when Hash
|
516
|
+
object.each {|k, v| deep_freeze(k); deep_freeze(v) }
|
517
|
+
when NilClass
|
518
|
+
# do nothing
|
519
|
+
when String
|
520
|
+
object.freeze
|
521
|
+
else
|
522
|
+
raise Puppet::Error, "Unsupported data type: '#{object.class}"
|
523
|
+
end
|
524
|
+
object
|
525
|
+
end
|
526
|
+
private :deep_freeze
|
527
|
+
|
497
528
|
# Return the effective "table" for setting variables.
|
498
529
|
# This method returns the first ephemeral "table" that acts as a local scope, or this
|
499
530
|
# scope's symtable. If the parameter `use_ephemeral` is true, the "top most" ephemeral "table"
|
@@ -7,61 +7,6 @@ class Puppet::Parser::TypeLoader
|
|
7
7
|
extend Forwardable
|
8
8
|
include Puppet::Node::Environment::Helper
|
9
9
|
|
10
|
-
# Helper class that makes sure we don't try to import the same file
|
11
|
-
# more than once from either the same thread or different threads.
|
12
|
-
class Helper
|
13
|
-
include MonitorMixin
|
14
|
-
def initialize
|
15
|
-
super
|
16
|
-
# These hashes are indexed by filename
|
17
|
-
@state = {} # :doing or :done
|
18
|
-
@thread = {} # if :doing, thread that's doing the parsing
|
19
|
-
@cond_var = {} # if :doing, condition var that will be signaled when done.
|
20
|
-
end
|
21
|
-
|
22
|
-
# Execute the supplied block exactly once per file, no matter how
|
23
|
-
# many threads have asked for it to run. If another thread is
|
24
|
-
# already executing it, wait for it to finish. If this thread is
|
25
|
-
# already executing it, return immediately without executing the
|
26
|
-
# block.
|
27
|
-
#
|
28
|
-
# Note: the reason for returning immediately if this thread is
|
29
|
-
# already executing the block is to handle the case of a circular
|
30
|
-
# import--when this happens, we attempt to recursively re-parse a
|
31
|
-
# file that we are already in the process of parsing. To prevent
|
32
|
-
# an infinite regress we need to simply do nothing when the
|
33
|
-
# recursive import is attempted.
|
34
|
-
def do_once(file)
|
35
|
-
need_to_execute = synchronize do
|
36
|
-
case @state[file]
|
37
|
-
when :doing
|
38
|
-
if @thread[file] != Thread.current
|
39
|
-
@cond_var[file].wait
|
40
|
-
end
|
41
|
-
false
|
42
|
-
when :done
|
43
|
-
false
|
44
|
-
else
|
45
|
-
@state[file] = :doing
|
46
|
-
@thread[file] = Thread.current
|
47
|
-
@cond_var[file] = new_cond
|
48
|
-
true
|
49
|
-
end
|
50
|
-
end
|
51
|
-
if need_to_execute
|
52
|
-
begin
|
53
|
-
yield
|
54
|
-
ensure
|
55
|
-
synchronize do
|
56
|
-
@state[file] = :done
|
57
|
-
@thread.delete(file)
|
58
|
-
@cond_var.delete(file).broadcast
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
10
|
# Import manifest files that match a given file glob pattern.
|
66
11
|
#
|
67
12
|
# @param pattern [String] the file glob to apply when determining which files
|
@@ -103,7 +48,6 @@ class Puppet::Parser::TypeLoader
|
|
103
48
|
|
104
49
|
def initialize(env)
|
105
50
|
self.environment = env
|
106
|
-
@loading_helper = Helper.new
|
107
51
|
end
|
108
52
|
|
109
53
|
# Try to load the object with the given fully qualified name.
|
@@ -148,11 +92,11 @@ class Puppet::Parser::TypeLoader
|
|
148
92
|
end
|
149
93
|
|
150
94
|
def load_files(modname, files)
|
95
|
+
@loaded ||= {}
|
151
96
|
loaded_asts = []
|
152
|
-
files.each do |file|
|
153
|
-
|
154
|
-
|
155
|
-
end
|
97
|
+
files.reject { |file| @loaded[file] }.each do |file|
|
98
|
+
loaded_asts << parse_file(file)
|
99
|
+
@loaded[file] = true
|
156
100
|
end
|
157
101
|
|
158
102
|
loaded_asts.collect do |ast|
|