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
data/lib/puppet/type.rb
CHANGED
@@ -692,6 +692,20 @@ class Type
|
|
692
692
|
}
|
693
693
|
end
|
694
694
|
|
695
|
+
# Return the parameters, metaparams, and properties that have a value or were set by a default. Properties are
|
696
|
+
# included since they are a subclass of parameter.
|
697
|
+
# @return [Array<Puppet::Parameter>] Array of parameter objects ( or subclass thereof )
|
698
|
+
def parameters_with_value
|
699
|
+
self.class.allattrs.collect { |attr| parameter(attr) }.compact
|
700
|
+
end
|
701
|
+
|
702
|
+
# Iterates over all parameters with value currently set.
|
703
|
+
# @yieldparam parameter [Puppet::Parameter] or a subclass thereof
|
704
|
+
# @return [void]
|
705
|
+
def eachparameter
|
706
|
+
parameters_with_value.each { |parameter| yield parameter }
|
707
|
+
end
|
708
|
+
|
695
709
|
# Creates a transaction event.
|
696
710
|
# Called by Transaction or by a property.
|
697
711
|
# Merges the given options with the options `:resource`, `:file`, `:line`, and `:tags`, initialized from
|
@@ -2278,6 +2292,13 @@ class Type
|
|
2278
2292
|
# @return [Array<Puppet::Parameter>] the validated list/set of attributes
|
2279
2293
|
#
|
2280
2294
|
def finish
|
2295
|
+
# Call post_compile hook on every parameter that implements it. This includes all subclasses
|
2296
|
+
# of parameter including, but not limited to, regular parameters, metaparameters, relationship
|
2297
|
+
# parameters, and properties.
|
2298
|
+
eachparameter do |parameter|
|
2299
|
+
parameter.post_compile if parameter.respond_to? :post_compile
|
2300
|
+
end
|
2301
|
+
|
2281
2302
|
# Make sure all of our relationships are valid. Again, must be done
|
2282
2303
|
# when the entire catalog is instantiated.
|
2283
2304
|
self.class.relationship_params.collect do |klass|
|
@@ -2297,25 +2318,21 @@ class Type
|
|
2297
2318
|
self[:name]
|
2298
2319
|
end
|
2299
2320
|
|
2300
|
-
# Returns the parent of this in the catalog.
|
2301
|
-
#
|
2302
|
-
# parent is returned.
|
2303
|
-
# @return [
|
2304
|
-
# is no catalog
|
2305
|
-
#
|
2321
|
+
# Returns the parent of this in the catalog. In case of an erroneous catalog
|
2322
|
+
# where multiple parents have been produced, the first found (non
|
2323
|
+
# deterministic) parent is returned.
|
2324
|
+
# @return [Puppet::Type, nil] the
|
2325
|
+
# containing resource or nil if there is no catalog or no containing
|
2326
|
+
# resource.
|
2306
2327
|
def parent
|
2307
2328
|
return nil unless catalog
|
2308
2329
|
|
2309
|
-
|
2330
|
+
@parent ||=
|
2310
2331
|
if parents = catalog.adjacent(self, :direction => :in)
|
2311
|
-
|
2312
|
-
# it if we happen to.
|
2313
|
-
@parent = parents.shift
|
2332
|
+
parents.shift
|
2314
2333
|
else
|
2315
|
-
|
2334
|
+
nil
|
2316
2335
|
end
|
2317
|
-
end
|
2318
|
-
@parent
|
2319
2336
|
end
|
2320
2337
|
|
2321
2338
|
# Returns a reference to this as a string in "Type[name]" format.
|
data/lib/puppet/type/augeas.rb
CHANGED
@@ -96,52 +96,18 @@ Puppet::Type.newtype(:augeas) do
|
|
96
96
|
desc "The changes which should be applied to the filesystem. This
|
97
97
|
can be a command or an array of commands. The following commands are supported:
|
98
98
|
|
99
|
-
`set <PATH> <VALUE>`
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
`
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
`
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
`remove <PATH>`
|
112
|
-
: Synonym for `rm`
|
113
|
-
|
114
|
-
|
115
|
-
`clear <PATH>`
|
116
|
-
: Sets the node at `PATH` to `NULL`, creating it if needed
|
117
|
-
|
118
|
-
|
119
|
-
`clearm <PATH> <SUB>`
|
120
|
-
: Sets multiple nodes (matching `SUB` relative to `PATH`) to `NULL`
|
121
|
-
|
122
|
-
|
123
|
-
`ins <LABEL> (before|after) <PATH>`
|
124
|
-
: Inserts an empty node `LABEL` either before or after `PATH`.
|
125
|
-
|
126
|
-
|
127
|
-
`insert <LABEL> <WHERE> <PATH>`
|
128
|
-
: Synonym for `ins`
|
129
|
-
|
130
|
-
|
131
|
-
`mv <PATH> <OTHER PATH>`
|
132
|
-
: Moves a node at `PATH` to the new location `OTHER PATH`
|
133
|
-
|
134
|
-
|
135
|
-
`move <PATH> <OTHER PATH>`
|
136
|
-
: Synonym for `mv`
|
137
|
-
|
138
|
-
|
139
|
-
`defvar <NAME> <PATH>`
|
140
|
-
: Sets Augeas variable `$NAME` to `PATH`
|
141
|
-
|
142
|
-
|
143
|
-
`defnode <NAME> <PATH> <VALUE>`
|
144
|
-
: Sets Augeas variable `$NAME` to `PATH`, creating it with `VALUE` if needed
|
99
|
+
* `set <PATH> <VALUE>` --- Sets the value `VALUE` at loction `PATH`
|
100
|
+
* `setm <PATH> <SUB> <VALUE>` --- Sets multiple nodes (matching `SUB` relative to `PATH`) to `VALUE`
|
101
|
+
* `rm <PATH>` --- Removes the node at location `PATH`
|
102
|
+
* `remove <PATH>` --- Synonym for `rm`
|
103
|
+
* `clear <PATH>` --- Sets the node at `PATH` to `NULL`, creating it if needed
|
104
|
+
* `clearm <PATH> <SUB>` --- Sets multiple nodes (matching `SUB` relative to `PATH`) to `NULL`
|
105
|
+
* `ins <LABEL> (before|after) <PATH>` --- Inserts an empty node `LABEL` either before or after `PATH`.
|
106
|
+
* `insert <LABEL> <WHERE> <PATH>` --- Synonym for `ins`
|
107
|
+
* `mv <PATH> <OTHER PATH>` --- Moves a node at `PATH` to the new location `OTHER PATH`
|
108
|
+
* `move <PATH> <OTHER PATH>` --- Synonym for `mv`
|
109
|
+
* `defvar <NAME> <PATH>` --- Sets Augeas variable `$NAME` to `PATH`
|
110
|
+
* `defnode <NAME> <PATH> <VALUE>` --- Sets Augeas variable `$NAME` to `PATH`, creating it with `VALUE` if needed
|
145
111
|
|
146
112
|
If the `context` parameter is set, that value is prepended to any relative `PATH`s."
|
147
113
|
end
|
@@ -34,13 +34,7 @@ Puppet::Type.newtype(:component) do
|
|
34
34
|
# Component paths are special because they function as containers.
|
35
35
|
def pathbuilder
|
36
36
|
if reference.type == "Class"
|
37
|
-
|
38
|
-
# its name.
|
39
|
-
if reference.title.to_s.downcase == "main"
|
40
|
-
myname = ""
|
41
|
-
else
|
42
|
-
myname = reference.title
|
43
|
-
end
|
37
|
+
myname = reference.title
|
44
38
|
else
|
45
39
|
myname = reference.to_s
|
46
40
|
end
|
data/lib/puppet/type/cron.rb
CHANGED
File without changes
|
data/lib/puppet/type/exec.rb
CHANGED
@@ -220,6 +220,18 @@ module Puppet
|
|
220
220
|
end
|
221
221
|
end
|
222
222
|
|
223
|
+
newparam(:umask, :required_feature => :umask) do
|
224
|
+
desc "Sets the umask to be used while executing this command"
|
225
|
+
|
226
|
+
munge do |value|
|
227
|
+
if value =~ /^0?[0-7]{1,4}$/
|
228
|
+
return value.to_i(8)
|
229
|
+
else
|
230
|
+
raise Puppet::Error, "The umask specification is invalid: #{value.inspect}"
|
231
|
+
end
|
232
|
+
end
|
233
|
+
end
|
234
|
+
|
223
235
|
newparam(:timeout) do
|
224
236
|
desc "The maximum time the command should take. If the command takes
|
225
237
|
longer than the timeout, the command is considered to have failed
|
@@ -341,7 +353,7 @@ module Puppet
|
|
341
353
|
# If the file exists, return false (i.e., don't run the command),
|
342
354
|
# else return true
|
343
355
|
def check(value)
|
344
|
-
!
|
356
|
+
! Puppet::FileSystem::File.exist?(value)
|
345
357
|
end
|
346
358
|
end
|
347
359
|
|
data/lib/puppet/type/file.rb
CHANGED
@@ -34,6 +34,9 @@ Puppet::Type.newtype(:file) do
|
|
34
34
|
file, the file resource will autorequire them. If Puppet is managing any
|
35
35
|
parent directories of a file, the file resource will autorequire them."
|
36
36
|
|
37
|
+
feature :manages_symlinks,
|
38
|
+
"The provider can manage symbolic links."
|
39
|
+
|
37
40
|
def self.title_patterns
|
38
41
|
[ [ /^(.*?)\/*\Z/m, [ [ :path ] ] ] ]
|
39
42
|
end
|
@@ -54,7 +57,12 @@ Puppet::Type.newtype(:file) do
|
|
54
57
|
end
|
55
58
|
|
56
59
|
munge do |value|
|
57
|
-
|
60
|
+
if value.start_with?('//') and ::File.basename(value) == "/"
|
61
|
+
# This is a UNC path pointing to a share, so don't add a trailing slash
|
62
|
+
::File.expand_path(value)
|
63
|
+
else
|
64
|
+
::File.join(::File.split(::File.expand_path(value)))
|
65
|
+
end
|
58
66
|
end
|
59
67
|
end
|
60
68
|
|
@@ -118,15 +126,16 @@ Puppet::Type.newtype(:file) do
|
|
118
126
|
end
|
119
127
|
|
120
128
|
newparam(:recurse) do
|
121
|
-
desc "Whether and how
|
122
|
-
management. Options are:
|
129
|
+
desc "Whether and how to do recursive file management. Options are:
|
123
130
|
|
124
131
|
* `inf,true` --- Regular style recursion on both remote and local
|
125
|
-
directory structure.
|
126
|
-
|
127
|
-
|
132
|
+
directory structure. See `recurselimit` to specify a limit to the
|
133
|
+
recursion depth.
|
134
|
+
* `remote` --- Descends recursively into the remote (source) directory
|
135
|
+
but not the local (destination) directory. Allows copying of
|
128
136
|
a few files into a directory containing many
|
129
137
|
unmanaged files without scanning all the local files.
|
138
|
+
This can only be used when a source parameter is specified.
|
130
139
|
* `false` --- Default of no recursion.
|
131
140
|
"
|
132
141
|
|
@@ -682,7 +691,7 @@ Puppet::Type.newtype(:file) do
|
|
682
691
|
end
|
683
692
|
|
684
693
|
@stat = begin
|
685
|
-
::File.
|
694
|
+
Puppet::FileSystem::File.new(self[:path]).send(method)
|
686
695
|
rescue Errno::ENOENT => error
|
687
696
|
nil
|
688
697
|
rescue Errno::ENOTDIR => error
|
@@ -707,7 +716,7 @@ Puppet::Type.newtype(:file) do
|
|
707
716
|
use_temporary_file = write_temporary_file?
|
708
717
|
if use_temporary_file
|
709
718
|
path = "#{self[:path]}.puppettmp_#{rand(10000)}"
|
710
|
-
path = "#{self[:path]}.puppettmp_#{rand(10000)}" while ::File.
|
719
|
+
path = "#{self[:path]}.puppettmp_#{rand(10000)}" while Puppet::FileSystem::File.exist?(path) or Puppet::FileSystem::File.new(path).symlink?
|
711
720
|
else
|
712
721
|
path = self[:path]
|
713
722
|
end
|
@@ -727,7 +736,7 @@ Puppet::Type.newtype(:file) do
|
|
727
736
|
fail "Could not rename temporary file #{path} to #{self[:path]}: #{detail}"
|
728
737
|
ensure
|
729
738
|
# Make sure the created file gets removed
|
730
|
-
::File.unlink(path) if
|
739
|
+
Puppet::FileSystem::File.unlink(path) if Puppet::FileSystem::File.exist?(path)
|
731
740
|
end
|
732
741
|
end
|
733
742
|
|
@@ -777,7 +786,7 @@ Puppet::Type.newtype(:file) do
|
|
777
786
|
# @api private
|
778
787
|
def remove_file(current_type, wanted_type)
|
779
788
|
debug "Removing existing #{current_type} for replacement with #{wanted_type}"
|
780
|
-
::File.unlink(self[:path])
|
789
|
+
Puppet::FileSystem::File.unlink(self[:path])
|
781
790
|
stat_needed
|
782
791
|
true
|
783
792
|
end
|
File without changes
|
@@ -133,6 +133,9 @@ module Puppet
|
|
133
133
|
|
134
134
|
# Make sure we're also managing the checksum property.
|
135
135
|
def should=(value)
|
136
|
+
# treat the value as a bytestring, in Ruby versions that support it, regardless of the encoding
|
137
|
+
# in which it has been supplied
|
138
|
+
value = value.clone.force_encoding(Encoding::ASCII_8BIT) if value.respond_to?(:force_encoding)
|
136
139
|
@resource.newattr(:checksum) unless @resource.parameter(:checksum)
|
137
140
|
super
|
138
141
|
end
|
@@ -5,17 +5,35 @@ module Puppet
|
|
5
5
|
require 'puppet/util/symbolic_file_mode'
|
6
6
|
include Puppet::Util::SymbolicFileMode
|
7
7
|
|
8
|
-
desc <<-
|
9
|
-
Whether
|
10
|
-
Possible values are `
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
8
|
+
desc <<-EOT
|
9
|
+
Whether the file should exist, and if so what kind of file it should be.
|
10
|
+
Possible values are `present`, `absent`, `file`, `directory`, and `link`.
|
11
|
+
|
12
|
+
* `present` will accept any form of file existence, and will create a
|
13
|
+
normal file if the file is missing. (The file will have no content
|
14
|
+
unless the `content` or `source` attribute is used.)
|
15
|
+
* `absent` will make sure the file doesn't exist, deleting it
|
16
|
+
if necessary.
|
17
|
+
* `file` will make sure it's a normal file, and enables use of the
|
18
|
+
`content` or `source` attribute.
|
19
|
+
* `directory` will make sure it's a directory, and enables use of the
|
20
|
+
`source`, `recurse`, `recurselimit`, `ignore`, and `purge` attributes.
|
21
|
+
* `link` will make sure the file is a symlink, and **requires** that you
|
22
|
+
also set the `target` attribute. Symlinks are supported on all Posix
|
23
|
+
systems and on Windows Vista / 2008 and higher. On Windows, managing
|
24
|
+
symlinks requires puppet agent's user account to have the "Create
|
25
|
+
Symbolic Links" privilege; this can be configured in the "User Rights
|
26
|
+
Assignment" section in the Windows policy editor. By default, puppet
|
27
|
+
agent runs as the Administrator account, which does have this privilege.
|
28
|
+
|
29
|
+
Puppet avoids destroying directories unless the `force` attribute is set
|
30
|
+
to `true`. This means that if a file is currently a directory, setting
|
31
|
+
`ensure` to anything but `directory` or `present` will cause Puppet to
|
32
|
+
skip managing the resource and log either a notice or an error.
|
33
|
+
|
34
|
+
There is one other non-standard value for `ensure`. If you specify the
|
35
|
+
path to another file as the ensure value, it is equivalent to specifying
|
36
|
+
`link` and using that path as the `target`:
|
19
37
|
|
20
38
|
# Equivalent resources:
|
21
39
|
|
@@ -36,7 +54,7 @@ module Puppet
|
|
36
54
|
nodefault
|
37
55
|
|
38
56
|
newvalue(:absent) do
|
39
|
-
File.unlink(@resource[:path])
|
57
|
+
Puppet::FileSystem::File.unlink(@resource[:path])
|
40
58
|
end
|
41
59
|
|
42
60
|
aliasvalue(:false, :absent)
|
@@ -61,7 +79,7 @@ module Puppet
|
|
61
79
|
newvalue(:directory, :event => :directory_created) do
|
62
80
|
mode = @resource.should(:mode)
|
63
81
|
parent = File.dirname(@resource[:path])
|
64
|
-
unless
|
82
|
+
unless Puppet::FileSystem::File.exist? parent
|
65
83
|
raise Puppet::Error,
|
66
84
|
"Cannot create #{@resource[:path]}; parent directory #{parent} does not exist"
|
67
85
|
end
|
@@ -77,7 +95,7 @@ module Puppet
|
|
77
95
|
end
|
78
96
|
|
79
97
|
|
80
|
-
newvalue(:link, :event => :link_created) do
|
98
|
+
newvalue(:link, :event => :link_created, :required_features => :manages_symlinks) do
|
81
99
|
fail "Cannot create a symlink without a target" unless property = resource.property(:target)
|
82
100
|
property.retrieve
|
83
101
|
property.mklink
|
@@ -121,7 +139,7 @@ module Puppet
|
|
121
139
|
def check
|
122
140
|
basedir = File.dirname(@resource[:path])
|
123
141
|
|
124
|
-
if !
|
142
|
+
if ! Puppet::FileSystem::File.exist?(basedir)
|
125
143
|
raise Puppet::Error,
|
126
144
|
"Can not create #{@resource.title}; parent directory does not exist"
|
127
145
|
elsif ! FileTest.directory?(basedir)
|
File without changes
|
@@ -39,8 +39,12 @@ module Puppet
|
|
39
39
|
* g (group's current permissions)
|
40
40
|
* o (other's current permissions)
|
41
41
|
|
42
|
-
Thus, mode `0664` could be represented symbolically as either `a=r,ug+w`
|
43
|
-
`ug=rw,o=r`.
|
42
|
+
Thus, mode `0664` could be represented symbolically as either `a=r,ug+w`
|
43
|
+
or `ug=rw,o=r`. However, symbolic modes are more expressive than numeric
|
44
|
+
modes: a mode only affects the specified bits, so `mode => 'ug+w'` will
|
45
|
+
set the user and group write bits, without affecting any other bits.
|
46
|
+
|
47
|
+
See the manual page for GNU or BSD `chmod` for more details
|
44
48
|
on numeric and symbolic modes.
|
45
49
|
|
46
50
|
On Windows, permissions are translated as follows:
|
File without changes
|
@@ -1,4 +1,3 @@
|
|
1
|
-
|
2
1
|
require 'puppet/file_serving/content'
|
3
2
|
require 'puppet/file_serving/metadata'
|
4
3
|
|
@@ -85,7 +84,7 @@ module Puppet
|
|
85
84
|
|
86
85
|
def change_to_s(currentvalue, newvalue)
|
87
86
|
# newvalue = "{md5}#{@metadata.checksum}"
|
88
|
-
if
|
87
|
+
if resource.property(:ensure).retrieve == :absent
|
89
88
|
return "creating from source #{metadata.source} with contents #{metadata.checksum}"
|
90
89
|
else
|
91
90
|
return "replacing from source #{metadata.source} with contents #{metadata.checksum}"
|
@@ -111,28 +110,48 @@ module Puppet
|
|
111
110
|
def copy_source_values
|
112
111
|
devfail "Somehow got asked to copy source values without any metadata" unless metadata
|
113
112
|
|
113
|
+
# conditionally copy :checksum
|
114
|
+
if metadata.ftype != "directory" && !(metadata.ftype == "link" && metadata.links == :manage)
|
115
|
+
copy_source_value(:checksum)
|
116
|
+
end
|
117
|
+
|
114
118
|
# Take each of the stats and set them as states on the local file
|
115
119
|
# if a value has not already been provided.
|
116
|
-
[:owner, :mode, :group
|
117
|
-
param_name = (metadata_method == :checksum) ? :content : metadata_method
|
120
|
+
[:owner, :mode, :group].each do |metadata_method|
|
118
121
|
next if metadata_method == :owner and !Puppet.features.root?
|
119
|
-
next if metadata_method == :
|
120
|
-
next if metadata_method == :checksum and metadata.ftype == "link" and metadata.links == :manage
|
122
|
+
next if metadata_method == :group and !Puppet.features.root?
|
121
123
|
|
122
124
|
if Puppet.features.microsoft_windows?
|
123
|
-
|
125
|
+
# Warn on Windows if source permissions are being used and the file resource
|
126
|
+
# does not have mode owner and group all set (which would take precedence).
|
127
|
+
if [:use, :use_when_creating].include?(resource[:source_permissions]) &&
|
128
|
+
(resource[:owner] == nil || resource[:group] == nil || resource[:mode] == nil)
|
129
|
+
|
130
|
+
warning = "Copying %s from the source" <<
|
131
|
+
" file on Windows is deprecated;" <<
|
132
|
+
" use source_permissions => ignore."
|
133
|
+
Puppet.deprecation_warning(warning % 'owner/mode/group')
|
134
|
+
resource.debug(warning % metadata_method.to_s)
|
135
|
+
end
|
136
|
+
# But never try to copy remote owner/group on Windows
|
137
|
+
next if [:owner, :group].include?(metadata_method) && !local?
|
124
138
|
end
|
125
139
|
|
126
|
-
|
127
|
-
|
140
|
+
case resource[:source_permissions]
|
141
|
+
when :ignore
|
142
|
+
next
|
143
|
+
when :use_when_creating
|
144
|
+
next if Puppet::FileSystem::File.exist?(resource[:path])
|
128
145
|
end
|
146
|
+
|
147
|
+
copy_source_value(metadata_method)
|
129
148
|
end
|
130
149
|
|
131
150
|
if resource[:ensure] == :absent
|
132
151
|
# We know all we need to
|
133
152
|
elsif metadata.ftype != "link"
|
134
153
|
resource[:ensure] = metadata.ftype
|
135
|
-
elsif
|
154
|
+
elsif resource[:links] == :follow
|
136
155
|
resource[:ensure] = :present
|
137
156
|
else
|
138
157
|
resource[:ensure] = "link"
|
@@ -140,10 +159,6 @@ module Puppet
|
|
140
159
|
end
|
141
160
|
end
|
142
161
|
|
143
|
-
def found?
|
144
|
-
! (metadata.nil? or metadata.ftype.nil?)
|
145
|
-
end
|
146
|
-
|
147
162
|
attr_writer :metadata
|
148
163
|
|
149
164
|
# Provide, and retrieve if necessary, the metadata for this file. Fail
|
@@ -195,5 +210,41 @@ module Puppet
|
|
195
210
|
def uri
|
196
211
|
@uri ||= URI.parse(URI.escape(metadata.source))
|
197
212
|
end
|
213
|
+
|
214
|
+
private
|
215
|
+
def found?
|
216
|
+
! (metadata.nil? or metadata.ftype.nil?)
|
217
|
+
end
|
218
|
+
|
219
|
+
def copy_source_value(metadata_method)
|
220
|
+
param_name = (metadata_method == :checksum) ? :content : metadata_method
|
221
|
+
if resource[param_name].nil? or resource[param_name] == :absent
|
222
|
+
resource[param_name] = metadata.send(metadata_method)
|
223
|
+
end
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
Puppet::Type.type(:file).newparam(:source_permissions) do
|
228
|
+
desc <<-'EOT'
|
229
|
+
Whether (and how) Puppet should copy owner, group, and mode permissions from
|
230
|
+
the `source` to `file` resources when the permissions are not explicitly
|
231
|
+
specified. (In all cases, explicit permissions will take precedence.)
|
232
|
+
Valid values are `use`, `use_when_creating`, and `ignore`:
|
233
|
+
|
234
|
+
* `use` (the default) will cause Puppet to apply the owner, group,
|
235
|
+
and mode from the `source` to any files it is managing.
|
236
|
+
* `use_when_creating` will only apply the owner, group, and mode from the
|
237
|
+
`source` when creating a file; existing files will not have their permissions
|
238
|
+
overwritten.
|
239
|
+
* `ignore` will never apply the owner, group, or mode from the `source` when
|
240
|
+
managing a file. When creating new files without explicit permissions,
|
241
|
+
the permissions they receive will depend on platform-specific behavior.
|
242
|
+
On POSIX, Puppet will use the umask of the user it is running as. On
|
243
|
+
Windows, Puppet will use the default DACL associated with the user it is
|
244
|
+
running as.
|
245
|
+
EOT
|
246
|
+
|
247
|
+
defaultto :use
|
248
|
+
newvalues(:use, :use_when_creating, :ignore)
|
198
249
|
end
|
199
250
|
end
|