puppet 2.7.26 → 3.0.0.rc4
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/CHANGELOG +533 -204
- data/Gemfile +8 -24
- data/Gemfile.lock +44 -0
- data/LICENSE +1 -1
- data/README.md +2 -2
- data/README_DEVELOPER.md +18 -210
- data/Rakefile +30 -47
- data/bin/puppet +5 -3
- data/conf/auth.conf +3 -3
- data/{ext → conf}/osx/PackageInfo.plist +0 -0
- data/{ext → conf}/osx/createpackage.sh +0 -0
- data/conf/osx/preflight +24 -0
- data/conf/redhat/client.init +8 -8
- data/{ext/redhat/puppet.spec.erb → conf/redhat/puppet.spec} +29 -46
- data/conf/redhat/queue.init +105 -0
- data/conf/redhat/rundir-perms.patch +13 -13
- data/conf/redhat/server.init +4 -4
- data/conf/solaris/pkginfo +1 -1
- data/conf/suse/puppet.spec +8 -3
- data/conf/windows/eventlog/puppetres.dll +0 -0
- data/ext/emacs/puppet-mode.el +204 -150
- data/ext/nagios/naggen +1 -1
- data/ext/puppet-test +1 -1
- data/ext/puppetlisten/puppetlisten.rb +1 -2
- data/ext/puppetlisten/puppetrun.rb +1 -2
- data/ext/rack/files/config.ru +21 -3
- data/ext/regexp_nodes/environment/development +2 -0
- data/ext/regexp_nodes/parameters/{environment → service}/prod +0 -0
- data/ext/regexp_nodes/parameters/{environment → service}/qa +0 -0
- data/ext/regexp_nodes/parameters/service/sandbox +1 -0
- data/ext/regexp_nodes/regexp_nodes.rb +115 -59
- data/ext/upload_facts.rb +0 -1
- data/install.rb +10 -10
- data/lib/puppet.rb +49 -24
- data/lib/puppet/agent.rb +40 -16
- data/lib/puppet/agent/disabler.rb +53 -0
- data/lib/puppet/agent/locker.rb +18 -24
- data/lib/puppet/application.rb +93 -72
- data/lib/puppet/application/agent.rb +29 -47
- data/lib/puppet/application/apply.rb +40 -39
- data/lib/puppet/application/cert.rb +9 -11
- data/lib/puppet/application/certificate.rb +7 -2
- data/lib/puppet/application/certificate_request.rb +3 -0
- data/lib/puppet/application/certificate_revocation_list.rb +3 -0
- data/lib/puppet/application/describe.rb +1 -3
- data/lib/puppet/application/device.rb +15 -16
- data/lib/puppet/application/doc.rb +12 -11
- data/lib/puppet/application/face_base.rb +9 -13
- data/lib/puppet/application/filebucket.rb +2 -8
- data/lib/puppet/application/inspect.rb +3 -6
- data/lib/puppet/application/instrumentation_data.rb +3 -0
- data/lib/puppet/application/instrumentation_listener.rb +3 -0
- data/lib/puppet/application/instrumentation_probe.rb +3 -0
- data/lib/puppet/application/kick.rb +2 -8
- data/lib/puppet/application/master.rb +9 -15
- data/lib/puppet/application/module.rb +0 -7
- data/lib/puppet/application/queue.rb +7 -6
- data/lib/puppet/application/resource.rb +1 -5
- data/lib/puppet/application/resource_type.rb +3 -0
- data/lib/puppet/application/secret_agent.rb +3 -0
- data/lib/puppet/configurer.rb +87 -88
- data/lib/puppet/configurer/downloader.rb +8 -23
- data/lib/puppet/configurer/fact_handler.rb +5 -17
- data/lib/puppet/configurer/plugin_handler.rb +4 -23
- data/lib/puppet/daemon.rb +24 -6
- data/lib/puppet/data_binding.rb +11 -0
- data/lib/puppet/defaults.rb +1058 -518
- data/lib/puppet/error.rb +31 -25
- data/lib/puppet/external/dot.rb +1 -1
- data/lib/puppet/external/nagios/base.rb +8 -4
- data/lib/puppet/face/ca.rb +1 -1
- data/lib/puppet/face/catalog.rb +1 -2
- data/lib/puppet/face/certificate.rb +12 -0
- data/lib/puppet/face/config.rb +3 -0
- data/lib/puppet/face/help.rb +92 -28
- data/lib/puppet/face/help/action.erb +36 -3
- data/lib/puppet/face/help/face.erb +35 -3
- data/lib/puppet/face/help/global.erb +8 -12
- data/lib/puppet/face/help/man.erb +20 -2
- data/lib/puppet/face/instrumentation_data.rb +1 -0
- data/lib/puppet/face/instrumentation_listener.rb +1 -0
- data/lib/puppet/face/instrumentation_probe.rb +1 -0
- data/lib/puppet/face/module.rb +2 -0
- data/lib/puppet/face/module/build.rb +32 -6
- data/lib/puppet/face/module/changes.rb +1 -0
- data/lib/puppet/face/module/generate.rb +1 -0
- data/lib/puppet/face/module/install.rb +10 -41
- data/lib/puppet/face/module/list.rb +2 -19
- data/lib/puppet/face/module/search.rb +12 -6
- data/lib/puppet/face/module/uninstall.rb +3 -18
- data/lib/puppet/face/module/upgrade.rb +2 -9
- data/lib/puppet/face/node/clean.rb +25 -27
- data/lib/puppet/face/report.rb +2 -4
- data/lib/puppet/face/resource.rb +1 -1
- data/lib/puppet/feature/base.rb +9 -3
- data/lib/puppet/feature/rails.rb +18 -0
- data/lib/puppet/feature/rdoc1.rb +16 -0
- data/lib/puppet/file_bucket/dipper.rb +3 -2
- data/lib/puppet/file_serving/base.rb +4 -8
- data/lib/puppet/file_serving/configuration.rb +1 -12
- data/lib/puppet/file_serving/configuration/parser.rb +1 -1
- data/lib/puppet/file_serving/metadata.rb +0 -14
- data/lib/puppet/file_serving/mount/plugins.rb +10 -1
- data/lib/puppet/file_serving/terminus_selector.rb +15 -13
- data/lib/puppet/forge.rb +29 -13
- data/lib/puppet/forge/cache.rb +1 -1
- data/lib/puppet/forge/errors.rb +69 -0
- data/lib/puppet/forge/repository.rb +84 -21
- data/lib/puppet/indirector/catalog/active_record.rb +2 -12
- data/lib/puppet/indirector/catalog/compiler.rb +8 -18
- data/lib/puppet/indirector/catalog/json.rb +6 -0
- data/lib/puppet/indirector/catalog/static_compiler.rb +3 -2
- data/lib/puppet/indirector/certificate/rest.rb +1 -0
- data/lib/puppet/indirector/certificate_status/file.rb +0 -5
- data/lib/puppet/indirector/data_binding/hiera.rb +6 -0
- data/lib/puppet/indirector/data_binding/none.rb +5 -0
- data/lib/puppet/indirector/exec.rb +8 -18
- data/lib/puppet/indirector/face.rb +5 -4
- data/lib/puppet/indirector/facts/facter.rb +6 -33
- data/lib/puppet/indirector/facts/network_device.rb +0 -1
- data/lib/puppet/indirector/file_bucket_file/file.rb +0 -4
- data/lib/puppet/indirector/file_bucket_file/selector.rb +0 -4
- data/lib/puppet/indirector/file_content/rest.rb +2 -0
- data/lib/puppet/indirector/hiera.rb +69 -0
- data/lib/puppet/indirector/indirection.rb +20 -26
- data/lib/puppet/indirector/json.rb +76 -0
- data/lib/puppet/indirector/ldap.rb +3 -2
- data/lib/puppet/indirector/node/active_record.rb +1 -0
- data/lib/puppet/indirector/node/exec.rb +9 -0
- data/lib/puppet/indirector/node/ldap.rb +6 -3
- data/lib/puppet/indirector/node/plain.rb +1 -0
- data/lib/puppet/indirector/none.rb +9 -0
- data/lib/puppet/indirector/queue.rb +1 -2
- data/lib/puppet/indirector/report/processor.rb +2 -3
- data/lib/puppet/indirector/report/rest.rb +1 -7
- data/lib/puppet/indirector/request.rb +80 -18
- data/lib/puppet/indirector/resource/active_record.rb +0 -3
- data/lib/puppet/indirector/resource/ral.rb +0 -4
- data/lib/puppet/indirector/resource/rest.rb +0 -9
- data/lib/puppet/indirector/resource/store_configs.rb +0 -3
- data/lib/puppet/indirector/resource_type/parser.rb +30 -1
- data/lib/puppet/indirector/rest.rb +103 -126
- data/lib/puppet/indirector/run/local.rb +0 -4
- data/lib/puppet/indirector/run/rest.rb +0 -6
- data/lib/puppet/indirector/terminus.rb +0 -20
- data/lib/puppet/indirector/yaml.rb +11 -5
- data/lib/puppet/interface.rb +6 -14
- data/lib/puppet/interface/action.rb +21 -3
- data/lib/puppet/interface/action_builder.rb +5 -0
- data/lib/puppet/interface/action_manager.rb +1 -1
- data/lib/puppet/interface/documentation.rb +12 -0
- data/lib/puppet/interface/face_collection.rb +1 -1
- data/lib/puppet/interface/option.rb +19 -3
- data/lib/puppet/interface/option_manager.rb +27 -9
- data/lib/puppet/metatype/manager.rb +1 -0
- data/lib/puppet/module.rb +40 -83
- data/lib/puppet/module_tool.rb +42 -5
- data/lib/puppet/module_tool/applications/builder.rb +1 -1
- data/lib/puppet/module_tool/applications/installer.rb +11 -11
- data/lib/puppet/module_tool/applications/searcher.rb +15 -2
- data/lib/puppet/module_tool/applications/unpacker.rb +4 -8
- data/lib/puppet/module_tool/applications/upgrader.rb +6 -5
- data/lib/puppet/module_tool/errors/base.rb +1 -1
- data/lib/puppet/module_tool/errors/installer.rb +24 -4
- data/lib/puppet/module_tool/install_directory.rb +41 -0
- data/lib/puppet/module_tool/metadata.rb +4 -4
- data/lib/puppet/module_tool/shared_behaviors.rb +6 -6
- data/lib/puppet/network/auth_config_parser.rb +81 -0
- data/lib/puppet/network/authconfig.rb +49 -147
- data/lib/puppet/network/authorization.rb +20 -62
- data/lib/puppet/network/authstore.rb +43 -27
- data/lib/puppet/network/formats.rb +10 -20
- data/lib/puppet/network/http/api/v1.rb +1 -1
- data/lib/puppet/network/http/connection.rb +184 -0
- data/lib/puppet/network/http/handler.rb +4 -14
- data/lib/puppet/network/http/mongrel.rb +5 -25
- data/lib/puppet/network/http/rack.rb +2 -34
- data/lib/puppet/network/http/rack/httphandler.rb +0 -3
- data/lib/puppet/network/http/rack/rest.rb +2 -7
- data/lib/puppet/network/http/webrick.rb +9 -32
- data/lib/puppet/network/http_pool.rb +10 -48
- data/lib/puppet/network/resolver.rb +85 -0
- data/lib/puppet/network/rights.rb +33 -89
- data/lib/puppet/network/server.rb +14 -43
- data/lib/puppet/node.rb +13 -11
- data/lib/puppet/node/environment.rb +29 -12
- data/lib/puppet/node/facts.rb +13 -38
- data/lib/puppet/parameter.rb +0 -21
- data/lib/puppet/parameter/package_options.rb +26 -0
- data/lib/puppet/parser/ast.rb +2 -13
- data/lib/puppet/parser/ast/function.rb +0 -2
- data/lib/puppet/parser/ast/leaf.rb +12 -22
- data/lib/puppet/parser/ast/resource.rb +3 -10
- data/lib/puppet/parser/ast/resource_defaults.rb +1 -1
- data/lib/puppet/parser/ast/resource_override.rb +1 -4
- data/lib/puppet/parser/ast/resourceparam.rb +4 -7
- data/lib/puppet/parser/ast/selector.rb +7 -1
- data/lib/puppet/parser/ast/vardef.rb +0 -2
- data/lib/puppet/parser/collector.rb +2 -1
- data/lib/puppet/parser/compiler.rb +43 -46
- data/lib/puppet/parser/files.rb +15 -20
- data/lib/puppet/parser/functions.rb +8 -39
- data/lib/puppet/parser/functions/extlookup.rb +8 -8
- data/lib/puppet/parser/functions/file.rb +18 -18
- data/lib/puppet/parser/functions/fqdn_rand.rb +2 -2
- data/lib/puppet/parser/functions/generate.rb +3 -3
- data/lib/puppet/parser/functions/include.rb +6 -1
- data/lib/puppet/parser/functions/require.rb +16 -21
- data/lib/puppet/parser/functions/shellquote.rb +29 -21
- data/lib/puppet/parser/functions/versioncmp.rb +2 -5
- data/lib/puppet/parser/grammar.ra +44 -14
- data/lib/puppet/parser/lexer.rb +101 -169
- data/lib/puppet/parser/parser.rb +1103 -1014
- data/lib/puppet/parser/parser_support.rb +10 -61
- data/lib/puppet/parser/relationship.rb +1 -3
- data/lib/puppet/parser/resource.rb +21 -56
- data/lib/puppet/parser/scope.rb +138 -165
- data/lib/puppet/parser/templatewrapper.rb +25 -20
- data/lib/puppet/parser/type_loader.rb +33 -67
- data/lib/puppet/parser/yaml_trimmer.rb +1 -1
- data/lib/puppet/property.rb +5 -4
- data/lib/puppet/provider.rb +133 -28
- data/lib/puppet/provider/augeas/augeas.rb +66 -6
- data/lib/puppet/provider/command.rb +25 -0
- data/lib/puppet/provider/cron/crontab.rb +1 -1
- data/lib/puppet/provider/exec.rb +14 -9
- data/lib/puppet/provider/exec/posix.rb +1 -1
- data/lib/puppet/provider/exec/windows.rb +2 -3
- data/lib/puppet/provider/file/windows.rb +29 -10
- data/lib/puppet/provider/group/groupadd.rb +3 -2
- data/lib/puppet/provider/group/ldap.rb +1 -1
- data/lib/puppet/provider/group/windows_adsi.rb +1 -1
- data/lib/puppet/provider/host/parsed.rb +1 -1
- data/lib/puppet/provider/ldap.rb +1 -5
- data/lib/puppet/provider/mount/parsed.rb +3 -3
- data/lib/puppet/provider/nameservice.rb +22 -22
- data/lib/puppet/provider/nameservice/directoryservice.rb +58 -121
- data/lib/puppet/provider/package/apt.rb +8 -11
- data/lib/puppet/provider/package/blastwave.rb +3 -3
- data/lib/puppet/provider/package/dpkg.rb +1 -1
- data/lib/puppet/provider/package/freebsd.rb +2 -2
- data/lib/puppet/provider/package/gem.rb +1 -1
- data/lib/puppet/provider/package/macports.rb +11 -9
- data/lib/puppet/provider/package/msi.rb +37 -32
- data/lib/puppet/provider/package/openbsd.rb +1 -1
- data/lib/puppet/provider/package/pacman.rb +69 -6
- data/lib/puppet/provider/package/pkg.rb +126 -75
- data/lib/puppet/provider/package/pkgin.rb +60 -0
- data/lib/puppet/provider/package/pkgutil.rb +32 -20
- data/lib/puppet/provider/package/portage.rb +2 -2
- data/lib/puppet/provider/package/sun.rb +83 -116
- data/lib/puppet/provider/package/sunfreeware.rb +1 -1
- data/lib/puppet/provider/package/up2date.rb +2 -3
- data/lib/puppet/provider/package/windows.rb +130 -0
- data/lib/puppet/provider/package/windows/exe_package.rb +70 -0
- data/lib/puppet/provider/package/windows/msi_package.rb +62 -0
- data/lib/puppet/provider/package/windows/package.rb +79 -0
- data/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb +2 -2
- data/lib/puppet/provider/service/base.rb +1 -0
- data/lib/puppet/provider/service/bsd.rb +7 -5
- data/lib/puppet/provider/service/daemontools.rb +1 -1
- data/lib/puppet/provider/service/debian.rb +1 -1
- data/lib/puppet/provider/service/freebsd.rb +9 -9
- data/lib/puppet/provider/service/launchd.rb +7 -11
- data/lib/puppet/provider/service/redhat.rb +2 -2
- data/lib/puppet/provider/service/runit.rb +9 -2
- data/lib/puppet/provider/service/smf.rb +14 -2
- data/lib/puppet/provider/service/systemd.rb +3 -3
- data/lib/puppet/provider/service/upstart.rb +6 -6
- data/lib/puppet/provider/ssh_authorized_key/parsed.rb +1 -0
- data/lib/puppet/provider/user/user_role_add.rb +1 -1
- data/lib/puppet/provider/user/useradd.rb +3 -8
- data/lib/puppet/provider/user/windows_adsi.rb +1 -12
- data/lib/puppet/provider/zfs/{solaris.rb → zfs.rb} +16 -5
- data/lib/puppet/provider/zone/solaris.rb +10 -13
- data/lib/puppet/provider/zpool/{solaris.rb → zpool.rb} +11 -4
- data/lib/puppet/rails.rb +6 -4
- data/lib/puppet/rails/database/schema.rb +9 -4
- data/lib/puppet/rails/inventory_node.rb +13 -26
- data/lib/puppet/reference/configuration.rb +1 -2
- data/lib/puppet/reference/metaparameter.rb +1 -2
- data/lib/puppet/reports/http.rb +9 -10
- data/lib/puppet/reports/rrdgraph.rb +2 -2
- data/lib/puppet/reports/store.rb +1 -2
- data/lib/puppet/reports/tagmail.rb +6 -6
- data/lib/puppet/resource.rb +69 -64
- data/lib/puppet/resource/catalog.rb +11 -60
- data/lib/puppet/resource/status.rb +6 -32
- data/lib/puppet/resource/type.rb +94 -34
- data/lib/puppet/resource/type_collection.rb +17 -8
- data/lib/puppet/run.rb +4 -26
- data/lib/puppet/settings.rb +1315 -0
- data/lib/puppet/settings/base_setting.rb +163 -0
- data/lib/puppet/{util/settings → settings}/boolean_setting.rb +7 -3
- data/lib/puppet/settings/directory_setting.rb +7 -0
- data/lib/puppet/settings/errors.rb +11 -0
- data/lib/puppet/{util/settings → settings}/file_setting.rb +4 -20
- data/lib/puppet/settings/path_setting.rb +10 -0
- data/lib/puppet/settings/string_setting.rb +12 -0
- data/lib/puppet/simple_graph.rb +2 -5
- data/lib/puppet/ssl/base.rb +2 -2
- data/lib/puppet/ssl/certificate_authority.rb +4 -5
- data/lib/puppet/ssl/certificate_authority/interface.rb +5 -7
- data/lib/puppet/ssl/certificate_factory.rb +1 -2
- data/lib/puppet/ssl/certificate_request.rb +2 -2
- data/lib/puppet/ssl/certificate_revocation_list.rb +53 -30
- data/lib/puppet/ssl/configuration.rb +32 -0
- data/lib/puppet/ssl/host.rb +9 -37
- data/lib/puppet/status.rb +2 -6
- data/lib/puppet/test/test_helper.rb +58 -25
- data/lib/puppet/transaction.rb +6 -9
- data/lib/puppet/transaction/event.rb +13 -24
- data/lib/puppet/transaction/event_manager.rb +1 -1
- data/lib/puppet/transaction/report.rb +2 -41
- data/lib/puppet/transaction/resource_harness.rb +2 -3
- data/lib/puppet/type.rb +18 -191
- data/lib/puppet/type/augeas.rb +1 -1
- data/lib/puppet/type/cron.rb +1 -1
- data/lib/puppet/type/exec.rb +6 -4
- data/lib/puppet/type/file.rb +33 -44
- data/lib/puppet/type/file/content.rb +13 -9
- data/lib/puppet/type/file/ensure.rb +1 -1
- data/lib/puppet/type/file/mode.rb +1 -1
- data/lib/puppet/type/file/selcontext.rb +2 -6
- data/lib/puppet/type/file/source.rb +8 -4
- data/lib/puppet/type/filebucket.rb +3 -2
- data/lib/puppet/type/mount.rb +1 -11
- data/lib/puppet/type/package.rb +40 -23
- data/lib/puppet/type/schedule.rb +127 -21
- data/lib/puppet/type/scheduled_task.rb +1 -1
- data/lib/puppet/type/service.rb +2 -3
- data/lib/puppet/type/tidy.rb +8 -17
- data/lib/puppet/type/yumrepo.rb +35 -7
- data/lib/puppet/type/zfs.rb +4 -0
- data/lib/puppet/type/zone.rb +48 -38
- data/lib/puppet/util.rb +178 -249
- data/lib/puppet/util/adsi.rb +23 -25
- data/lib/puppet/util/autoload.rb +184 -114
- data/lib/puppet/util/backups.rb +3 -2
- data/lib/puppet/util/colors.rb +0 -1
- data/lib/puppet/util/command_line.rb +42 -104
- data/lib/puppet/util/command_line/puppet_option_parser.rb +89 -0
- data/lib/puppet/util/command_line/trollop.rb +824 -0
- data/lib/puppet/util/config_timeout.rb +24 -0
- data/lib/puppet/util/constant_inflector.rb +15 -7
- data/lib/puppet/util/diff.rb +2 -2
- data/lib/puppet/util/docs.rb +1 -2
- data/lib/puppet/util/errors.rb +3 -4
- data/lib/puppet/util/execution.rb +239 -14
- data/lib/puppet/util/execution_stub.rb +2 -2
- data/lib/puppet/util/feature.rb +2 -4
- data/lib/puppet/util/fileparsing.rb +1 -1
- data/lib/puppet/util/filetype.rb +12 -10
- data/lib/puppet/util/json_lockfile.rb +41 -0
- data/lib/puppet/util/ldap/connection.rb +4 -7
- data/lib/puppet/util/lockfile.rb +62 -0
- data/lib/puppet/util/log.rb +16 -20
- data/lib/puppet/util/log/destinations.rb +12 -27
- data/lib/puppet/util/logging.rb +95 -3
- data/lib/puppet/util/metric.rb +0 -6
- data/lib/puppet/util/monkey_patches.rb +101 -82
- data/lib/puppet/util/monkey_patches/lines.rb +13 -0
- data/lib/puppet/util/network_device/cisco/device.rb +2 -2
- data/lib/puppet/util/network_device/config.rb +1 -0
- data/lib/puppet/util/network_device/transport.rb +2 -0
- data/lib/puppet/util/pidlock.rb +13 -77
- data/lib/puppet/util/platform.rb +0 -7
- data/lib/puppet/util/posix.rb +10 -0
- data/lib/puppet/util/rdoc.rb +12 -8
- data/lib/puppet/util/reference.rb +3 -3
- data/lib/puppet/util/rubygems.rb +55 -0
- data/lib/puppet/util/run_mode.rb +7 -16
- data/lib/puppet/util/selinux.rb +36 -31
- data/lib/puppet/util/storage.rb +14 -19
- data/lib/puppet/util/suidmanager.rb +27 -2
- data/lib/puppet/util/windows.rb +9 -6
- data/lib/puppet/util/windows/error.rb +1 -1
- data/lib/puppet/util/windows/process.rb +3 -3
- data/lib/puppet/util/windows/registry.rb +36 -0
- data/lib/puppet/util/windows/security.rb +46 -9
- data/lib/puppet/util/windows/user.rb +2 -65
- data/lib/puppet/util/zaml.rb +47 -91
- data/lib/puppet/version.rb +1 -1
- data/man/man5/puppet.conf.5 +97 -69
- data/man/man8/puppet-agent.8 +5 -6
- data/man/man8/puppet-apply.8 +7 -3
- data/man/man8/puppet-ca.8 +5 -17
- data/man/man8/puppet-catalog.8 +1 -1
- data/man/man8/puppet-cert.8 +1 -1
- data/man/man8/puppet-certificate.8 +3 -9
- data/man/man8/puppet-certificate_request.8 +1 -1
- data/man/man8/puppet-certificate_revocation_list.8 +1 -1
- data/man/man8/puppet-config.8 +1 -1
- data/man/man8/puppet-describe.8 +1 -1
- data/man/man8/puppet-device.8 +1 -1
- data/man/man8/puppet-doc.8 +7 -1
- data/man/man8/puppet-facts.8 +1 -1
- data/man/man8/puppet-file.8 +1 -1
- data/man/man8/puppet-filebucket.8 +1 -1
- data/man/man8/puppet-help.8 +2 -5
- data/man/man8/puppet-inspect.8 +1 -1
- data/man/man8/puppet-instrumentation_data.8 +1 -1
- data/man/man8/puppet-instrumentation_listener.8 +1 -1
- data/man/man8/puppet-instrumentation_probe.8 +1 -1
- data/man/man8/puppet-key.8 +1 -1
- data/man/man8/puppet-kick.8 +1 -1
- data/man/man8/puppet-man.8 +1 -1
- data/man/man8/puppet-master.8 +1 -1
- data/man/man8/puppet-module.8 +19 -50
- data/man/man8/puppet-node.8 +2 -5
- data/man/man8/puppet-parser.8 +7 -1
- data/man/man8/puppet-plugin.8 +1 -1
- data/man/man8/puppet-queue.8 +1 -1
- data/man/man8/puppet-report.8 +2 -3
- data/man/man8/puppet-resource.8 +1 -1
- data/man/man8/puppet-resource_type.8 +1 -1
- data/man/man8/puppet-secret_agent.8 +1 -1
- data/man/man8/puppet-status.8 +1 -1
- data/man/man8/puppet.8 +1 -1
- data/spec/fixtures/unit/indirector/hiera/global.yaml +10 -0
- data/{test/data/providers/cron/crontab_sample_records.yaml → spec/fixtures/unit/provider/cron/crontab/single_line.yaml} +0 -0
- data/spec/fixtures/unit/provider/package/pkg/dummy_solaris10 +1 -1
- data/spec/fixtures/unit/provider/package/pkg/{dummy_solaris11 → dummy_solaris11.ifo.installed} +0 -0
- data/spec/fixtures/unit/provider/package/pkg/dummy_solaris11.ifo.known +1 -0
- data/spec/fixtures/unit/provider/package/pkg/dummy_solaris11.installed +1 -0
- data/spec/fixtures/unit/provider/package/pkg/dummy_solaris11.known +1 -0
- data/spec/fixtures/unit/provider/package/pkg/publisher +2 -2
- data/spec/fixtures/unit/provider/package/pkg/simple +2 -4
- data/spec/fixtures/unit/provider/package/pkg/solaris11 +2 -12
- data/spec/fixtures/unit/provider/package/sun/dummy.server +12 -0
- data/spec/fixtures/unit/provider/package/sun/simple +24 -0
- data/spec/fixtures/unit/provider/service/smf/svcs.out +3 -0
- data/{test/data/types/sshkey/1 → spec/fixtures/unit/provider/sshkey/parsed/sample} +0 -0
- data/spec/fixtures/unit/provider/zfs/zfs/zfs-list.out +2 -0
- data/spec/fixtures/unit/provider/zpool/zpool/zpool-list.out +2 -0
- data/spec/integration/application/apply_spec.rb +1 -1
- data/spec/integration/application/doc_spec.rb +3 -2
- data/spec/integration/configurer_spec.rb +1 -1
- data/spec/integration/defaults_spec.rb +21 -51
- data/spec/{unit/face → integration/faces}/ca_spec.rb +89 -130
- data/spec/integration/faces/documentation_spec.rb +36 -29
- data/spec/integration/file_serving/content_spec.rb +1 -2
- data/spec/integration/file_serving/fileset_spec.rb +1 -1
- data/spec/integration/file_serving/metadata_spec.rb +1 -2
- data/spec/integration/file_serving/terminus_helper_spec.rb +1 -1
- data/spec/integration/indirector/catalog/compiler_spec.rb +1 -2
- data/spec/integration/indirector/catalog/queue_spec.rb +3 -3
- data/spec/integration/indirector/direct_file_server_spec.rb +14 -10
- data/spec/integration/indirector/facts/facter_spec.rb +22 -0
- data/spec/integration/indirector/file_content/file_server_spec.rb +1 -1
- data/spec/integration/indirector/file_metadata/file_server_spec.rb +1 -1
- data/spec/integration/indirector/node/ldap_spec.rb +1 -1
- data/spec/integration/network/authconfig_spec.rb +238 -0
- data/spec/integration/network/formats_spec.rb +2 -4
- data/spec/integration/network/server/mongrel_spec.rb +2 -10
- data/spec/integration/network/server/webrick_spec.rb +1 -1
- data/spec/integration/node/environment_spec.rb +1 -1
- data/spec/integration/node/facts_spec.rb +2 -2
- data/spec/integration/node_spec.rb +2 -15
- data/spec/integration/parser/collector_spec.rb +2 -2
- data/spec/integration/parser/compiler_spec.rb +38 -10
- data/spec/integration/parser/functions/require_spec.rb +1 -1
- data/spec/integration/parser/functions_spec.rb +1 -1
- data/spec/integration/parser/parser_spec.rb +1 -1
- data/spec/integration/parser/ruby_manifest_spec.rb +1 -1
- data/spec/integration/parser/scope_spec.rb +608 -0
- data/spec/integration/provider/mailalias/aliases_spec.rb +1 -1
- data/spec/integration/provider/mount_spec.rb +1 -0
- data/spec/integration/provider/package_spec.rb +3 -3
- data/spec/integration/provider/service/init_spec.rb +2 -2
- data/spec/integration/provider/ssh_authorized_key_spec.rb +1 -1
- data/spec/integration/reference/providers_spec.rb +1 -1
- data/spec/integration/reports_spec.rb +1 -1
- data/spec/integration/resource/catalog_spec.rb +1 -2
- data/spec/integration/resource/type_collection_spec.rb +1 -1
- data/spec/integration/ssl/certificate_authority_spec.rb +1 -1
- data/spec/integration/ssl/certificate_request_spec.rb +1 -1
- data/spec/integration/ssl/certificate_revocation_list_spec.rb +1 -1
- data/spec/integration/ssl/host_spec.rb +1 -1
- data/spec/integration/transaction/report_spec.rb +1 -1
- data/spec/integration/transaction_spec.rb +2 -2
- data/spec/integration/type/exec_spec.rb +1 -1
- data/spec/integration/type/file_spec.rb +140 -158
- data/spec/integration/type/package_spec.rb +6 -2
- data/spec/integration/type/tidy_spec.rb +1 -1
- data/spec/integration/type_spec.rb +1 -1
- data/spec/integration/util/autoload_spec.rb +8 -14
- data/spec/integration/util/feature_spec.rb +1 -1
- data/spec/integration/util/rdoc/parser_spec.rb +11 -9
- data/spec/integration/util/settings_spec.rb +19 -6
- data/spec/integration/util/windows/security_spec.rb +23 -3
- data/spec/integration/util_spec.rb +3 -3
- data/spec/lib/puppet/indirector/indirector_testing/json.rb +6 -0
- data/spec/lib/puppet/indirector_testing.rb +27 -0
- data/spec/lib/puppet_spec/compiler.rb +2 -2
- data/spec/lib/puppet_spec/database.rb +1 -1
- data/spec/lib/puppet_spec/files.rb +4 -4
- data/spec/lib/puppet_spec/matchers.rb +26 -24
- data/spec/lib/puppet_spec/modules.rb +1 -1
- data/spec/lib/puppet_spec/settings.rb +16 -0
- data/spec/shared_behaviours/file_server_terminus.rb +2 -2
- data/spec/shared_behaviours/file_serving.rb +10 -15
- data/spec/shared_behaviours/file_serving_model.rb +2 -6
- data/spec/shared_contexts/platform.rb +0 -8
- data/spec/spec_helper.rb +14 -15
- data/spec/unit/agent/disabler_spec.rb +64 -0
- data/spec/unit/agent/locker_spec.rb +31 -36
- data/spec/unit/agent_spec.rb +79 -26
- data/spec/unit/application/agent_spec.rb +66 -39
- data/spec/unit/application/apply_spec.rb +46 -36
- data/spec/unit/application/cert_spec.rb +1 -5
- data/spec/unit/application/certificate_spec.rb +1 -1
- data/spec/unit/application/config_spec.rb +1 -1
- data/spec/unit/application/describe_spec.rb +1 -5
- data/spec/unit/application/device_spec.rb +22 -12
- data/spec/unit/application/doc_spec.rb +37 -69
- data/spec/unit/application/face_base_spec.rb +10 -6
- data/spec/unit/application/facts_spec.rb +3 -3
- data/spec/unit/application/filebucket_spec.rb +7 -18
- data/spec/unit/application/indirection_base_spec.rb +11 -5
- data/spec/unit/application/inspect_spec.rb +3 -2
- data/spec/unit/application/kick_spec.rb +6 -22
- data/spec/unit/application/master_spec.rb +15 -39
- data/spec/unit/application/queue_spec.rb +2 -6
- data/spec/unit/application/resource_spec.rb +15 -12
- data/spec/unit/application/secret_agent_spec.rb +1 -1
- data/spec/unit/application_spec.rb +110 -123
- data/spec/unit/configurer/downloader_spec.rb +5 -5
- data/spec/unit/configurer/fact_handler_spec.rb +1 -40
- data/spec/unit/configurer/plugin_handler_spec.rb +11 -96
- data/spec/unit/configurer_spec.rb +61 -59
- data/spec/unit/daemon_spec.rb +26 -19
- data/spec/unit/data_binding_spec.rb +11 -0
- data/spec/unit/dsl/resource_api_spec.rb +2 -2
- data/spec/unit/dsl/resource_type_api_spec.rb +1 -1
- data/spec/unit/face/catalog_spec.rb +1 -1
- data/spec/unit/face/certificate_request_spec.rb +1 -1
- data/spec/unit/face/certificate_revocation_list_spec.rb +1 -1
- data/spec/unit/face/certificate_spec.rb +18 -1
- data/spec/unit/face/config_spec.rb +8 -1
- data/spec/unit/face/facts_spec.rb +1 -1
- data/spec/unit/face/file_spec.rb +1 -1
- data/spec/unit/face/help_spec.rb +39 -22
- data/spec/unit/face/instrumentation_data_spec.rb +1 -1
- data/spec/unit/face/instrumentation_listener_spec.rb +1 -1
- data/spec/unit/face/instrumentation_probe_spec.rb +1 -1
- data/spec/unit/face/key_spec.rb +1 -1
- data/spec/unit/face/module/build_spec.rb +68 -0
- data/spec/unit/face/module/install_spec.rb +46 -31
- data/spec/unit/face/module/list_spec.rb +18 -21
- data/spec/unit/face/module/search_spec.rb +87 -49
- data/spec/unit/face/module/uninstall_spec.rb +4 -4
- data/spec/unit/face/node_spec.rb +3 -3
- data/spec/unit/face/plugin_spec.rb +1 -1
- data/spec/unit/face/report_spec.rb +1 -1
- data/spec/unit/face/resource_spec.rb +1 -1
- data/spec/unit/face/resource_type_spec.rb +1 -1
- data/spec/unit/face/secret_agent_spec.rb +1 -1
- data/spec/unit/file_bucket/dipper_spec.rb +1 -1
- data/spec/unit/file_bucket/file_spec.rb +1 -1
- data/spec/unit/file_serving/base_spec.rb +1 -1
- data/spec/unit/file_serving/configuration/parser_spec.rb +1 -1
- data/spec/unit/file_serving/configuration_spec.rb +7 -21
- data/spec/unit/file_serving/content_spec.rb +1 -1
- data/spec/unit/file_serving/fileset_spec.rb +13 -13
- data/spec/unit/file_serving/metadata_spec.rb +29 -47
- data/spec/unit/file_serving/mount/file_spec.rb +1 -1
- data/spec/unit/file_serving/mount/modules_spec.rb +1 -1
- data/spec/unit/file_serving/mount/plugins_spec.rb +17 -4
- data/spec/unit/file_serving/mount_spec.rb +1 -1
- data/spec/unit/file_serving/terminus_helper_spec.rb +1 -1
- data/spec/unit/file_serving/terminus_selector_spec.rb +5 -5
- data/spec/unit/forge/errors_spec.rb +42 -0
- data/spec/unit/forge/repository_spec.rb +108 -31
- data/spec/unit/forge_spec.rb +17 -23
- data/spec/unit/indirector/active_record_spec.rb +1 -1
- data/spec/unit/indirector/catalog/active_record_spec.rb +11 -49
- data/spec/unit/indirector/catalog/compiler_spec.rb +18 -45
- data/spec/unit/indirector/catalog/json_spec.rb +12 -0
- data/spec/unit/indirector/catalog/queue_spec.rb +1 -1
- data/spec/unit/indirector/catalog/rest_spec.rb +1 -1
- data/spec/unit/indirector/catalog/store_configs_spec.rb +1 -1
- data/spec/unit/indirector/catalog/yaml_spec.rb +1 -1
- data/spec/unit/indirector/certificate/ca_spec.rb +5 -6
- data/spec/unit/indirector/certificate/file_spec.rb +5 -6
- data/spec/unit/indirector/certificate/rest_spec.rb +6 -2
- data/spec/unit/indirector/certificate_request/ca_spec.rb +3 -3
- data/spec/unit/indirector/certificate_request/file_spec.rb +3 -3
- data/spec/unit/indirector/certificate_request/rest_spec.rb +1 -1
- data/spec/unit/indirector/certificate_revocation_list/ca_spec.rb +3 -4
- data/spec/unit/indirector/certificate_revocation_list/file_spec.rb +4 -3
- data/spec/unit/indirector/certificate_revocation_list/rest_spec.rb +1 -1
- data/spec/unit/indirector/certificate_status/file_spec.rb +41 -31
- data/spec/unit/indirector/certificate_status/rest_spec.rb +1 -1
- data/spec/unit/indirector/code_spec.rb +1 -1
- data/spec/unit/indirector/data_binding/hiera_spec.rb +21 -0
- data/spec/unit/indirector/data_binding/none_spec.rb +28 -0
- data/spec/unit/indirector/direct_file_server_spec.rb +2 -2
- data/spec/unit/indirector/envelope_spec.rb +1 -1
- data/spec/unit/indirector/exec_spec.rb +1 -1
- data/spec/unit/indirector/face_spec.rb +1 -1
- data/spec/unit/indirector/facts/active_record_spec.rb +1 -1
- data/spec/unit/indirector/facts/couch_spec.rb +3 -3
- data/spec/unit/indirector/facts/facter_spec.rb +13 -20
- data/spec/unit/indirector/facts/inventory_active_record_spec.rb +2 -2
- data/spec/unit/indirector/facts/inventory_service_spec.rb +2 -3
- data/spec/unit/indirector/facts/network_device_spec.rb +2 -9
- data/spec/unit/indirector/facts/rest_spec.rb +1 -1
- data/spec/unit/indirector/facts/store_configs_spec.rb +1 -1
- data/spec/unit/indirector/facts/yaml_spec.rb +2 -2
- data/spec/unit/indirector/file_bucket_file/file_spec.rb +2 -2
- data/spec/unit/indirector/file_bucket_file/rest_spec.rb +1 -1
- data/spec/unit/indirector/file_content/file_server_spec.rb +1 -1
- data/spec/unit/indirector/file_content/file_spec.rb +1 -1
- data/spec/unit/indirector/file_content/rest_spec.rb +7 -3
- data/spec/unit/indirector/file_metadata/file_server_spec.rb +1 -1
- data/spec/unit/indirector/file_metadata/file_spec.rb +3 -3
- data/spec/unit/indirector/file_metadata/rest_spec.rb +1 -1
- data/spec/unit/indirector/file_server_spec.rb +1 -1
- data/spec/unit/indirector/hiera_spec.rb +149 -0
- data/spec/unit/indirector/indirection_spec.rb +10 -29
- data/spec/unit/indirector/instrumentation_data/local_spec.rb +1 -1
- data/spec/unit/indirector/instrumentation_data/rest_spec.rb +1 -1
- data/spec/unit/indirector/instrumentation_listener/local_spec.rb +1 -1
- data/spec/unit/indirector/instrumentation_listener/rest_spec.rb +1 -1
- data/spec/unit/indirector/instrumentation_probe/local_spec.rb +1 -1
- data/spec/unit/indirector/instrumentation_probe/rest_spec.rb +1 -1
- data/spec/unit/indirector/json_spec.rb +193 -0
- data/spec/unit/indirector/key/ca_spec.rb +5 -6
- data/spec/unit/indirector/key/file_spec.rb +10 -12
- data/spec/unit/indirector/ldap_spec.rb +3 -3
- data/spec/unit/indirector/memory_spec.rb +1 -1
- data/spec/unit/indirector/node/active_record_spec.rb +11 -7
- data/spec/unit/indirector/node/exec_spec.rb +12 -5
- data/spec/unit/indirector/node/ldap_spec.rb +173 -194
- data/spec/unit/indirector/node/memory_spec.rb +1 -1
- data/spec/unit/indirector/node/plain_spec.rb +16 -8
- data/spec/unit/indirector/node/rest_spec.rb +1 -1
- data/spec/unit/indirector/node/store_configs_spec.rb +1 -1
- data/spec/unit/indirector/node/yaml_spec.rb +1 -1
- data/spec/unit/indirector/none_spec.rb +33 -0
- data/spec/unit/indirector/plain_spec.rb +1 -1
- data/spec/unit/indirector/queue_spec.rb +1 -1
- data/spec/unit/indirector/report/processor_spec.rb +4 -4
- data/spec/unit/indirector/report/rest_spec.rb +3 -46
- data/spec/unit/indirector/report/yaml_spec.rb +3 -12
- data/spec/unit/indirector/request_spec.rb +238 -61
- data/spec/unit/indirector/resource/active_record_spec.rb +2 -2
- data/spec/unit/indirector/resource/ral_spec.rb +2 -2
- data/spec/unit/indirector/resource/rest_spec.rb +1 -1
- data/spec/unit/indirector/resource/store_configs_spec.rb +1 -1
- data/spec/unit/indirector/resource_type/parser_spec.rb +153 -53
- data/spec/unit/indirector/resource_type/rest_spec.rb +1 -1
- data/spec/unit/indirector/rest_spec.rb +350 -361
- data/spec/unit/indirector/run/local_spec.rb +2 -2
- data/spec/unit/indirector/run/rest_spec.rb +1 -1
- data/spec/unit/indirector/ssl_file_spec.rb +12 -10
- data/spec/unit/indirector/status/rest_spec.rb +1 -1
- data/spec/unit/indirector/store_configs_spec.rb +1 -1
- data/spec/unit/indirector/terminus_spec.rb +1 -46
- data/spec/unit/indirector/yaml_spec.rb +36 -36
- data/spec/unit/indirector_spec.rb +1 -1
- data/spec/unit/interface/action_builder_spec.rb +1 -1
- data/spec/unit/interface/action_manager_spec.rb +1 -1
- data/spec/unit/interface/action_spec.rb +1 -1
- data/spec/unit/interface/documentation_spec.rb +3 -2
- data/spec/unit/interface/face_collection_spec.rb +19 -9
- data/spec/unit/interface/option_builder_spec.rb +9 -1
- data/spec/unit/interface/option_spec.rb +8 -0
- data/spec/unit/interface_spec.rb +49 -11
- data/spec/unit/module_spec.rb +95 -303
- data/spec/unit/module_tool/application_spec.rb +6 -6
- data/spec/unit/module_tool/applications/installer_spec.rb +131 -69
- data/spec/unit/module_tool/applications/searcher_spec.rb +37 -0
- data/spec/unit/module_tool/applications/uninstaller_spec.rb +27 -19
- data/spec/unit/module_tool/applications/unpacker_spec.rb +4 -10
- data/spec/unit/module_tool/applications/upgrader_spec.rb +1 -4
- data/spec/unit/module_tool/install_directory_spec.rb +70 -0
- data/spec/unit/module_tool_spec.rb +132 -1
- data/spec/unit/network/auth_config_parser_spec.rb +101 -0
- data/spec/unit/network/authconfig_spec.rb +54 -272
- data/spec/unit/network/authorization_spec.rb +20 -0
- data/spec/unit/network/authstore_spec.rb +17 -15
- data/spec/unit/network/format_handler_spec.rb +3 -3
- data/spec/unit/network/format_spec.rb +1 -1
- data/spec/unit/network/formats_spec.rb +28 -37
- data/spec/unit/network/http/api/v1_spec.rb +3 -3
- data/spec/unit/network/http/compression_spec.rb +3 -3
- data/spec/unit/network/http/connection_spec.rb +244 -0
- data/spec/unit/network/http/handler_spec.rb +4 -20
- data/spec/unit/network/http/mongrel/rest_spec.rb +12 -31
- data/spec/unit/network/http/mongrel_spec.rb +7 -37
- data/spec/unit/network/http/rack/rest_spec.rb +10 -44
- data/spec/unit/network/http/rack_spec.rb +2 -59
- data/spec/unit/network/http/webrick/rest_spec.rb +14 -4
- data/spec/unit/network/http/webrick_spec.rb +129 -193
- data/spec/unit/network/http_pool_spec.rb +6 -115
- data/spec/unit/network/http_spec.rb +1 -1
- data/spec/unit/network/resolver_spec.rb +207 -0
- data/spec/unit/network/rights_spec.rb +15 -115
- data/spec/unit/network/server_spec.rb +58 -166
- data/spec/unit/node/environment_spec.rb +7 -7
- data/spec/unit/node/facts_spec.rb +15 -30
- data/spec/unit/node_spec.rb +14 -26
- data/spec/unit/other/selinux_spec.rb +1 -1
- data/spec/unit/parameter/package_options_spec.rb +44 -0
- data/spec/unit/parameter/path_spec.rb +1 -1
- data/spec/unit/parameter/value_collection_spec.rb +1 -1
- data/spec/unit/parameter/value_spec.rb +1 -1
- data/spec/unit/parameter_spec.rb +1 -1
- data/spec/unit/parser/ast/arithmetic_operator_spec.rb +4 -2
- data/spec/unit/parser/ast/astarray_spec.rb +4 -2
- data/spec/unit/parser/ast/asthash_spec.rb +4 -2
- data/spec/unit/parser/ast/boolean_operator_spec.rb +4 -2
- data/spec/unit/parser/ast/casestatement_spec.rb +9 -5
- data/spec/unit/parser/ast/collection_spec.rb +2 -2
- data/spec/unit/parser/ast/collexpr_spec.rb +4 -2
- data/spec/unit/parser/ast/comparison_operator_spec.rb +5 -2
- data/spec/unit/parser/ast/definition_spec.rb +1 -1
- data/spec/unit/parser/ast/function_spec.rb +3 -3
- data/spec/unit/parser/ast/hostclass_spec.rb +1 -1
- data/spec/unit/parser/ast/ifstatement_spec.rb +4 -2
- data/spec/unit/parser/ast/in_operator_spec.rb +4 -2
- data/spec/unit/parser/ast/leaf_spec.rb +66 -39
- data/spec/unit/parser/ast/match_operator_spec.rb +4 -2
- data/spec/unit/parser/ast/minus_spec.rb +4 -2
- data/spec/unit/parser/ast/node_spec.rb +1 -1
- data/spec/unit/parser/ast/nop_spec.rb +1 -1
- data/spec/unit/parser/ast/not_spec.rb +4 -2
- data/spec/unit/parser/ast/relationship_spec.rb +2 -2
- data/spec/unit/parser/ast/resource_defaults_spec.rb +2 -2
- data/spec/unit/parser/ast/resource_override_spec.rb +2 -2
- data/spec/unit/parser/ast/resource_reference_spec.rb +5 -3
- data/spec/unit/parser/ast/resource_spec.rb +5 -32
- data/spec/unit/parser/ast/selector_spec.rb +56 -106
- data/spec/unit/parser/ast/vardef_spec.rb +4 -2
- data/spec/unit/parser/ast_spec.rb +22 -51
- data/spec/unit/parser/collector_spec.rb +2 -2
- data/spec/unit/parser/compiler_spec.rb +89 -42
- data/spec/unit/parser/files_spec.rb +81 -10
- data/spec/unit/parser/functions/create_resources_spec.rb +5 -4
- data/spec/unit/parser/functions/defined_spec.rb +2 -2
- data/spec/unit/parser/functions/extlookup_spec.rb +9 -8
- data/spec/unit/parser/functions/fail_spec.rb +28 -0
- data/spec/unit/parser/functions/file_spec.rb +55 -0
- data/spec/unit/parser/functions/fqdn_rand_spec.rb +6 -12
- data/spec/unit/parser/functions/generate_spec.rb +54 -3
- data/spec/unit/parser/functions/include_spec.rb +19 -2
- data/spec/unit/parser/functions/inline_template_spec.rb +9 -20
- data/spec/unit/parser/functions/realize_spec.rb +4 -4
- data/spec/unit/parser/functions/regsubst_spec.rb +4 -2
- data/spec/unit/parser/functions/require_spec.rb +5 -14
- data/spec/unit/parser/functions/search_spec.rb +23 -0
- data/spec/unit/parser/functions/shellquote_spec.rb +31 -38
- data/spec/unit/parser/functions/split_spec.rb +4 -2
- data/spec/unit/parser/functions/sprintf_spec.rb +4 -2
- data/spec/unit/parser/functions/tag_spec.rb +4 -3
- data/spec/unit/parser/functions/template_spec.rb +45 -27
- data/spec/unit/parser/functions/versioncmp_spec.rb +4 -2
- data/spec/unit/parser/functions_spec.rb +14 -22
- data/spec/unit/parser/lexer_spec.rb +10 -134
- data/spec/unit/parser/parser_spec.rb +126 -35
- data/spec/unit/parser/relationship_spec.rb +1 -25
- data/spec/unit/parser/resource_spec.rb +15 -79
- data/spec/unit/parser/scope_spec.rb +175 -602
- data/spec/unit/parser/templatewrapper_spec.rb +8 -25
- data/spec/unit/parser/type_loader_spec.rb +37 -21
- data/spec/unit/property/ensure_spec.rb +1 -1
- data/spec/unit/property/keyvalue_spec.rb +1 -1
- data/spec/unit/property/list_spec.rb +1 -1
- data/spec/unit/property/ordered_list_spec.rb +1 -1
- data/spec/unit/property_spec.rb +1 -1
- data/spec/unit/{puppet/provider → provider}/README.markdown +0 -0
- data/spec/unit/provider/augeas/augeas_spec.rb +88 -1
- data/spec/unit/provider/cisco_spec.rb +1 -1
- data/spec/unit/provider/command_spec.rb +62 -0
- data/spec/unit/provider/confine/exists_spec.rb +8 -1
- data/spec/unit/provider/confine/false_spec.rb +1 -1
- data/spec/unit/provider/confine/feature_spec.rb +1 -1
- data/spec/unit/provider/confine/true_spec.rb +1 -1
- data/spec/unit/provider/confine/variable_spec.rb +1 -1
- data/spec/unit/provider/confine_collection_spec.rb +1 -1
- data/spec/unit/provider/confine_spec.rb +1 -1
- data/spec/unit/provider/confiner_spec.rb +1 -1
- data/spec/unit/provider/cron/crontab_spec.rb +116 -0
- data/spec/unit/provider/exec/posix_spec.rb +99 -12
- data/spec/unit/provider/exec/shell_spec.rb +1 -1
- data/spec/unit/provider/exec/windows_spec.rb +1 -1
- data/spec/unit/provider/exec_spec.rb +1 -1
- data/spec/unit/provider/file/posix_spec.rb +1 -1
- data/spec/unit/provider/file/windows_spec.rb +30 -30
- data/spec/unit/provider/group/groupadd_spec.rb +31 -37
- data/spec/unit/provider/group/ldap_spec.rb +1 -1
- data/spec/unit/provider/group/pw_spec.rb +1 -1
- data/spec/unit/provider/group/windows_adsi_spec.rb +2 -2
- data/spec/unit/provider/host/parsed_spec.rb +1 -1
- data/spec/unit/provider/interface/cisco_spec.rb +1 -1
- data/spec/unit/provider/ldap_spec.rb +1 -1
- data/spec/unit/provider/macauthorization_spec.rb +1 -1
- data/spec/unit/provider/mcx/mcxcontent_spec.rb +1 -1
- data/spec/unit/provider/mount/parsed_spec.rb +18 -12
- data/spec/unit/provider/mount_spec.rb +1 -1
- data/spec/unit/provider/naginator_spec.rb +1 -1
- data/spec/unit/provider/nameservice/directoryservice_spec.rb +9 -29
- data/spec/unit/provider/network_device_spec.rb +1 -1
- data/spec/unit/provider/package/aix_spec.rb +1 -1
- data/spec/unit/provider/package/appdmg_spec.rb +1 -1
- data/spec/unit/provider/package/apt_spec.rb +1 -1
- data/spec/unit/provider/package/aptitude_spec.rb +38 -0
- data/spec/unit/provider/package/aptrpm_spec.rb +39 -0
- data/spec/unit/provider/package/dpkg_spec.rb +4 -4
- data/spec/unit/provider/package/freebsd_spec.rb +3 -3
- data/spec/unit/provider/package/gem_spec.rb +1 -1
- data/spec/unit/provider/package/hpux_spec.rb +1 -1
- data/spec/unit/provider/package/macports_spec.rb +27 -10
- data/spec/unit/provider/package/msi_spec.rb +29 -14
- data/spec/unit/provider/package/nim_spec.rb +1 -1
- data/spec/unit/provider/package/openbsd_spec.rb +3 -3
- data/spec/unit/provider/package/pacman_spec.rb +109 -81
- data/spec/unit/provider/package/pip_spec.rb +1 -1
- data/spec/unit/provider/package/pkg_spec.rb +205 -97
- data/spec/unit/provider/package/pkgdmg_spec.rb +1 -1
- data/spec/unit/provider/package/pkgin_spec.rb +176 -0
- data/spec/unit/provider/package/pkgutil_spec.rb +64 -10
- data/spec/unit/provider/package/rpm_spec.rb +58 -0
- data/spec/unit/provider/package/sun_spec.rb +122 -0
- data/spec/unit/provider/package/up2date_spec.rb +24 -0
- data/spec/unit/provider/package/windows/exe_package_spec.rb +99 -0
- data/spec/unit/provider/package/windows/msi_package_spec.rb +115 -0
- data/spec/unit/provider/package/windows/package_spec.rb +126 -0
- data/spec/unit/provider/package/windows_spec.rb +255 -0
- data/spec/unit/provider/package/yum_spec.rb +1 -1
- data/spec/unit/provider/package/zypper_spec.rb +1 -1
- data/spec/unit/provider/parsedfile_spec.rb +1 -1
- data/spec/unit/provider/scheduled_task/win32_taskscheduler_spec.rb +12 -15
- data/spec/unit/provider/selboolean_spec.rb +1 -1
- data/spec/unit/provider/selmodule-example.pp +0 -0
- data/spec/unit/provider/selmodule_spec.rb +1 -1
- data/spec/unit/provider/service/base_spec.rb +77 -0
- data/spec/unit/provider/service/daemontools_spec.rb +1 -1
- data/spec/unit/provider/service/debian_spec.rb +1 -1
- data/spec/unit/provider/service/freebsd_spec.rb +1 -1
- data/spec/unit/provider/service/gentoo_spec.rb +1 -1
- data/spec/unit/provider/service/init_spec.rb +1 -1
- data/spec/unit/provider/service/launchd_spec.rb +0 -17
- data/spec/unit/provider/service/redhat_spec.rb +12 -3
- data/spec/unit/provider/service/runit_spec.rb +2 -1
- data/spec/unit/provider/service/smf_spec.rb +16 -1
- data/spec/unit/provider/service/src_spec.rb +6 -6
- data/spec/unit/provider/service/systemd_spec.rb +18 -1
- data/spec/unit/provider/service/upstart_spec.rb +12 -7
- data/spec/unit/provider/service/windows_spec.rb +1 -1
- data/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +1 -1
- data/spec/unit/provider/sshkey/parsed_spec.rb +42 -12
- data/spec/unit/provider/user/hpux_spec.rb +1 -1
- data/spec/unit/provider/user/ldap_spec.rb +9 -23
- data/spec/unit/provider/user/pw_spec.rb +1 -1
- data/spec/unit/provider/user/user_role_add_spec.rb +5 -2
- data/spec/unit/provider/user/useradd_spec.rb +118 -146
- data/spec/unit/provider/user/windows_adsi_spec.rb +2 -24
- data/spec/unit/provider/vlan/cisco_spec.rb +1 -1
- data/spec/unit/provider/zfs/zfs_spec.rb +106 -0
- data/spec/unit/provider/zone/solaris_spec.rb +56 -34
- data/spec/unit/provider/zpool/zpool_spec.rb +213 -0
- data/spec/unit/provider_spec.rb +621 -16
- data/spec/unit/puppet_spec.rb +21 -9
- data/spec/unit/rails/host_spec.rb +1 -1
- data/spec/unit/rails/param_value_spec.rb +1 -1
- data/spec/unit/rails/resource_spec.rb +1 -1
- data/spec/unit/rails_spec.rb +70 -70
- data/spec/unit/relationship_spec.rb +1 -1
- data/spec/unit/reports/http_spec.rb +48 -15
- data/spec/unit/reports/rrdgraph_spec.rb +1 -1
- data/spec/unit/reports/store_spec.rb +1 -1
- data/spec/unit/reports/tagmail_spec.rb +1 -1
- data/spec/unit/reports_spec.rb +1 -1
- data/spec/unit/resource/catalog_spec.rb +8 -175
- data/spec/unit/resource/status_spec.rb +2 -2
- data/spec/unit/resource/type_collection_helper_spec.rb +1 -1
- data/spec/unit/resource/type_collection_spec.rb +72 -45
- data/spec/unit/resource/type_spec.rb +31 -33
- data/spec/unit/resource_spec.rb +163 -98
- data/spec/unit/run_spec.rb +7 -23
- data/spec/unit/settings/directory_setting_spec.rb +32 -0
- data/spec/unit/{util/settings → settings}/file_setting_spec.rb +14 -23
- data/spec/unit/settings/path_setting_spec.rb +30 -0
- data/spec/unit/settings/string_setting_spec.rb +75 -0
- data/spec/unit/settings_spec.rb +1583 -0
- data/spec/unit/simple_graph_spec.rb +19 -5
- data/spec/unit/ssl/base_spec.rb +2 -2
- data/spec/unit/ssl/certificate_authority/interface_spec.rb +7 -7
- data/spec/unit/ssl/certificate_authority_spec.rb +27 -53
- data/spec/unit/ssl/certificate_factory_spec.rb +1 -1
- data/spec/unit/ssl/certificate_request_spec.rb +2 -4
- data/spec/unit/ssl/certificate_revocation_list_spec.rb +3 -3
- data/spec/unit/ssl/certificate_spec.rb +1 -1
- data/spec/unit/ssl/configuration_spec.rb +60 -0
- data/spec/unit/ssl/host_spec.rb +37 -89
- data/spec/unit/ssl/inventory_spec.rb +13 -20
- data/spec/unit/ssl/key_spec.rb +11 -9
- data/spec/unit/status_spec.rb +1 -7
- data/spec/unit/transaction/event_manager_spec.rb +1 -1
- data/spec/unit/transaction/event_spec.rb +6 -6
- data/spec/unit/transaction/report_spec.rb +1 -1
- data/spec/unit/transaction/resource_harness_spec.rb +2 -2
- data/spec/unit/transaction_spec.rb +8 -8
- data/spec/unit/{puppet/type → type}/README.markdown +0 -0
- data/spec/unit/type/augeas_spec.rb +2 -2
- data/spec/unit/type/component_spec.rb +1 -1
- data/spec/unit/type/computer_spec.rb +1 -1
- data/spec/unit/type/cron_spec.rb +1 -1
- data/spec/unit/type/exec_spec.rb +40 -12
- data/spec/unit/type/file/checksum_spec.rb +1 -1
- data/spec/unit/type/file/content_spec.rb +9 -6
- data/spec/unit/type/file/ctime_spec.rb +1 -1
- data/spec/unit/type/file/ensure_spec.rb +1 -1
- data/spec/unit/type/file/group_spec.rb +1 -1
- data/spec/unit/type/file/mode_spec.rb +1 -1
- data/spec/unit/type/file/mtime_spec.rb +1 -1
- data/spec/unit/type/file/owner_spec.rb +1 -1
- data/spec/unit/type/file/selinux_spec.rb +1 -1
- data/spec/unit/type/file/source_spec.rb +14 -13
- data/spec/unit/type/file/type_spec.rb +1 -1
- data/spec/unit/type/file_spec.rb +39 -87
- data/spec/unit/type/filebucket_spec.rb +1 -1
- data/spec/unit/type/group_spec.rb +5 -5
- data/spec/unit/type/host_spec.rb +1 -1
- data/spec/unit/type/interface_spec.rb +1 -1
- data/spec/unit/type/macauthorization_spec.rb +1 -1
- data/spec/unit/type/mailalias_spec.rb +21 -0
- data/spec/unit/type/maillist_spec.rb +1 -1
- data/spec/unit/type/mcx_spec.rb +1 -1
- data/spec/unit/type/mount_spec.rb +2 -2
- data/spec/unit/type/nagios_spec.rb +1 -1
- data/spec/unit/type/noop_metaparam_spec.rb +3 -3
- data/spec/unit/type/package_spec.rb +1 -1
- data/spec/unit/type/resources_spec.rb +2 -2
- data/spec/unit/type/schedule_spec.rb +297 -39
- data/spec/unit/type/scheduled_task_spec.rb +3 -3
- data/spec/unit/type/selboolean_spec.rb +1 -1
- data/spec/unit/type/selmodule_spec.rb +1 -1
- data/spec/unit/type/service_spec.rb +1 -1
- data/spec/unit/type/ssh_authorized_key_spec.rb +3 -3
- data/spec/unit/type/sshkey_spec.rb +1 -1
- data/spec/unit/type/stage_spec.rb +1 -1
- data/spec/unit/type/tidy_spec.rb +1 -1
- data/spec/unit/type/user_spec.rb +1 -1
- data/spec/unit/type/vlan_spec.rb +1 -1
- data/spec/unit/type/whit_spec.rb +1 -1
- data/spec/unit/type/yumrepo_spec.rb +243 -0
- data/spec/unit/type/zfs_spec.rb +8 -6
- data/spec/unit/type/zone_spec.rb +41 -36
- data/spec/unit/type/zpool_spec.rb +1 -1
- data/spec/unit/type_spec.rb +180 -31
- data/spec/unit/util/adsi_spec.rb +8 -23
- data/spec/unit/util/autoload_spec.rb +181 -45
- data/spec/unit/util/backups_spec.rb +1 -1
- data/spec/unit/util/cache_accumulator_spec.rb +1 -1
- data/spec/unit/util/cacher_spec.rb +1 -1
- data/spec/unit/util/checksums_spec.rb +1 -1
- data/spec/unit/util/command_line_spec.rb +114 -108
- data/spec/unit/util/command_line_utils/puppet_option_parser_spec.rb +129 -0
- data/spec/unit/util/config_timeout_spec.rb +57 -0
- data/spec/unit/util/constant_inflector_spec.rb +13 -23
- data/spec/unit/util/diff_spec.rb +5 -4
- data/spec/unit/util/errors_spec.rb +1 -1
- data/spec/unit/util/execution_spec.rb +532 -28
- data/spec/unit/util/execution_stub_spec.rb +4 -4
- data/spec/unit/util/feature_spec.rb +12 -13
- data/spec/unit/util/filetype_spec.rb +9 -9
- data/spec/unit/util/inline_docs_spec.rb +1 -1
- data/spec/unit/util/instrumentation/data_spec.rb +1 -1
- data/spec/unit/util/instrumentation/indirection_probe_spec.rb +1 -1
- data/spec/unit/util/instrumentation/instrumentable_spec.rb +1 -1
- data/spec/unit/util/instrumentation/listener_spec.rb +1 -1
- data/spec/unit/util/instrumentation_spec.rb +1 -1
- data/spec/unit/util/json_lockfile_spec.rb +29 -0
- data/spec/unit/util/ldap/connection_spec.rb +11 -15
- data/spec/unit/util/ldap/generator_spec.rb +1 -1
- data/spec/unit/util/ldap/manager_spec.rb +14 -23
- data/spec/unit/util/loadedfile_spec.rb +1 -1
- data/spec/unit/util/lockfile_spec.rb +76 -0
- data/spec/unit/util/log/destinations_spec.rb +11 -28
- data/spec/unit/util/log_spec.rb +6 -6
- data/spec/unit/util/logging_spec.rb +43 -11
- data/spec/unit/util/metric_spec.rb +4 -3
- data/spec/unit/util/monkey_patches/lines_spec.rb +83 -0
- data/spec/unit/util/monkey_patches_spec.rb +91 -28
- data/spec/unit/util/nagios_maker_spec.rb +1 -1
- data/spec/unit/util/network_device/cisco/device_spec.rb +3 -3
- data/spec/unit/util/network_device/cisco/facts_spec.rb +1 -1
- data/spec/unit/util/network_device/cisco/interface_spec.rb +1 -1
- data/spec/unit/util/network_device/config_spec.rb +1 -1
- data/spec/unit/util/network_device/ipcalc_spec.rb +1 -1
- data/spec/unit/util/network_device/transport/base_spec.rb +1 -1
- data/spec/unit/util/network_device/transport/ssh_spec.rb +2 -2
- data/spec/unit/util/network_device/transport/telnet_spec.rb +1 -1
- data/spec/unit/util/network_device_spec.rb +1 -1
- data/spec/unit/util/package_spec.rb +1 -1
- data/spec/unit/util/pidlock_spec.rb +179 -0
- data/spec/unit/util/posix_spec.rb +2 -2
- data/spec/unit/util/pson_spec.rb +23 -9
- data/spec/unit/util/queue/stomp_spec.rb +10 -13
- data/spec/unit/util/queue_spec.rb +2 -2
- data/spec/unit/util/rdoc/parser_spec.rb +11 -9
- data/spec/unit/util/rdoc_spec.rb +9 -3
- data/spec/unit/util/reference_serializer_spec.rb +1 -1
- data/spec/unit/util/reference_spec.rb +1 -1
- data/spec/unit/util/resource_template_spec.rb +1 -1
- data/spec/unit/util/retryaction_spec.rb +1 -1
- data/spec/unit/util/rubygems_spec.rb +66 -0
- data/spec/unit/util/run_mode_spec.rb +4 -9
- data/spec/unit/util/selinux_spec.rb +33 -25
- data/spec/unit/util/storage_spec.rb +2 -18
- data/spec/unit/util/suidmanager_spec.rb +11 -4
- data/spec/unit/util/symbolic_file_mode_spec.rb +1 -1
- data/spec/unit/util/tagging_spec.rb +1 -1
- data/spec/unit/util/terminal_spec.rb +1 -1
- data/spec/unit/util/user_attr_spec.rb +1 -1
- data/spec/unit/util/warnings_spec.rb +1 -1
- data/spec/unit/util/windows/registry_spec.rb +86 -0
- data/spec/unit/util/zaml_spec.rb +30 -146
- data/spec/unit/util_spec.rb +148 -440
- data/spec/watchr.rb +6 -2
- data/tasks/rake/apple.rake +176 -0
- data/tasks/rake/gem.rake +6 -5
- data/tasks/rake/manpages.rake +8 -1
- data/tasks/rake/metrics.rake +11 -3
- data/tasks/rake/parser.rake +5 -0
- data/{ext/osx → tasks/rake/templates}/prototype.plist.erb +0 -0
- metadata +293 -580
- data/bin/filebucket +0 -7
- data/bin/pi +0 -5
- data/bin/puppetca +0 -4
- data/bin/puppetd +0 -4
- data/bin/puppetdoc +0 -4
- data/bin/puppetmasterd +0 -4
- data/bin/puppetqd +0 -4
- data/bin/puppetrun +0 -5
- data/bin/ralsh +0 -4
- data/ext/build_defaults.yaml +0 -19
- data/ext/debian/README.Debian +0 -8
- data/ext/debian/README.source +0 -2
- data/ext/debian/TODO.Debian +0 -1
- data/ext/debian/changelog.erb +0 -1104
- data/ext/debian/compat +0 -1
- data/ext/debian/control +0 -142
- data/ext/debian/copyright +0 -361
- data/ext/debian/docs +0 -1
- data/ext/debian/fileserver.conf +0 -17
- data/ext/debian/puppet-common.dirs +0 -8
- data/ext/debian/puppet-common.install +0 -3
- data/ext/debian/puppet-common.lintian-overrides +0 -7
- data/ext/debian/puppet-common.manpages +0 -2
- data/ext/debian/puppet-common.postinst +0 -35
- data/ext/debian/puppet-common.postrm +0 -32
- data/ext/debian/puppet-el.dirs +0 -1
- data/ext/debian/puppet-el.emacsen-install +0 -25
- data/ext/debian/puppet-el.emacsen-remove +0 -11
- data/ext/debian/puppet-el.emacsen-startup +0 -9
- data/ext/debian/puppet-el.install +0 -1
- data/ext/debian/puppet-testsuite.install +0 -3
- data/ext/debian/puppet-testsuite.lintian-overrides +0 -4
- data/ext/debian/puppet.NEWS +0 -86
- data/ext/debian/puppet.conf +0 -14
- data/ext/debian/puppet.default +0 -7
- data/ext/debian/puppet.dirs +0 -1
- data/ext/debian/puppet.init +0 -118
- data/ext/debian/puppet.install +0 -4
- data/ext/debian/puppet.lintian-overrides +0 -3
- data/ext/debian/puppet.logrotate +0 -11
- data/ext/debian/puppet.manpages +0 -36
- data/ext/debian/puppet.postinst +0 -20
- data/ext/debian/puppet.postrm +0 -20
- data/ext/debian/puppet.preinst +0 -20
- data/ext/debian/puppetmaster-common.install +0 -5
- data/ext/debian/puppetmaster-common.manpages +0 -5
- data/ext/debian/puppetmaster-common.puppetqd.default +0 -27
- data/ext/debian/puppetmaster-common.puppetqd.init +0 -84
- data/ext/debian/puppetmaster-passenger.dirs +0 -4
- data/ext/debian/puppetmaster-passenger.postinst +0 -66
- data/ext/debian/puppetmaster-passenger.postrm +0 -33
- data/ext/debian/puppetmaster.NEWS +0 -13
- data/ext/debian/puppetmaster.README.debian +0 -16
- data/ext/debian/puppetmaster.default +0 -38
- data/ext/debian/puppetmaster.dirs +0 -1
- data/ext/debian/puppetmaster.init +0 -158
- data/ext/debian/puppetmaster.install +0 -1
- data/ext/debian/puppetmaster.lintian-overrides +0 -3
- data/ext/debian/puppetmaster.manpages +0 -1
- data/ext/debian/puppetmaster.postinst +0 -20
- data/ext/debian/puppetmaster.postrm +0 -5
- data/ext/debian/puppetmaster.preinst +0 -22
- data/ext/debian/rules +0 -127
- data/ext/debian/source/format +0 -1
- data/ext/debian/source/options +0 -1
- data/ext/debian/vim-puppet.README.Debian +0 -13
- data/ext/debian/vim-puppet.dirs +0 -3
- data/ext/debian/vim-puppet.yaml +0 -5
- data/ext/debian/watch +0 -2
- data/ext/osx/file_mapping.yaml +0 -38
- data/ext/osx/preflight.erb +0 -37
- data/ext/packaging/Gemfile +0 -8
- data/ext/packaging/Gemfile.lock +0 -28
- data/ext/packaging/LICENSE +0 -17
- data/ext/packaging/README-Solaris.md +0 -117
- data/ext/packaging/README.md +0 -1074
- data/ext/packaging/lib/packaging.rb +0 -21
- data/ext/packaging/lib/packaging/config.rb +0 -277
- data/ext/packaging/lib/packaging/config/params.rb +0 -175
- data/ext/packaging/lib/packaging/tar.rb +0 -186
- data/ext/packaging/lib/packaging/util.rb +0 -44
- data/ext/packaging/lib/packaging/util/date.rb +0 -15
- data/ext/packaging/lib/packaging/util/file.rb +0 -60
- data/ext/packaging/lib/packaging/util/jira.rb +0 -83
- data/ext/packaging/lib/packaging/util/net.rb +0 -16
- data/ext/packaging/lib/packaging/util/rake_utils.rb +0 -57
- data/ext/packaging/lib/packaging/util/serialization.rb +0 -19
- data/ext/packaging/lib/packaging/util/tool.rb +0 -30
- data/ext/packaging/lib/packaging/util/version.rb +0 -300
- data/ext/packaging/packaging.rake +0 -50
- data/ext/packaging/spec/fixtures/config/ext/build_defaults.yaml +0 -2
- data/ext/packaging/spec/fixtures/config/ext/project_data.yaml +0 -2
- data/ext/packaging/spec/fixtures/config/params.yaml +0 -2
- data/ext/packaging/spec/fixtures/util/pre_tasks.yaml +0 -4
- data/ext/packaging/spec/lib/packaging/config_spec.rb +0 -330
- data/ext/packaging/spec/lib/packaging/tar_spec.rb +0 -122
- data/ext/packaging/spec/lib/packaging/util/file_spec.rb +0 -48
- data/ext/packaging/spec/lib/packaging/util/jira_spec.rb +0 -50
- data/ext/packaging/spec/lib/packaging/util/net_spec.rb +0 -23
- data/ext/packaging/spec/lib/packaging/util/rake_utils_spec.rb +0 -70
- data/ext/packaging/spec/lib/packaging/util/version_spec.rb +0 -67
- data/ext/packaging/spec/lib/packaging_spec.rb +0 -19
- data/ext/packaging/spec/spec_helper.rb +0 -22
- data/ext/packaging/spec/tasks/00_utils_spec.rb +0 -248
- data/ext/packaging/static_artifacts/PackageInfo.plist +0 -3
- data/ext/packaging/tasks/00_utils.rake +0 -402
- data/ext/packaging/tasks/30_metrics.rake +0 -33
- data/ext/packaging/tasks/apple.rake +0 -267
- data/ext/packaging/tasks/build.rake +0 -12
- data/ext/packaging/tasks/clean.rake +0 -5
- data/ext/packaging/tasks/deb.rake +0 -127
- data/ext/packaging/tasks/deb_repos.rake +0 -128
- data/ext/packaging/tasks/doc.rake +0 -20
- data/ext/packaging/tasks/fetch.rake +0 -58
- data/ext/packaging/tasks/gem.rake +0 -158
- data/ext/packaging/tasks/ips.rake +0 -122
- data/ext/packaging/tasks/jenkins.rake +0 -360
- data/ext/packaging/tasks/jenkins_dynamic.rake +0 -123
- data/ext/packaging/tasks/load_extras.rake +0 -21
- data/ext/packaging/tasks/mock.rake +0 -290
- data/ext/packaging/tasks/pe_deb.rake +0 -12
- data/ext/packaging/tasks/pe_remote.rake +0 -41
- data/ext/packaging/tasks/pe_rpm.rake +0 -13
- data/ext/packaging/tasks/pe_ship.rake +0 -179
- data/ext/packaging/tasks/pe_sign.rake +0 -47
- data/ext/packaging/tasks/pe_tar.rake +0 -5
- data/ext/packaging/tasks/release.rake +0 -91
- data/ext/packaging/tasks/remote_build.rake +0 -158
- data/ext/packaging/tasks/retrieve.rake +0 -45
- data/ext/packaging/tasks/rpm.rake +0 -71
- data/ext/packaging/tasks/rpm_repos.rake +0 -139
- data/ext/packaging/tasks/ship.rake +0 -192
- data/ext/packaging/tasks/sign.rake +0 -164
- data/ext/packaging/tasks/tag.rake +0 -8
- data/ext/packaging/tasks/tar.rake +0 -34
- data/ext/packaging/tasks/tickets.rake +0 -449
- data/ext/packaging/tasks/update.rake +0 -16
- data/ext/packaging/tasks/vendor_gems.rake +0 -110
- data/ext/packaging/tasks/version.rake +0 -33
- data/ext/packaging/tasks/z_data_dump.rake +0 -65
- data/ext/packaging/templates/README +0 -1
- data/ext/packaging/templates/downstream.xml.erb +0 -45
- data/ext/packaging/templates/packaging.xml.erb +0 -330
- data/ext/packaging/templates/repo.xml.erb +0 -106
- data/ext/project_data.yaml +0 -24
- data/lib/puppet/file_system.rb +0 -3
- data/lib/puppet/file_system/path_pattern.rb +0 -97
- data/lib/puppet/indirector/certificate/disabled_ca.rb +0 -22
- data/lib/puppet/indirector/certificate_request/disabled_ca.rb +0 -22
- data/lib/puppet/indirector/certificate_revocation_list/disabled_ca.rb +0 -22
- data/lib/puppet/indirector/errors.rb +0 -5
- data/lib/puppet/indirector/inventory/yaml.rb +0 -81
- data/lib/puppet/indirector/key/disabled_ca.rb +0 -22
- data/lib/puppet/indirector/resource/validator.rb +0 -8
- data/lib/puppet/network/handler.rb +0 -50
- data/lib/puppet/network/handler/ca.rb +0 -61
- data/lib/puppet/network/handler/filebucket.rb +0 -53
- data/lib/puppet/network/handler/fileserver.rb +0 -732
- data/lib/puppet/network/handler/master.rb +0 -87
- data/lib/puppet/network/handler/report.rb +0 -82
- data/lib/puppet/network/handler/runner.rb +0 -33
- data/lib/puppet/network/handler/status.rb +0 -18
- data/lib/puppet/network/http/rack/xmlrpc.rb +0 -65
- data/lib/puppet/network/http_server.rb +0 -3
- data/lib/puppet/network/http_server/mongrel.rb +0 -129
- data/lib/puppet/network/rest_authconfig.rb +0 -102
- data/lib/puppet/network/rest_authorization.rb +0 -23
- data/lib/puppet/network/xmlrpc/processor.rb +0 -86
- data/lib/puppet/network/xmlrpc/server.rb +0 -19
- data/lib/puppet/network/xmlrpc/webrick_servlet.rb +0 -114
- data/lib/puppet/node/inventory.rb +0 -7
- data/lib/puppet/reference/network.rb +0 -39
- data/lib/puppet/transportable.rb +0 -248
- data/lib/puppet/util/autoload/file_cache.rb +0 -92
- data/lib/puppet/util/file_locking.rb +0 -47
- data/lib/puppet/util/settings.rb +0 -926
- data/lib/puppet/util/settings/setting.rb +0 -94
- data/lib/puppet/util/windows/sid.rb +0 -96
- data/lib/puppet/vendor.rb +0 -55
- data/lib/puppet/vendor/load_safe_yaml.rb +0 -1
- data/lib/puppet/vendor/require_vendored.rb +0 -4
- data/lib/puppet/vendor/safe_yaml/CHANGES.md +0 -104
- data/lib/puppet/vendor/safe_yaml/Gemfile +0 -11
- data/lib/puppet/vendor/safe_yaml/LICENSE.txt +0 -22
- data/lib/puppet/vendor/safe_yaml/README.md +0 -179
- data/lib/puppet/vendor/safe_yaml/Rakefile +0 -6
- data/lib/puppet/vendor/safe_yaml/lib/safe_yaml.rb +0 -253
- data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/deep.rb +0 -34
- data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/parse/date.rb +0 -27
- data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/parse/hexadecimal.rb +0 -12
- data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/parse/sexagesimal.rb +0 -26
- data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/psych_handler.rb +0 -92
- data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/psych_resolver.rb +0 -52
- data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/resolver.rb +0 -94
- data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/safe_to_ruby_visitor.rb +0 -17
- data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/syck_hack.rb +0 -36
- data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/syck_node_monkeypatch.rb +0 -43
- data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/syck_resolver.rb +0 -38
- data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/transform.rb +0 -41
- data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/transform/to_boolean.rb +0 -21
- data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/transform/to_date.rb +0 -11
- data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/transform/to_float.rb +0 -33
- data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/transform/to_integer.rb +0 -25
- data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/transform/to_nil.rb +0 -18
- data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/transform/to_symbol.rb +0 -13
- data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/transform/transformation_map.rb +0 -47
- data/lib/puppet/vendor/safe_yaml/lib/safe_yaml/version.rb +0 -3
- data/lib/puppet/vendor/safe_yaml/run_specs_all_ruby_versions.sh +0 -21
- data/lib/puppet/vendor/safe_yaml/safe_yaml.gemspec +0 -18
- data/lib/puppet/vendor/safe_yaml/spec/exploit.1.9.2.yaml +0 -2
- data/lib/puppet/vendor/safe_yaml/spec/exploit.1.9.3.yaml +0 -2
- data/lib/puppet/vendor/safe_yaml/spec/psych_resolver_spec.rb +0 -10
- data/lib/puppet/vendor/safe_yaml/spec/resolver_specs.rb +0 -250
- data/lib/puppet/vendor/safe_yaml/spec/safe_yaml_spec.rb +0 -702
- data/lib/puppet/vendor/safe_yaml/spec/spec_helper.rb +0 -18
- data/lib/puppet/vendor/safe_yaml/spec/support/exploitable_back_door.rb +0 -29
- data/lib/puppet/vendor/safe_yaml/spec/syck_resolver_spec.rb +0 -10
- data/lib/puppet/vendor/safe_yaml/spec/transform/base64_spec.rb +0 -11
- data/lib/puppet/vendor/safe_yaml/spec/transform/to_date_spec.rb +0 -34
- data/lib/puppet/vendor/safe_yaml/spec/transform/to_float_spec.rb +0 -42
- data/lib/puppet/vendor/safe_yaml/spec/transform/to_integer_spec.rb +0 -59
- data/lib/puppet/vendor/safe_yaml/spec/transform/to_symbol_spec.rb +0 -49
- data/man/man8/filebucket.8 +0 -81
- data/man/man8/pi.8 +0 -51
- data/man/man8/puppetca.8 +0 -97
- data/man/man8/puppetd.8 +0 -154
- data/man/man8/puppetdoc.8 +0 -113
- data/man/man8/puppetmasterd.8 +0 -78
- data/man/man8/puppetqd.8 +0 -55
- data/man/man8/puppetrun.8 +0 -127
- data/man/man8/ralsh.8 +0 -84
- data/spec/integration/network/handler_spec.rb +0 -24
- data/spec/integration/network/rest_authconfig_spec.rb +0 -164
- data/spec/integration/util/file_locking_spec.rb +0 -56
- data/spec/unit/agent_backward_compatibility_spec.rb +0 -152
- data/spec/unit/file_system/path_pattern_spec.rb +0 -139
- data/spec/unit/indirector/catalog/static_compiler_spec.rb +0 -194
- data/spec/unit/indirector/certificate/disabled_ca_spec.rb +0 -33
- data/spec/unit/indirector/certificate_request/disabled_ca_spec.rb +0 -33
- data/spec/unit/indirector/certificate_revocation_list/disabled_ca_spec.rb +0 -33
- data/spec/unit/indirector/inventory/yaml_spec.rb +0 -220
- data/spec/unit/indirector/key/disabled_ca_spec.rb +0 -33
- data/spec/unit/network/handler/ca_spec.rb +0 -87
- data/spec/unit/network/handler/fileserver_spec.rb +0 -201
- data/spec/unit/network/http/mongrel/xmlrpc_spec.rb +0 -0
- data/spec/unit/network/http/rack/xmlrpc_spec.rb +0 -155
- data/spec/unit/network/http/webrick/xmlrpc_spec.rb +0 -0
- data/spec/unit/network/rest_authconfig_spec.rb +0 -142
- data/spec/unit/other/transbucket_spec.rb +0 -184
- data/spec/unit/other/transobject_spec.rb +0 -111
- data/spec/unit/provider/zfs/solaris_spec.rb +0 -99
- data/spec/unit/provider/zpool/solaris_spec.rb +0 -208
- data/spec/unit/transportable_spec.rb +0 -0
- data/spec/unit/util/autoload/file_cache_spec.rb +0 -158
- data/spec/unit/util/file_locking_spec.rb +0 -159
- data/spec/unit/util/settings_spec.rb +0 -1088
- data/spec/unit/util/windows/sid_spec.rb +0 -100
- data/test/README +0 -24
- data/test/Rakefile +0 -96
- data/test/data/failers/badclassnoparam +0 -10
- data/test/data/failers/badclassparam +0 -10
- data/test/data/failers/badcompnoparam +0 -9
- data/test/data/failers/badcompparam +0 -9
- data/test/data/failers/badtypeparam +0 -3
- data/test/data/failers/noobjectrvalue +0 -1
- data/test/data/providers/cron/crontab.allthree +0 -17
- data/test/data/providers/cron/crontab.envNcomment +0 -12
- data/test/data/providers/cron/crontab.envNname +0 -11
- data/test/data/providers/cron/crontab.multirecords +0 -12
- data/test/data/providers/cron/crontab_collections.yaml +0 -44
- data/test/data/providers/cron/crontab_multiple_with_env.yaml +0 -54
- data/test/data/providers/cron/examples/freebsd +0 -2
- data/test/data/providers/cron/examples/one +0 -14
- data/test/data/providers/cron/examples/openbsd +0 -20
- data/test/data/providers/host/parsed/valid_hosts +0 -19
- data/test/data/providers/mailalias/aliases/test1 +0 -28
- data/test/data/providers/mount/parsed/aix.mount +0 -7
- data/test/data/providers/mount/parsed/darwin.mount +0 -6
- data/test/data/providers/mount/parsed/hpux.mount +0 -17
- data/test/data/providers/mount/parsed/linux.mount +0 -5
- data/test/data/providers/mount/parsed/solaris.mount +0 -6
- data/test/data/providers/package/testpackages.yaml +0 -65
- data/test/data/providers/ssh_authorized_key/parsed/authorized_keys +0 -7
- data/test/data/providers/ssh_authorized_key/parsed/authorized_keys1 +0 -3
- data/test/data/providers/ssh_authorized_key/parsed/authorized_keys2 +0 -1
- data/test/data/reports/1.yaml +0 -108
- data/test/data/reports/2.yaml +0 -108
- data/test/data/reports/tagmail_failers.conf +0 -3
- data/test/data/reports/tagmail_passers.conf +0 -30
- data/test/data/snippets/aliastest.pp +0 -16
- data/test/data/snippets/append.pp +0 -11
- data/test/data/snippets/argumentdefaults +0 -14
- data/test/data/snippets/arithmetic_expression.pp +0 -8
- data/test/data/snippets/arraytrailingcomma.pp +0 -3
- data/test/data/snippets/casestatement.pp +0 -65
- data/test/data/snippets/classheirarchy.pp +0 -15
- data/test/data/snippets/classincludes.pp +0 -17
- data/test/data/snippets/classpathtest +0 -11
- data/test/data/snippets/collection.pp +0 -10
- data/test/data/snippets/collection_override.pp +0 -8
- data/test/data/snippets/collection_within_virtual_definitions.pp +0 -20
- data/test/data/snippets/componentmetaparams.pp +0 -11
- data/test/data/snippets/componentrequire.pp +0 -8
- data/test/data/snippets/deepclassheirarchy.pp +0 -23
- data/test/data/snippets/defineoverrides.pp +0 -17
- data/test/data/snippets/emptyclass.pp +0 -9
- data/test/data/snippets/emptyexec.pp +0 -3
- data/test/data/snippets/emptyifelse.pp +0 -9
- data/test/data/snippets/falsevalues.pp +0 -3
- data/test/data/snippets/filecreate +0 -11
- data/test/data/snippets/fqdefinition.pp +0 -5
- data/test/data/snippets/fqparents.pp +0 -11
- data/test/data/snippets/funccomma.pp +0 -5
- data/test/data/snippets/hash.pp +0 -33
- data/test/data/snippets/ifexpression.pp +0 -12
- data/test/data/snippets/implicititeration +0 -15
- data/test/data/snippets/multilinecomments.pp +0 -10
- data/test/data/snippets/multipleclass.pp +0 -9
- data/test/data/snippets/multipleinstances +0 -7
- data/test/data/snippets/multisubs.pp +0 -13
- data/test/data/snippets/namevartest +0 -9
- data/test/data/snippets/scopetest +0 -13
- data/test/data/snippets/selectorvalues.pp +0 -49
- data/test/data/snippets/simpledefaults +0 -5
- data/test/data/snippets/simpleselector +0 -38
- data/test/data/snippets/singleary.pp +0 -19
- data/test/data/snippets/singlequote.pp +0 -11
- data/test/data/snippets/singleselector.pp +0 -22
- data/test/data/snippets/subclass_name_duplication.pp +0 -11
- data/test/data/snippets/tag.pp +0 -9
- data/test/data/snippets/tagged.pp +0 -35
- data/test/data/snippets/virtualresources.pp +0 -14
- data/test/data/types/hosts/1 +0 -3
- data/test/data/types/hosts/2 +0 -13
- data/test/data/types/hosts/solaris +0 -5
- data/test/data/types/mailalias/file1 +0 -183
- data/test/data/types/mount/freebsd.fstab +0 -7
- data/test/data/types/mount/linux.fstab +0 -12
- data/test/data/types/mount/solaris.fstab +0 -12
- data/test/data/types/port/1 +0 -533
- data/test/data/types/port/darwin +0 -11866
- data/test/data/types/ssh_authorized_key/1 +0 -2
- data/test/data/types/yumrepos/fedora-devel.repo +0 -26
- data/test/data/types/yumrepos/fedora.repo +0 -9
- data/test/language/ast.rb +0 -90
- data/test/language/ast/variable.rb +0 -25
- data/test/language/functions.rb +0 -540
- data/test/language/parser.rb +0 -739
- data/test/language/scope.rb +0 -261
- data/test/language/snippets.rb +0 -512
- data/test/language/transportable.rb +0 -87
- data/test/lib/puppettest.rb +0 -307
- data/test/lib/puppettest/certificates.rb +0 -74
- data/test/lib/puppettest/exetest.rb +0 -125
- data/test/lib/puppettest/fakes.rb +0 -199
- data/test/lib/puppettest/fileparsing.rb +0 -28
- data/test/lib/puppettest/filetesting.rb +0 -221
- data/test/lib/puppettest/parsertesting.rb +0 -424
- data/test/lib/puppettest/railstesting.rb +0 -18
- data/test/lib/puppettest/reporttesting.rb +0 -16
- data/test/lib/puppettest/resourcetesting.rb +0 -54
- data/test/lib/puppettest/runnable_test.rb +0 -43
- data/test/lib/puppettest/servertest.rb +0 -77
- data/test/lib/puppettest/support.rb +0 -8
- data/test/lib/puppettest/support/assertions.rb +0 -69
- data/test/lib/puppettest/support/helpers.rb +0 -18
- data/test/lib/puppettest/support/resources.rb +0 -31
- data/test/lib/puppettest/support/utils.rb +0 -141
- data/test/lib/puppettest/testcase.rb +0 -24
- data/test/lib/rake/puppet_test_loader.rb +0 -14
- data/test/lib/rake/puppet_testtask.rb +0 -19
- data/test/lib/stubba.rb +0 -2
- data/test/network/authconfig.rb +0 -69
- data/test/network/authorization.rb +0 -138
- data/test/network/authstore.rb +0 -538
- data/test/network/client_request.rb +0 -38
- data/test/network/handler/fileserver.rb +0 -1266
- data/test/network/handler/master.rb +0 -93
- data/test/network/handler/report.rb +0 -47
- data/test/network/handler/runner.rb +0 -20
- data/test/network/rights.rb +0 -40
- data/test/network/xmlrpc/processor.rb +0 -79
- data/test/network/xmlrpc/server.rb +0 -26
- data/test/network/xmlrpc/webrick_servlet.rb +0 -35
- data/test/other/provider.rb +0 -90
- data/test/other/puppet.rb +0 -85
- data/test/other/relationships.rb +0 -91
- data/test/other/report.rb +0 -135
- data/test/other/transactions.rb +0 -395
- data/test/puppet/defaults.rb +0 -65
- data/test/rails/rails.rb +0 -24
- data/test/rails/railsparameter.rb +0 -80
- data/test/ral/manager/attributes.rb +0 -296
- data/test/ral/manager/instances.rb +0 -88
- data/test/ral/manager/manager.rb +0 -50
- data/test/ral/manager/provider.rb +0 -84
- data/test/ral/manager/type.rb +0 -361
- data/test/ral/providers/cron/crontab.rb +0 -652
- data/test/ral/providers/group.rb +0 -242
- data/test/ral/providers/host/parsed.rb +0 -32
- data/test/ral/providers/mailalias/aliases.rb +0 -55
- data/test/ral/providers/nameservice.rb +0 -32
- data/test/ral/providers/package.rb +0 -245
- data/test/ral/providers/package/aptitude.rb +0 -83
- data/test/ral/providers/package/aptrpm.rb +0 -100
- data/test/ral/providers/parsedfile.rb +0 -695
- data/test/ral/providers/port/parsed.rb +0 -232
- data/test/ral/providers/provider.rb +0 -529
- data/test/ral/providers/service/base.rb +0 -76
- data/test/ral/providers/sshkey/parsed.rb +0 -112
- data/test/ral/providers/user.rb +0 -586
- data/test/ral/providers/user/useradd.rb +0 -233
- data/test/ral/type/cron.rb +0 -505
- data/test/ral/type/exec.rb +0 -717
- data/test/ral/type/file.rb +0 -912
- data/test/ral/type/file/target.rb +0 -346
- data/test/ral/type/fileignoresource.rb +0 -265
- data/test/ral/type/filesources.rb +0 -446
- data/test/ral/type/host.rb +0 -180
- data/test/ral/type/mailalias.rb +0 -45
- data/test/ral/type/port.rb +0 -147
- data/test/ral/type/resources.rb +0 -104
- data/test/ral/type/service.rb +0 -38
- data/test/ral/type/sshkey.rb +0 -148
- data/test/ral/type/user.rb +0 -167
- data/test/ral/type/yumrepo.rb +0 -116
- data/test/ral/type/zone.rb +0 -447
- data/test/test +0 -241
- data/test/util/classgen.rb +0 -241
- data/test/util/execution.rb +0 -33
- data/test/util/fileparsing.rb +0 -721
- data/test/util/inifile.rb +0 -138
- data/test/util/instance_loader.rb +0 -52
- data/test/util/log.rb +0 -219
- data/test/util/metrics.rb +0 -72
- data/test/util/package.rb +0 -25
- data/test/util/pidlock.rb +0 -125
- data/test/util/settings.rb +0 -773
- data/test/util/storage.rb +0 -81
- data/test/util/subclass_loader.rb +0 -89
- data/test/util/utiltest.rb +0 -223
@@ -9,6 +9,7 @@ class Puppet::Resource::TypeCollection
|
|
9
9
|
@definitions.clear
|
10
10
|
@nodes.clear
|
11
11
|
@watched_files.clear
|
12
|
+
@notfound.clear
|
12
13
|
end
|
13
14
|
|
14
15
|
def initialize(env)
|
@@ -16,6 +17,7 @@ class Puppet::Resource::TypeCollection
|
|
16
17
|
@hostclasses = {}
|
17
18
|
@definitions = {}
|
18
19
|
@nodes = {}
|
20
|
+
@notfound = {}
|
19
21
|
|
20
22
|
# So we can keep a list and match the first-defined regex
|
21
23
|
@node_list = []
|
@@ -109,8 +111,8 @@ class Puppet::Resource::TypeCollection
|
|
109
111
|
@nodes[munge_name(name)]
|
110
112
|
end
|
111
113
|
|
112
|
-
def find_hostclass(namespaces, name)
|
113
|
-
find_or_load(namespaces, name, :hostclass)
|
114
|
+
def find_hostclass(namespaces, name, options = {})
|
115
|
+
find_or_load(namespaces, name, :hostclass, options)
|
114
116
|
end
|
115
117
|
|
116
118
|
def find_definition(namespaces, name)
|
@@ -139,7 +141,7 @@ class Puppet::Resource::TypeCollection
|
|
139
141
|
return @version
|
140
142
|
end
|
141
143
|
|
142
|
-
@version = Puppet::Util.execute([environment[:config_version]]).strip
|
144
|
+
@version = Puppet::Util::Execution.execute([environment[:config_version]]).strip
|
143
145
|
|
144
146
|
rescue Puppet::ExecutionFailure => e
|
145
147
|
raise Puppet::ParseError, "Unable to set config_version: #{e.message}"
|
@@ -192,14 +194,21 @@ class Puppet::Resource::TypeCollection
|
|
192
194
|
|
193
195
|
# Resolve namespaces and find the given object. Autoload it if
|
194
196
|
# necessary.
|
195
|
-
def find_or_load(namespaces, name, type)
|
196
|
-
resolve_namespaces(namespaces, name)
|
197
|
-
|
198
|
-
|
197
|
+
def find_or_load(namespaces, name, type, options = {})
|
198
|
+
searchspace = options[:assume_fqname] ? [name].flatten : resolve_namespaces(namespaces, name)
|
199
|
+
searchspace.each do |fqname|
|
200
|
+
result = send(type, fqname)
|
201
|
+
unless result
|
202
|
+
# do not try to autoload if we already tried and it wasn't conclusive
|
203
|
+
# as this is a time consuming operation.
|
204
|
+
unless @notfound[fqname]
|
205
|
+
result = loader.try_load_fqname(type, fqname)
|
206
|
+
@notfound[fqname] = result.nil?
|
207
|
+
end
|
199
208
|
end
|
209
|
+
return result if result
|
200
210
|
end
|
201
211
|
|
202
|
-
# Nothing found.
|
203
212
|
return nil
|
204
213
|
end
|
205
214
|
|
data/lib/puppet/run.rb
CHANGED
@@ -3,7 +3,7 @@ require 'puppet/configurer'
|
|
3
3
|
require 'puppet/indirector'
|
4
4
|
|
5
5
|
# A basic class for running the agent. Used by
|
6
|
-
#
|
6
|
+
# `puppet kick` to kick off agents remotely.
|
7
7
|
class Puppet::Run
|
8
8
|
extend Puppet::Indirector
|
9
9
|
indirects :run, :terminus_class => :local
|
@@ -32,17 +32,6 @@ class Puppet::Run
|
|
32
32
|
@options = options
|
33
33
|
end
|
34
34
|
|
35
|
-
def initialize_from_hash(hash)
|
36
|
-
@options = {}
|
37
|
-
|
38
|
-
hash['options'].each do |key, value|
|
39
|
-
@options[key.to_sym] = value
|
40
|
-
end
|
41
|
-
|
42
|
-
@background = hash['background']
|
43
|
-
@status = hash['status']
|
44
|
-
end
|
45
|
-
|
46
35
|
def log_run
|
47
36
|
msg = ""
|
48
37
|
msg += "triggered run" % if options[:tags]
|
@@ -73,20 +62,9 @@ class Puppet::Run
|
|
73
62
|
self
|
74
63
|
end
|
75
64
|
|
76
|
-
def self.
|
77
|
-
|
78
|
-
|
79
|
-
obj
|
80
|
-
end
|
81
|
-
|
82
|
-
def self.from_pson(hash)
|
83
|
-
if hash['options']
|
84
|
-
return from_hash(hash)
|
85
|
-
end
|
86
|
-
|
87
|
-
options = {}
|
88
|
-
|
89
|
-
hash.each do |key, value|
|
65
|
+
def self.from_pson( pson )
|
66
|
+
options = { :pluginsync => Puppet[:pluginsync] }
|
67
|
+
pson.each do |key, value|
|
90
68
|
options[key.to_sym] = value
|
91
69
|
end
|
92
70
|
|
@@ -0,0 +1,1315 @@
|
|
1
|
+
require 'puppet'
|
2
|
+
require 'sync'
|
3
|
+
require 'getoptlong'
|
4
|
+
require 'puppet/util/loadedfile'
|
5
|
+
require 'puppet/util/command_line/puppet_option_parser'
|
6
|
+
require 'puppet/settings/errors'
|
7
|
+
require 'puppet/settings/string_setting'
|
8
|
+
require 'puppet/settings/file_setting'
|
9
|
+
require 'puppet/settings/directory_setting'
|
10
|
+
require 'puppet/settings/path_setting'
|
11
|
+
require 'puppet/settings/boolean_setting'
|
12
|
+
|
13
|
+
# The class for handling configuration files.
|
14
|
+
class Puppet::Settings
|
15
|
+
include Enumerable
|
16
|
+
|
17
|
+
# local reference for convenience
|
18
|
+
PuppetOptionParser = Puppet::Util::CommandLine::PuppetOptionParser
|
19
|
+
|
20
|
+
attr_accessor :files
|
21
|
+
attr_reader :timer
|
22
|
+
|
23
|
+
READ_ONLY_SETTINGS = [:run_mode]
|
24
|
+
|
25
|
+
# These are the settings that every app is required to specify; there are reasonable defaults defined in application.rb.
|
26
|
+
REQUIRED_APP_SETTINGS = [:run_mode, :logdir, :confdir, :vardir]
|
27
|
+
|
28
|
+
# This method is intended for puppet internal use only; it is a convenience method that
|
29
|
+
# returns reasonable application default settings values for a given run_mode.
|
30
|
+
def self.app_defaults_for_run_mode(run_mode)
|
31
|
+
{
|
32
|
+
:name => run_mode.to_s,
|
33
|
+
:run_mode => run_mode.name,
|
34
|
+
:confdir => run_mode.conf_dir,
|
35
|
+
:vardir => run_mode.var_dir,
|
36
|
+
:rundir => run_mode.run_dir,
|
37
|
+
:logdir => run_mode.log_dir,
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
def self.default_certname()
|
42
|
+
hostname = hostname_fact
|
43
|
+
domain = domain_fact
|
44
|
+
if domain and domain != ""
|
45
|
+
fqdn = [hostname, domain].join(".")
|
46
|
+
else
|
47
|
+
fqdn = hostname
|
48
|
+
end
|
49
|
+
fqdn.gsub(/\.$/, '')
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.hostname_fact()
|
53
|
+
Facter["hostname"].value
|
54
|
+
end
|
55
|
+
|
56
|
+
def self.domain_fact()
|
57
|
+
Facter["domain"].value
|
58
|
+
end
|
59
|
+
|
60
|
+
|
61
|
+
def self.default_global_config_dir
|
62
|
+
Puppet.features.microsoft_windows? ? File.join(Dir::COMMON_APPDATA, "PuppetLabs", "puppet", "etc") : "/etc/puppet"
|
63
|
+
end
|
64
|
+
|
65
|
+
def self.default_user_config_dir
|
66
|
+
File.expand_path("~/.puppet")
|
67
|
+
end
|
68
|
+
|
69
|
+
def self.default_global_var_dir
|
70
|
+
Puppet.features.microsoft_windows? ? File.join(Dir::COMMON_APPDATA, "PuppetLabs", "puppet", "var") : "/var/lib/puppet"
|
71
|
+
end
|
72
|
+
|
73
|
+
def self.default_user_var_dir
|
74
|
+
File.expand_path("~/.puppet/var")
|
75
|
+
end
|
76
|
+
|
77
|
+
def self.default_config_file_name
|
78
|
+
"puppet.conf"
|
79
|
+
end
|
80
|
+
|
81
|
+
# Retrieve a config value
|
82
|
+
def [](param)
|
83
|
+
value(param)
|
84
|
+
end
|
85
|
+
|
86
|
+
# Set a config value. This doesn't set the defaults, it sets the value itself.
|
87
|
+
def []=(param, value)
|
88
|
+
set_value(param, value, :memory)
|
89
|
+
end
|
90
|
+
|
91
|
+
# Generate the list of valid arguments, in a format that GetoptLong can
|
92
|
+
# understand, and add them to the passed option list.
|
93
|
+
def addargs(options)
|
94
|
+
# Add all of the config parameters as valid options.
|
95
|
+
self.each { |name, setting|
|
96
|
+
setting.getopt_args.each { |args| options << args }
|
97
|
+
}
|
98
|
+
|
99
|
+
options
|
100
|
+
end
|
101
|
+
|
102
|
+
# Generate the list of valid arguments, in a format that OptionParser can
|
103
|
+
# understand, and add them to the passed option list.
|
104
|
+
def optparse_addargs(options)
|
105
|
+
# Add all of the config parameters as valid options.
|
106
|
+
self.each { |name, setting|
|
107
|
+
options << setting.optparse_args
|
108
|
+
}
|
109
|
+
|
110
|
+
options
|
111
|
+
end
|
112
|
+
|
113
|
+
# Is our parameter a boolean parameter?
|
114
|
+
def boolean?(param)
|
115
|
+
param = param.to_sym
|
116
|
+
@config.include?(param) and @config[param].kind_of?(BooleanSetting)
|
117
|
+
end
|
118
|
+
|
119
|
+
# Remove all set values, potentially skipping cli values.
|
120
|
+
def clear
|
121
|
+
@sync.synchronize do
|
122
|
+
unsafe_clear
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
# Remove all set values, potentially skipping cli values.
|
127
|
+
def unsafe_clear(clear_cli = true, clear_application_defaults = false)
|
128
|
+
@values.each do |name, values|
|
129
|
+
next if ((name == :application_defaults) and !clear_application_defaults)
|
130
|
+
next if ((name == :cli) and !clear_cli)
|
131
|
+
@values.delete(name)
|
132
|
+
end
|
133
|
+
|
134
|
+
# Only clear the 'used' values if we were explicitly asked to clear out
|
135
|
+
# :cli values; otherwise, it may be just a config file reparse,
|
136
|
+
# and we want to retain this cli values.
|
137
|
+
@used = [] if clear_cli
|
138
|
+
|
139
|
+
@app_defaults_initialized = false if clear_application_defaults
|
140
|
+
|
141
|
+
@cache.clear
|
142
|
+
end
|
143
|
+
private :unsafe_clear
|
144
|
+
|
145
|
+
# This is mostly just used for testing.
|
146
|
+
def clearused
|
147
|
+
@cache.clear
|
148
|
+
@used = []
|
149
|
+
end
|
150
|
+
|
151
|
+
def global_defaults_initialized?()
|
152
|
+
@global_defaults_initialized
|
153
|
+
end
|
154
|
+
|
155
|
+
def initialize_global_settings(args = [])
|
156
|
+
raise Puppet::DevError, "Attempting to initialize global default settings more than once!" if global_defaults_initialized?
|
157
|
+
|
158
|
+
# The first two phases of the lifecycle of a puppet application are:
|
159
|
+
# 1) To parse the command line options and handle any of them that are registered, defined "global" puppet
|
160
|
+
# settings (mostly from defaults.rb).)
|
161
|
+
# 2) To parse the puppet config file(s).
|
162
|
+
#
|
163
|
+
# These 2 steps are being handled explicitly here. If there ever arises a situation where they need to be
|
164
|
+
# triggered from outside of this class, without triggering the rest of the lifecycle--we might want to move them
|
165
|
+
# out into a separate method that we call from here. However, this seems to be sufficient for now.
|
166
|
+
# --cprice 2012-03-16
|
167
|
+
|
168
|
+
# Here's step 1.
|
169
|
+
parse_global_options(args)
|
170
|
+
|
171
|
+
# Here's step 2. NOTE: this is a change in behavior where we are now parsing the config file on every run;
|
172
|
+
# before, there were several apps that specifically registered themselves as not requiring anything from
|
173
|
+
# the config file. The fact that we're always parsing it now might be a small performance hit, but it was
|
174
|
+
# necessary in order to make sure that we can resolve the libdir before we look for the available applications.
|
175
|
+
parse_config_files
|
176
|
+
|
177
|
+
@global_defaults_initialized = true
|
178
|
+
end
|
179
|
+
|
180
|
+
# This method is called during application bootstrapping. It is responsible for parsing all of the
|
181
|
+
# command line options and initializing the settings accordingly.
|
182
|
+
#
|
183
|
+
# It will ignore options that are not defined in the global puppet settings list, because they may
|
184
|
+
# be valid options for the specific application that we are about to launch... however, at this point
|
185
|
+
# in the bootstrapping lifecycle, we don't yet know what that application is.
|
186
|
+
def parse_global_options(args)
|
187
|
+
# Create an option parser
|
188
|
+
option_parser = PuppetOptionParser.new
|
189
|
+
option_parser.ignore_invalid_options = true
|
190
|
+
|
191
|
+
# Add all global options to it.
|
192
|
+
self.optparse_addargs([]).each do |option|
|
193
|
+
option_parser.on(*option) do |arg|
|
194
|
+
opt, val = Puppet::Settings.clean_opt(option[0], arg)
|
195
|
+
handlearg(opt, val)
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
option_parser.parse(args)
|
200
|
+
|
201
|
+
end
|
202
|
+
private :parse_global_options
|
203
|
+
|
204
|
+
|
205
|
+
## Private utility method; this is the callback that the OptionParser will use when it finds
|
206
|
+
## an option that was defined in Puppet.settings. All that this method does is a little bit
|
207
|
+
## of clanup to get the option into the exact format that Puppet.settings expects it to be in,
|
208
|
+
## and then passes it along to Puppet.settings.
|
209
|
+
##
|
210
|
+
## @param [String] opt the command-line option that was matched
|
211
|
+
## @param [String, TrueClass, FalseClass] the value for the setting (as determined by the OptionParser)
|
212
|
+
#def handlearg(opt, val)
|
213
|
+
# opt, val = self.class.clean_opt(opt, val)
|
214
|
+
# Puppet.settings.handlearg(opt, val)
|
215
|
+
#end
|
216
|
+
#private :handlearg
|
217
|
+
|
218
|
+
|
219
|
+
# A utility method (public, is used by application.rb and perhaps elsewhere) that munges a command-line
|
220
|
+
# option string into the format that Puppet.settings expects. (This mostly has to deal with handling the
|
221
|
+
# "no-" prefix on flag/boolean options).
|
222
|
+
#
|
223
|
+
# @param [String] opt the command line option that we are munging
|
224
|
+
# @param [String, TrueClass, FalseClass] the value for the setting (as determined by the OptionParser)
|
225
|
+
def self.clean_opt(opt, val)
|
226
|
+
# rewrite --[no-]option to --no-option if that's what was given
|
227
|
+
if opt =~ /\[no-\]/ and !val
|
228
|
+
opt = opt.gsub(/\[no-\]/,'no-')
|
229
|
+
end
|
230
|
+
# otherwise remove the [no-] prefix to not confuse everybody
|
231
|
+
opt = opt.gsub(/\[no-\]/, '')
|
232
|
+
[opt, val]
|
233
|
+
end
|
234
|
+
|
235
|
+
|
236
|
+
def app_defaults_initialized?
|
237
|
+
@app_defaults_initialized
|
238
|
+
end
|
239
|
+
|
240
|
+
def initialize_app_defaults(app_defaults)
|
241
|
+
raise Puppet::DevError, "Attempting to initialize application default settings more than once!" if app_defaults_initialized?
|
242
|
+
REQUIRED_APP_SETTINGS.each do |key|
|
243
|
+
raise SettingsError, "missing required app default setting '#{key}'" unless app_defaults.has_key?(key)
|
244
|
+
end
|
245
|
+
|
246
|
+
app_defaults.each do |key, value|
|
247
|
+
set_value(key, value, :application_defaults)
|
248
|
+
end
|
249
|
+
call_hooks_deferred_to_application_initialization
|
250
|
+
|
251
|
+
@app_defaults_initialized = true
|
252
|
+
end
|
253
|
+
|
254
|
+
def call_hooks_deferred_to_application_initialization(options = {})
|
255
|
+
@hooks_to_call_on_application_initialization.each do |setting|
|
256
|
+
begin
|
257
|
+
setting.handle(self.value(setting.name))
|
258
|
+
rescue InterpolationError => err
|
259
|
+
raise err unless options[:ignore_interpolation_dependency_errors]
|
260
|
+
#swallow. We're not concerned if we can't call hooks because dependencies don't exist yet
|
261
|
+
#we'll get another chance after application defaults are initialized
|
262
|
+
end
|
263
|
+
end
|
264
|
+
end
|
265
|
+
private :call_hooks_deferred_to_application_initialization
|
266
|
+
|
267
|
+
# Do variable interpolation on the value.
|
268
|
+
def convert(value, environment = nil)
|
269
|
+
return nil if value.nil?
|
270
|
+
return value unless value.is_a? String
|
271
|
+
newval = value.gsub(/\$(\w+)|\$\{(\w+)\}/) do |value|
|
272
|
+
varname = $2 || $1
|
273
|
+
if varname == "environment" and environment
|
274
|
+
environment
|
275
|
+
elsif pval = self.value(varname, environment)
|
276
|
+
pval
|
277
|
+
else
|
278
|
+
raise InterpolationError, "Could not find value for #{value}"
|
279
|
+
end
|
280
|
+
end
|
281
|
+
|
282
|
+
newval
|
283
|
+
end
|
284
|
+
|
285
|
+
# Return a value's description.
|
286
|
+
def description(name)
|
287
|
+
if obj = @config[name.to_sym]
|
288
|
+
obj.desc
|
289
|
+
else
|
290
|
+
nil
|
291
|
+
end
|
292
|
+
end
|
293
|
+
|
294
|
+
def each
|
295
|
+
@config.each { |name, object|
|
296
|
+
yield name, object
|
297
|
+
}
|
298
|
+
end
|
299
|
+
|
300
|
+
# Iterate over each section name.
|
301
|
+
def eachsection
|
302
|
+
yielded = []
|
303
|
+
@config.each do |name, object|
|
304
|
+
section = object.section
|
305
|
+
unless yielded.include? section
|
306
|
+
yield section
|
307
|
+
yielded << section
|
308
|
+
end
|
309
|
+
end
|
310
|
+
end
|
311
|
+
|
312
|
+
# Return an object by name.
|
313
|
+
def setting(param)
|
314
|
+
param = param.to_sym
|
315
|
+
@config[param]
|
316
|
+
end
|
317
|
+
|
318
|
+
# Handle a command-line argument.
|
319
|
+
def handlearg(opt, value = nil)
|
320
|
+
@cache.clear
|
321
|
+
|
322
|
+
if value.is_a?(FalseClass)
|
323
|
+
value = "false"
|
324
|
+
elsif value.is_a?(TrueClass)
|
325
|
+
value = "true"
|
326
|
+
end
|
327
|
+
|
328
|
+
value &&= munge_value(value)
|
329
|
+
str = opt.sub(/^--/,'')
|
330
|
+
|
331
|
+
bool = true
|
332
|
+
newstr = str.sub(/^no-/, '')
|
333
|
+
if newstr != str
|
334
|
+
str = newstr
|
335
|
+
bool = false
|
336
|
+
end
|
337
|
+
str = str.intern
|
338
|
+
|
339
|
+
if @config[str].is_a?(Puppet::Settings::BooleanSetting)
|
340
|
+
if value == "" or value.nil?
|
341
|
+
value = bool
|
342
|
+
end
|
343
|
+
end
|
344
|
+
|
345
|
+
set_value(str, value, :cli)
|
346
|
+
end
|
347
|
+
|
348
|
+
def include?(name)
|
349
|
+
name = name.intern if name.is_a? String
|
350
|
+
@config.include?(name)
|
351
|
+
end
|
352
|
+
|
353
|
+
# check to see if a short name is already defined
|
354
|
+
def shortinclude?(short)
|
355
|
+
short = short.intern if name.is_a? String
|
356
|
+
@shortnames.include?(short)
|
357
|
+
end
|
358
|
+
|
359
|
+
# Create a new collection of config settings.
|
360
|
+
def initialize
|
361
|
+
@config = {}
|
362
|
+
@shortnames = {}
|
363
|
+
|
364
|
+
@created = []
|
365
|
+
@searchpath = nil
|
366
|
+
|
367
|
+
# Mutex-like thing to protect @values
|
368
|
+
@sync = Sync.new
|
369
|
+
|
370
|
+
# Keep track of set values.
|
371
|
+
@values = Hash.new { |hash, key| hash[key] = {} }
|
372
|
+
|
373
|
+
# And keep a per-environment cache
|
374
|
+
@cache = Hash.new { |hash, key| hash[key] = {} }
|
375
|
+
|
376
|
+
# The list of sections we've used.
|
377
|
+
@used = []
|
378
|
+
|
379
|
+
@hooks_to_call_on_application_initialization = []
|
380
|
+
end
|
381
|
+
|
382
|
+
# Prints the contents of a config file with the available config settings, or it
|
383
|
+
# prints a single value of a config setting.
|
384
|
+
def print_config_options
|
385
|
+
env = value(:environment)
|
386
|
+
val = value(:configprint)
|
387
|
+
if val == "all"
|
388
|
+
hash = {}
|
389
|
+
each do |name, obj|
|
390
|
+
val = value(name,env)
|
391
|
+
val = val.inspect if val == ""
|
392
|
+
hash[name] = val
|
393
|
+
end
|
394
|
+
hash.sort { |a,b| a[0].to_s <=> b[0].to_s }.each do |name, val|
|
395
|
+
puts "#{name} = #{val}"
|
396
|
+
end
|
397
|
+
else
|
398
|
+
val.split(/\s*,\s*/).sort.each do |v|
|
399
|
+
if include?(v)
|
400
|
+
#if there is only one value, just print it for back compatibility
|
401
|
+
if v == val
|
402
|
+
puts value(val,env)
|
403
|
+
break
|
404
|
+
end
|
405
|
+
puts "#{v} = #{value(v,env)}"
|
406
|
+
else
|
407
|
+
puts "invalid parameter: #{v}"
|
408
|
+
return false
|
409
|
+
end
|
410
|
+
end
|
411
|
+
end
|
412
|
+
true
|
413
|
+
end
|
414
|
+
|
415
|
+
def generate_config
|
416
|
+
puts to_config
|
417
|
+
true
|
418
|
+
end
|
419
|
+
|
420
|
+
def generate_manifest
|
421
|
+
puts to_manifest
|
422
|
+
true
|
423
|
+
end
|
424
|
+
|
425
|
+
def print_configs
|
426
|
+
return print_config_options if value(:configprint) != ""
|
427
|
+
return generate_config if value(:genconfig)
|
428
|
+
generate_manifest if value(:genmanifest)
|
429
|
+
end
|
430
|
+
|
431
|
+
def print_configs?
|
432
|
+
(value(:configprint) != "" || value(:genconfig) || value(:genmanifest)) && true
|
433
|
+
end
|
434
|
+
|
435
|
+
# Return a given object's file metadata.
|
436
|
+
def metadata(param)
|
437
|
+
if obj = @config[param.to_sym] and obj.is_a?(FileSetting)
|
438
|
+
return [:owner, :group, :mode].inject({}) do |meta, p|
|
439
|
+
if v = obj.send(p)
|
440
|
+
meta[p] = v
|
441
|
+
end
|
442
|
+
meta
|
443
|
+
end
|
444
|
+
else
|
445
|
+
nil
|
446
|
+
end
|
447
|
+
end
|
448
|
+
|
449
|
+
# Make a directory with the appropriate user, group, and mode
|
450
|
+
def mkdir(default)
|
451
|
+
obj = get_config_file_default(default)
|
452
|
+
|
453
|
+
Puppet::Util::SUIDManager.asuser(obj.owner, obj.group) do
|
454
|
+
mode = obj.mode || 0750
|
455
|
+
Dir.mkdir(obj.value, mode)
|
456
|
+
end
|
457
|
+
end
|
458
|
+
|
459
|
+
# Figure out the section name for the run_mode.
|
460
|
+
def run_mode
|
461
|
+
@run_mode || :user
|
462
|
+
end
|
463
|
+
|
464
|
+
# PRIVATE! This only exists because we need a hook to validate the run mode when it's being set, and
|
465
|
+
# it should never, ever, ever, ever be called from outside of this file.
|
466
|
+
def run_mode=(mode)
|
467
|
+
raise ValidationError, "Invalid run mode '#{mode}'" unless [:master, :agent, :user].include?(mode)
|
468
|
+
@run_mode = mode
|
469
|
+
end
|
470
|
+
private :run_mode=
|
471
|
+
|
472
|
+
# Return all of the parameters associated with a given section.
|
473
|
+
def params(section = nil)
|
474
|
+
if section
|
475
|
+
section = section.intern if section.is_a? String
|
476
|
+
@config.find_all { |name, obj|
|
477
|
+
obj.section == section
|
478
|
+
}.collect { |name, obj|
|
479
|
+
name
|
480
|
+
}
|
481
|
+
else
|
482
|
+
@config.keys
|
483
|
+
end
|
484
|
+
end
|
485
|
+
|
486
|
+
# Parse the configuration file. Just provides thread safety.
|
487
|
+
def parse_config_files
|
488
|
+
# we are able to support multiple config files; the "main" config file will
|
489
|
+
# be the one located in /etc/puppet (or overridden $confdir)... but we can
|
490
|
+
# also look for a config file in the user's home directory. We only load
|
491
|
+
# one configuration file in order to present a simple and consistent
|
492
|
+
# configuration model to the end user. It should also be noted we decided
|
493
|
+
# to merge in the user puppet.conf with the system puppet.conf for a time
|
494
|
+
# (e.g. load two configuration files) as a small part of #7749 but then
|
495
|
+
# decided to reverse this decision in 15337 to return to a disjoint
|
496
|
+
# configuration file model.
|
497
|
+
config_files = [which_configuration_file]
|
498
|
+
|
499
|
+
@sync.synchronize do
|
500
|
+
unsafe_parse(config_files)
|
501
|
+
end
|
502
|
+
|
503
|
+
# talking with cprice, Settings.parse will not be the final location for this. He's working on ticket
|
504
|
+
# that, as a side effect, will create a more appropriate place for this. At that time, this will be
|
505
|
+
# moved to the new location. --jeffweiss 24 apr 2012
|
506
|
+
call_hooks_deferred_to_application_initialization :ignore_interpolation_dependency_errors => true
|
507
|
+
end
|
508
|
+
private :parse_config_files
|
509
|
+
|
510
|
+
def main_config_file
|
511
|
+
# the algorithm here is basically this:
|
512
|
+
# * use the explicit config file location if one has been specified; this
|
513
|
+
# can be affected by modifications to either the "confdir" or "config"
|
514
|
+
# settings (most likely via CLI arguments).
|
515
|
+
# * if no explicit config location has been specified, we fall back to
|
516
|
+
# the default.
|
517
|
+
#
|
518
|
+
# return the default value.
|
519
|
+
if explicit_config_file?
|
520
|
+
return self[:config]
|
521
|
+
else
|
522
|
+
return File.join(self.class.default_global_config_dir, config_file_name)
|
523
|
+
end
|
524
|
+
end
|
525
|
+
private :main_config_file
|
526
|
+
|
527
|
+
def user_config_file
|
528
|
+
return File.join(self.class.default_user_config_dir, config_file_name)
|
529
|
+
end
|
530
|
+
private :user_config_file
|
531
|
+
|
532
|
+
# This method is here to get around some life-cycle issues. We need to be able to determine the config file name
|
533
|
+
# before the settings / defaults are fully loaded. However, we also need to respect any overrides of this value
|
534
|
+
# that the user may have specified on the command line.
|
535
|
+
#
|
536
|
+
# The easiest way to do this is to attempt to read the setting, and if we catch an error (meaning that it hasn't been
|
537
|
+
# set yet), we'll fall back to the default value.
|
538
|
+
def config_file_name
|
539
|
+
begin
|
540
|
+
return self[:config_file_name] if self[:config_file_name]
|
541
|
+
rescue SettingsError => err
|
542
|
+
# This just means that the setting wasn't explicitly set on the command line, so we will ignore it and
|
543
|
+
# fall through to the default name.
|
544
|
+
end
|
545
|
+
return self.class.default_config_file_name
|
546
|
+
end
|
547
|
+
private :config_file_name
|
548
|
+
|
549
|
+
# Unsafely parse the file -- this isn't thread-safe and causes plenty of problems if used directly.
|
550
|
+
def unsafe_parse(files)
|
551
|
+
raise Puppet::DevError unless files.length > 0
|
552
|
+
|
553
|
+
# build up a single data structure that contains the values from all of the parsed files.
|
554
|
+
data = {}
|
555
|
+
files.each do |file|
|
556
|
+
next unless FileTest.exist?(file)
|
557
|
+
begin
|
558
|
+
file_data = parse_file(file)
|
559
|
+
|
560
|
+
# This is a little kludgy; basically we are merging a hash of hashes. We can't use "merge" at the
|
561
|
+
# outermost level or we risking losing data from the hash we're merging into.
|
562
|
+
file_data.keys.each do |key|
|
563
|
+
if data.has_key?(key)
|
564
|
+
data[key].merge!(file_data[key])
|
565
|
+
else
|
566
|
+
data[key] = file_data[key]
|
567
|
+
end
|
568
|
+
end
|
569
|
+
|
570
|
+
rescue => detail
|
571
|
+
Puppet.log_exception(detail, "Could not parse #{file}: #{detail}")
|
572
|
+
return
|
573
|
+
end
|
574
|
+
end
|
575
|
+
|
576
|
+
# If we get here and don't have any data, we just return and don't muck with the current state of the world.
|
577
|
+
return if data.empty?
|
578
|
+
|
579
|
+
# If we get here then we have some data, so we need to clear out any previous settings that may have come from
|
580
|
+
# config files.
|
581
|
+
unsafe_clear(false, false)
|
582
|
+
|
583
|
+
# And now we can repopulate with the values from our last parsing of the config files.
|
584
|
+
metas = {}
|
585
|
+
data.each do |area, values|
|
586
|
+
metas[area] = values.delete(:_meta)
|
587
|
+
values.each do |key,value|
|
588
|
+
set_value(key, value, area, :dont_trigger_handles => true, :ignore_bad_settings => true )
|
589
|
+
end
|
590
|
+
end
|
591
|
+
|
592
|
+
# Determine our environment, if we have one.
|
593
|
+
if @config[:environment]
|
594
|
+
env = self.value(:environment).to_sym
|
595
|
+
else
|
596
|
+
env = "none"
|
597
|
+
end
|
598
|
+
|
599
|
+
# Call any hooks we should be calling.
|
600
|
+
settings_with_hooks.each do |setting|
|
601
|
+
each_source(env) do |source|
|
602
|
+
if value = @values[source][setting.name]
|
603
|
+
# We still have to use value to retrieve the value, since
|
604
|
+
# we want the fully interpolated value, not $vardir/lib or whatever.
|
605
|
+
# This results in extra work, but so few of the settings
|
606
|
+
# will have associated hooks that it ends up being less work this
|
607
|
+
# way overall.
|
608
|
+
setting.handle(self.value(setting.name, env))
|
609
|
+
break
|
610
|
+
end
|
611
|
+
end
|
612
|
+
end
|
613
|
+
|
614
|
+
# We have to do it in the reverse of the search path,
|
615
|
+
# because multiple sections could set the same value
|
616
|
+
# and I'm too lazy to only set the metadata once.
|
617
|
+
searchpath.reverse.each do |source|
|
618
|
+
source = run_mode if source == :run_mode
|
619
|
+
source = @name if (@name && source == :name)
|
620
|
+
if meta = metas[source]
|
621
|
+
set_metadata(meta)
|
622
|
+
end
|
623
|
+
end
|
624
|
+
end
|
625
|
+
private :unsafe_parse
|
626
|
+
|
627
|
+
|
628
|
+
# Create a new setting. The value is passed in because it's used to determine
|
629
|
+
# what kind of setting we're creating, but the value itself might be either
|
630
|
+
# a default or a value, so we can't actually assign it.
|
631
|
+
#
|
632
|
+
# See #define_settings for documentation on the legal values for the ":type" option.
|
633
|
+
def newsetting(hash)
|
634
|
+
klass = nil
|
635
|
+
hash[:section] = hash[:section].to_sym if hash[:section]
|
636
|
+
|
637
|
+
if type = hash[:type]
|
638
|
+
unless klass = {
|
639
|
+
:string => StringSetting,
|
640
|
+
:file => FileSetting,
|
641
|
+
:directory => DirectorySetting,
|
642
|
+
:path => PathSetting,
|
643
|
+
:boolean => BooleanSetting,
|
644
|
+
} [type]
|
645
|
+
raise ArgumentError, "Invalid setting type '#{type}'"
|
646
|
+
end
|
647
|
+
hash.delete(:type)
|
648
|
+
else
|
649
|
+
# The only implicit typing we still do for settings is to fall back to "String" type if they didn't explicitly
|
650
|
+
# specify a type. Personally I'd like to get rid of this too, and make the "type" option mandatory... but
|
651
|
+
# there was a little resistance to taking things quite that far for now. --cprice 2012-03-19
|
652
|
+
klass = StringSetting
|
653
|
+
end
|
654
|
+
hash[:settings] = self
|
655
|
+
setting = klass.new(hash)
|
656
|
+
|
657
|
+
setting
|
658
|
+
end
|
659
|
+
|
660
|
+
# This has to be private, because it doesn't add the settings to @config
|
661
|
+
private :newsetting
|
662
|
+
|
663
|
+
# Iterate across all of the objects in a given section.
|
664
|
+
def persection(section)
|
665
|
+
section = section.to_sym
|
666
|
+
self.each { |name, obj|
|
667
|
+
if obj.section == section
|
668
|
+
yield obj
|
669
|
+
end
|
670
|
+
}
|
671
|
+
end
|
672
|
+
|
673
|
+
# Reparse our config file, if necessary.
|
674
|
+
def reparse_config_files
|
675
|
+
if files
|
676
|
+
if filename = any_files_changed?
|
677
|
+
Puppet.notice "Config file #{filename} changed; triggering re-parse of all config files."
|
678
|
+
parse_config_files
|
679
|
+
reuse
|
680
|
+
end
|
681
|
+
end
|
682
|
+
end
|
683
|
+
|
684
|
+
def files
|
685
|
+
return @files if @files
|
686
|
+
@files = []
|
687
|
+
[main_config_file, user_config_file].each do |path|
|
688
|
+
if FileTest.exist?(path)
|
689
|
+
@files << Puppet::Util::LoadedFile.new(path)
|
690
|
+
end
|
691
|
+
end
|
692
|
+
@files
|
693
|
+
end
|
694
|
+
private :files
|
695
|
+
|
696
|
+
# Checks to see if any of the config files have been modified
|
697
|
+
# @return the filename of the first file that is found to have changed, or nil if no files have changed
|
698
|
+
def any_files_changed?
|
699
|
+
files.each do |file|
|
700
|
+
return file.file if file.changed?
|
701
|
+
end
|
702
|
+
nil
|
703
|
+
end
|
704
|
+
private :any_files_changed?
|
705
|
+
|
706
|
+
def reuse
|
707
|
+
return unless defined?(@used)
|
708
|
+
@sync.synchronize do # yay, thread-safe
|
709
|
+
new = @used
|
710
|
+
@used = []
|
711
|
+
self.use(*new)
|
712
|
+
end
|
713
|
+
end
|
714
|
+
|
715
|
+
# The order in which to search for values.
|
716
|
+
def searchpath(environment = nil)
|
717
|
+
if environment
|
718
|
+
[:cli, :memory, environment, :run_mode, :main, :application_defaults]
|
719
|
+
else
|
720
|
+
[:cli, :memory, :run_mode, :main, :application_defaults]
|
721
|
+
end
|
722
|
+
end
|
723
|
+
|
724
|
+
# Get a list of objects per section
|
725
|
+
def sectionlist
|
726
|
+
sectionlist = []
|
727
|
+
self.each { |name, obj|
|
728
|
+
section = obj.section || "puppet"
|
729
|
+
sections[section] ||= []
|
730
|
+
sectionlist << section unless sectionlist.include?(section)
|
731
|
+
sections[section] << obj
|
732
|
+
}
|
733
|
+
|
734
|
+
return sectionlist, sections
|
735
|
+
end
|
736
|
+
|
737
|
+
def service_user_available?
|
738
|
+
return @service_user_available if defined?(@service_user_available)
|
739
|
+
|
740
|
+
return @service_user_available = false unless user_name = self[:user]
|
741
|
+
|
742
|
+
user = Puppet::Type.type(:user).new :name => self[:user], :audit => :ensure
|
743
|
+
|
744
|
+
@service_user_available = user.exists?
|
745
|
+
end
|
746
|
+
|
747
|
+
# Allow later inspection to determine if the setting was set on the
|
748
|
+
# command line, or through some other code path. Used for the
|
749
|
+
# `dns_alt_names` option during cert generate. --daniel 2011-10-18
|
750
|
+
def set_by_cli?(param)
|
751
|
+
param = param.to_sym
|
752
|
+
!@values[:cli][param].nil?
|
753
|
+
end
|
754
|
+
|
755
|
+
def set_value(param, value, type, options = {})
|
756
|
+
param = param.to_sym
|
757
|
+
|
758
|
+
unless setting = @config[param]
|
759
|
+
if options[:ignore_bad_settings]
|
760
|
+
return
|
761
|
+
else
|
762
|
+
raise ArgumentError,
|
763
|
+
"Attempt to assign a value to unknown configuration parameter #{param.inspect}"
|
764
|
+
end
|
765
|
+
end
|
766
|
+
|
767
|
+
setting.handle(value) if setting.has_hook? and not options[:dont_trigger_handles]
|
768
|
+
if read_only_settings.include? param and type != :application_defaults
|
769
|
+
raise ArgumentError,
|
770
|
+
"You're attempting to set configuration parameter $#{param}, which is read-only."
|
771
|
+
end
|
772
|
+
|
773
|
+
@sync.synchronize do # yay, thread-safe
|
774
|
+
|
775
|
+
@values[type][param] = value
|
776
|
+
@cache.clear
|
777
|
+
|
778
|
+
clearused
|
779
|
+
|
780
|
+
# Clear the list of environments, because they cache, at least, the module path.
|
781
|
+
# We *could* preferentially just clear them if the modulepath is changed,
|
782
|
+
# but we don't really know if, say, the vardir is changed and the modulepath
|
783
|
+
# is defined relative to it. We need the defined?(stuff) because of loading
|
784
|
+
# order issues.
|
785
|
+
Puppet::Node::Environment.clear if defined?(Puppet::Node) and defined?(Puppet::Node::Environment)
|
786
|
+
end
|
787
|
+
|
788
|
+
# This is a hack. The run_mode should probably not be a "normal" setting, because the places
|
789
|
+
# it is used tend to create lifecycle issues and cause other weird problems. In some places
|
790
|
+
# we need for it to have a default value, in other places it may be preferable to be able to
|
791
|
+
# determine that it has not yet been set. There used to be a global variable that some
|
792
|
+
# code paths would access; as a first step towards cleaning it up, I've gotten rid of the global
|
793
|
+
# variable and am instead using an instance variable in this class, but that means that if
|
794
|
+
# someone modifies the value of the setting at a later point during execution, then the
|
795
|
+
# instance variable needs to be updated as well... so that's what we're doing here.
|
796
|
+
#
|
797
|
+
# This code should be removed if we get a chance to remove run_mode from the defined settings.
|
798
|
+
# --cprice 2012-03-19
|
799
|
+
self.run_mode = value if param == :run_mode
|
800
|
+
|
801
|
+
value
|
802
|
+
end
|
803
|
+
|
804
|
+
|
805
|
+
|
806
|
+
|
807
|
+
# Deprecated; use #define_settings instead
|
808
|
+
def setdefaults(section, defs)
|
809
|
+
Puppet.deprecation_warning("'setdefaults' is deprecated and will be removed; please call 'define_settings' instead")
|
810
|
+
define_settings(section, defs)
|
811
|
+
end
|
812
|
+
|
813
|
+
# Define a group of settings.
|
814
|
+
#
|
815
|
+
# @param [Symbol] section a symbol to use for grouping multiple settings together into a conceptual unit. This value
|
816
|
+
# (and the conceptual separation) is not used very often; the main place where it will have a potential impact
|
817
|
+
# is when code calls Settings#use method. See docs on that method for further details, but basically that method
|
818
|
+
# just attempts to do any preparation that may be necessary before code attempts to leverage the value of a particular
|
819
|
+
# setting. This has the most impact for file/directory settings, where #use will attempt to "ensure" those
|
820
|
+
# files / directories.
|
821
|
+
# @param [Hash[Hash]] defs the settings to be defined. This argument is a hash of hashes; each key should be a symbol,
|
822
|
+
# which is basically the name of the setting that you are defining. The value should be another hash that specifies
|
823
|
+
# the parameters for the particular setting. Legal values include:
|
824
|
+
# [:default] => required; this is a string value that will be used as a default value for a setting if no other
|
825
|
+
# value is specified (via cli, config file, etc.) This string may include "variables", demarcated with $ or ${},
|
826
|
+
# which will be interpolated with values of other settings.
|
827
|
+
# [:desc] => required; a description of the setting, used in documentation / help generation
|
828
|
+
# [:type] => not required, but highly encouraged! This specifies the data type that the setting represents. If
|
829
|
+
# you do not specify it, it will default to "string". Legal values include:
|
830
|
+
# :string - A generic string setting
|
831
|
+
# :boolean - A boolean setting; values are expected to be "true" or "false"
|
832
|
+
# :file - A (single) file path; puppet may attempt to create this file depending on how the settings are used. This type
|
833
|
+
# also supports additional options such as "mode", "owner", "group"
|
834
|
+
# :directory - A (single) directory path; puppet may attempt to create this file depending on how the settings are used. This type
|
835
|
+
# also supports additional options such as "mode", "owner", "group"
|
836
|
+
# :path - This is intended to be used for settings whose value can contain multiple directory paths, respresented
|
837
|
+
# as strings separated by the system path separator (e.g. system path, module path, etc.).
|
838
|
+
# [:mode] => an (optional) octal value to be used as the permissions/mode for :file and :directory settings
|
839
|
+
# [:owner] => optional owner username/uid for :file and :directory settings
|
840
|
+
# [:group] => optional group name/gid for :file and :directory settings
|
841
|
+
#
|
842
|
+
def define_settings(section, defs)
|
843
|
+
section = section.to_sym
|
844
|
+
call = []
|
845
|
+
defs.each { |name, hash|
|
846
|
+
raise ArgumentError, "setting definition for '#{name}' is not a hash!" unless hash.is_a? Hash
|
847
|
+
|
848
|
+
name = name.to_sym
|
849
|
+
hash[:name] = name
|
850
|
+
hash[:section] = section
|
851
|
+
raise ArgumentError, "Parameter #{name} is already defined" if @config.include?(name)
|
852
|
+
tryconfig = newsetting(hash)
|
853
|
+
if short = tryconfig.short
|
854
|
+
if other = @shortnames[short]
|
855
|
+
raise ArgumentError, "Parameter #{other.name} is already using short name '#{short}'"
|
856
|
+
end
|
857
|
+
@shortnames[short] = tryconfig
|
858
|
+
end
|
859
|
+
@config[name] = tryconfig
|
860
|
+
|
861
|
+
# Collect the settings that need to have their hooks called immediately.
|
862
|
+
# We have to collect them so that we can be sure we're fully initialized before
|
863
|
+
# the hook is called.
|
864
|
+
call << tryconfig if tryconfig.call_hook_on_define?
|
865
|
+
@hooks_to_call_on_application_initialization << tryconfig if tryconfig.call_hook_on_initialize?
|
866
|
+
}
|
867
|
+
|
868
|
+
call.each { |setting| setting.handle(self.value(setting.name)) }
|
869
|
+
end
|
870
|
+
|
871
|
+
# Convert the settings we manage into a catalog full of resources that model those settings.
|
872
|
+
def to_catalog(*sections)
|
873
|
+
sections = nil if sections.empty?
|
874
|
+
|
875
|
+
catalog = Puppet::Resource::Catalog.new("Settings")
|
876
|
+
|
877
|
+
@config.keys.find_all { |key| @config[key].is_a?(FileSetting) }.each do |key|
|
878
|
+
file = @config[key]
|
879
|
+
next unless (sections.nil? or sections.include?(file.section))
|
880
|
+
next unless resource = file.to_resource
|
881
|
+
next if catalog.resource(resource.ref)
|
882
|
+
|
883
|
+
Puppet.debug("Using settings: adding file resource '#{key}': '#{resource.inspect}'")
|
884
|
+
|
885
|
+
catalog.add_resource(resource)
|
886
|
+
end
|
887
|
+
|
888
|
+
add_user_resources(catalog, sections)
|
889
|
+
|
890
|
+
catalog
|
891
|
+
end
|
892
|
+
|
893
|
+
# Convert our list of config settings into a configuration file.
|
894
|
+
def to_config
|
895
|
+
str = %{The configuration file for #{Puppet.run_mode.name}. Note that this file
|
896
|
+
is likely to have unused configuration parameters in it; any parameter that's
|
897
|
+
valid anywhere in Puppet can be in any config file, even if it's not used.
|
898
|
+
|
899
|
+
Every section can specify three special parameters: owner, group, and mode.
|
900
|
+
These parameters affect the required permissions of any files specified after
|
901
|
+
their specification. Puppet will sometimes use these parameters to check its
|
902
|
+
own configured state, so they can be used to make Puppet a bit more self-managing.
|
903
|
+
|
904
|
+
Generated on #{Time.now}.
|
905
|
+
|
906
|
+
}.gsub(/^/, "# ")
|
907
|
+
|
908
|
+
# Add a section heading that matches our name.
|
909
|
+
if @config.include?(:run_mode)
|
910
|
+
str += "[#{self[:run_mode]}]\n"
|
911
|
+
end
|
912
|
+
eachsection do |section|
|
913
|
+
persection(section) do |obj|
|
914
|
+
str += obj.to_config + "\n" unless read_only_settings.include? obj.name or obj.name == :genconfig
|
915
|
+
end
|
916
|
+
end
|
917
|
+
|
918
|
+
return str
|
919
|
+
end
|
920
|
+
|
921
|
+
# Convert to a parseable manifest
|
922
|
+
def to_manifest
|
923
|
+
catalog = to_catalog
|
924
|
+
catalog.resource_refs.collect do |ref|
|
925
|
+
catalog.resource(ref).to_manifest
|
926
|
+
end.join("\n\n")
|
927
|
+
end
|
928
|
+
|
929
|
+
# Create the necessary objects to use a section. This is idempotent;
|
930
|
+
# you can 'use' a section as many times as you want.
|
931
|
+
def use(*sections)
|
932
|
+
sections = sections.collect { |s| s.to_sym }
|
933
|
+
@sync.synchronize do # yay, thread-safe
|
934
|
+
sections = sections.reject { |s| @used.include?(s) }
|
935
|
+
|
936
|
+
return if sections.empty?
|
937
|
+
|
938
|
+
begin
|
939
|
+
catalog = to_catalog(*sections).to_ral
|
940
|
+
rescue => detail
|
941
|
+
Puppet.log_and_raise(detail, "Could not create resources for managing Puppet's files and directories in sections #{sections.inspect}: #{detail}")
|
942
|
+
end
|
943
|
+
|
944
|
+
catalog.host_config = false
|
945
|
+
catalog.apply do |transaction|
|
946
|
+
if transaction.any_failed?
|
947
|
+
report = transaction.report
|
948
|
+
failures = report.logs.find_all { |log| log.level == :err }
|
949
|
+
raise "Got #{failures.length} failure(s) while initializing: #{failures.collect { |l| l.to_s }.join("; ")}"
|
950
|
+
end
|
951
|
+
end
|
952
|
+
|
953
|
+
sections.each { |s| @used << s }
|
954
|
+
@used.uniq!
|
955
|
+
end
|
956
|
+
end
|
957
|
+
|
958
|
+
def valid?(param)
|
959
|
+
param = param.to_sym
|
960
|
+
@config.has_key?(param)
|
961
|
+
end
|
962
|
+
|
963
|
+
def uninterpolated_value(param, environment = nil)
|
964
|
+
param = param.to_sym
|
965
|
+
environment &&= environment.to_sym
|
966
|
+
|
967
|
+
# See if we can find it within our searchable list of values
|
968
|
+
val = find_value(environment, param)
|
969
|
+
|
970
|
+
# If we didn't get a value, use the default
|
971
|
+
val = @config[param].default if val.nil?
|
972
|
+
|
973
|
+
val
|
974
|
+
end
|
975
|
+
|
976
|
+
def find_value(environment, param)
|
977
|
+
each_source(environment) do |source|
|
978
|
+
# Look for the value. We have to test the hash for whether
|
979
|
+
# it exists, because the value might be false.
|
980
|
+
@sync.synchronize do
|
981
|
+
return @values[source][param] if @values[source].include?(param)
|
982
|
+
end
|
983
|
+
end
|
984
|
+
return nil
|
985
|
+
end
|
986
|
+
private :find_value
|
987
|
+
|
988
|
+
# Find the correct value using our search path. Optionally accept an environment
|
989
|
+
# in which to search before the other configuration sections.
|
990
|
+
def value(param, environment = nil, bypass_interpolation = false)
|
991
|
+
param = param.to_sym
|
992
|
+
environment &&= environment.to_sym
|
993
|
+
|
994
|
+
setting = @config[param]
|
995
|
+
|
996
|
+
# Short circuit to nil for undefined parameters.
|
997
|
+
return nil unless @config.include?(param)
|
998
|
+
|
999
|
+
# Yay, recursion.
|
1000
|
+
#self.reparse unless [:config, :filetimeout].include?(param)
|
1001
|
+
|
1002
|
+
# Check the cache first. It needs to be a per-environment
|
1003
|
+
# cache so that we don't spread values from one env
|
1004
|
+
# to another.
|
1005
|
+
if cached = @cache[environment||"none"][param]
|
1006
|
+
return cached
|
1007
|
+
end
|
1008
|
+
|
1009
|
+
val = uninterpolated_value(param, environment)
|
1010
|
+
|
1011
|
+
return val if bypass_interpolation
|
1012
|
+
if param == :code
|
1013
|
+
# if we interpolate code, all hell breaks loose.
|
1014
|
+
return val
|
1015
|
+
end
|
1016
|
+
|
1017
|
+
# Convert it if necessary
|
1018
|
+
begin
|
1019
|
+
val = convert(val, environment)
|
1020
|
+
rescue InterpolationError => err
|
1021
|
+
# This happens because we don't have access to the param name when the
|
1022
|
+
# exception is originally raised, but we want it in the message
|
1023
|
+
raise InterpolationError, "Error converting value for param '#{param}': #{err}", err.backtrace
|
1024
|
+
end
|
1025
|
+
|
1026
|
+
val = setting.munge(val) if setting.respond_to?(:munge)
|
1027
|
+
# And cache it
|
1028
|
+
@cache[environment||"none"][param] = val
|
1029
|
+
val
|
1030
|
+
end
|
1031
|
+
|
1032
|
+
# Open a file with the appropriate user, group, and mode
|
1033
|
+
def write(default, *args, &bloc)
|
1034
|
+
obj = get_config_file_default(default)
|
1035
|
+
writesub(default, value(obj.name), *args, &bloc)
|
1036
|
+
end
|
1037
|
+
|
1038
|
+
# Open a non-default file under a default dir with the appropriate user,
|
1039
|
+
# group, and mode
|
1040
|
+
def writesub(default, file, *args, &bloc)
|
1041
|
+
obj = get_config_file_default(default)
|
1042
|
+
chown = nil
|
1043
|
+
if Puppet.features.root?
|
1044
|
+
chown = [obj.owner, obj.group]
|
1045
|
+
else
|
1046
|
+
chown = [nil, nil]
|
1047
|
+
end
|
1048
|
+
|
1049
|
+
Puppet::Util::SUIDManager.asuser(*chown) do
|
1050
|
+
mode = obj.mode ? obj.mode.to_i : 0640
|
1051
|
+
args << "w" if args.empty?
|
1052
|
+
|
1053
|
+
args << mode
|
1054
|
+
|
1055
|
+
# Update the umask to make non-executable files
|
1056
|
+
Puppet::Util.withumask(File.umask ^ 0111) do
|
1057
|
+
File.open(file, *args) do |file|
|
1058
|
+
yield file
|
1059
|
+
end
|
1060
|
+
end
|
1061
|
+
end
|
1062
|
+
end
|
1063
|
+
|
1064
|
+
def readwritelock(default, *args, &bloc)
|
1065
|
+
file = value(get_config_file_default(default).name)
|
1066
|
+
tmpfile = file + ".tmp"
|
1067
|
+
sync = Sync.new
|
1068
|
+
raise Puppet::DevError, "Cannot create #{file}; directory #{File.dirname(file)} does not exist" unless FileTest.directory?(File.dirname(tmpfile))
|
1069
|
+
|
1070
|
+
sync.synchronize(Sync::EX) do
|
1071
|
+
File.open(file, ::File::CREAT|::File::RDWR, 0600) do |rf|
|
1072
|
+
rf.lock_exclusive do
|
1073
|
+
if File.exist?(tmpfile)
|
1074
|
+
raise Puppet::Error, ".tmp file already exists for #{file}; Aborting locked write. Check the .tmp file and delete if appropriate"
|
1075
|
+
end
|
1076
|
+
|
1077
|
+
# If there's a failure, remove our tmpfile
|
1078
|
+
begin
|
1079
|
+
writesub(default, tmpfile, *args, &bloc)
|
1080
|
+
rescue
|
1081
|
+
File.unlink(tmpfile) if FileTest.exist?(tmpfile)
|
1082
|
+
raise
|
1083
|
+
end
|
1084
|
+
|
1085
|
+
begin
|
1086
|
+
File.rename(tmpfile, file)
|
1087
|
+
rescue => detail
|
1088
|
+
Puppet.err "Could not rename #{file} to #{tmpfile}: #{detail}"
|
1089
|
+
File.unlink(tmpfile) if FileTest.exist?(tmpfile)
|
1090
|
+
end
|
1091
|
+
end
|
1092
|
+
end
|
1093
|
+
end
|
1094
|
+
end
|
1095
|
+
|
1096
|
+
private
|
1097
|
+
|
1098
|
+
# This is just here to simplify testing. This method can be stubbed easily. Constants can't.
|
1099
|
+
def read_only_settings()
|
1100
|
+
READ_ONLY_SETTINGS
|
1101
|
+
end
|
1102
|
+
|
1103
|
+
def get_config_file_default(default)
|
1104
|
+
obj = nil
|
1105
|
+
unless obj = @config[default]
|
1106
|
+
raise ArgumentError, "Unknown default #{default}"
|
1107
|
+
end
|
1108
|
+
|
1109
|
+
raise ArgumentError, "Default #{default} is not a file" unless obj.is_a? FileSetting
|
1110
|
+
|
1111
|
+
obj
|
1112
|
+
end
|
1113
|
+
|
1114
|
+
def add_user_resources(catalog, sections)
|
1115
|
+
return unless Puppet.features.root?
|
1116
|
+
return if Puppet.features.microsoft_windows?
|
1117
|
+
return unless self[:mkusers]
|
1118
|
+
|
1119
|
+
@config.each do |name, setting|
|
1120
|
+
next unless setting.respond_to?(:owner)
|
1121
|
+
next unless sections.nil? or sections.include?(setting.section)
|
1122
|
+
|
1123
|
+
if user = setting.owner and user != "root" and catalog.resource(:user, user).nil?
|
1124
|
+
resource = Puppet::Resource.new(:user, user, :parameters => {:ensure => :present})
|
1125
|
+
resource[:gid] = self[:group] if self[:group]
|
1126
|
+
catalog.add_resource resource
|
1127
|
+
end
|
1128
|
+
if group = setting.group and ! %w{root wheel}.include?(group) and catalog.resource(:group, group).nil?
|
1129
|
+
catalog.add_resource Puppet::Resource.new(:group, group, :parameters => {:ensure => :present})
|
1130
|
+
end
|
1131
|
+
end
|
1132
|
+
end
|
1133
|
+
|
1134
|
+
# Yield each search source in turn.
|
1135
|
+
def each_source(environment)
|
1136
|
+
searchpath(environment).each do |source|
|
1137
|
+
|
1138
|
+
# Modify the source as necessary.
|
1139
|
+
source = self.run_mode if source == :run_mode
|
1140
|
+
yield source
|
1141
|
+
end
|
1142
|
+
end
|
1143
|
+
|
1144
|
+
# Return all settings that have associated hooks; this is so
|
1145
|
+
# we can call them after parsing the configuration file.
|
1146
|
+
def settings_with_hooks
|
1147
|
+
@config.values.find_all { |setting| setting.has_hook? }
|
1148
|
+
end
|
1149
|
+
|
1150
|
+
# Extract extra setting information for files.
|
1151
|
+
def extract_fileinfo(string)
|
1152
|
+
result = {}
|
1153
|
+
value = string.sub(/\{\s*([^}]+)\s*\}/) do
|
1154
|
+
params = $1
|
1155
|
+
params.split(/\s*,\s*/).each do |str|
|
1156
|
+
if str =~ /^\s*(\w+)\s*=\s*([\w\d]+)\s*$/
|
1157
|
+
param, value = $1.intern, $2
|
1158
|
+
result[param] = value
|
1159
|
+
raise ArgumentError, "Invalid file option '#{param}'" unless [:owner, :mode, :group].include?(param)
|
1160
|
+
|
1161
|
+
if param == :mode and value !~ /^\d+$/
|
1162
|
+
raise ArgumentError, "File modes must be numbers"
|
1163
|
+
end
|
1164
|
+
else
|
1165
|
+
raise ArgumentError, "Could not parse '#{string}'"
|
1166
|
+
end
|
1167
|
+
end
|
1168
|
+
''
|
1169
|
+
end
|
1170
|
+
result[:value] = value.sub(/\s*$/, '')
|
1171
|
+
result
|
1172
|
+
end
|
1173
|
+
|
1174
|
+
# Convert arguments into booleans, integers, or whatever.
|
1175
|
+
def munge_value(value)
|
1176
|
+
# Handle different data types correctly
|
1177
|
+
return case value
|
1178
|
+
when /^false$/i; false
|
1179
|
+
when /^true$/i; true
|
1180
|
+
when /^\d+$/i; Integer(value)
|
1181
|
+
when true; true
|
1182
|
+
when false; false
|
1183
|
+
else
|
1184
|
+
value.gsub(/^["']|["']$/,'').sub(/\s+$/, '')
|
1185
|
+
end
|
1186
|
+
end
|
1187
|
+
|
1188
|
+
# This method just turns a file in to a hash of hashes.
|
1189
|
+
def parse_file(file)
|
1190
|
+
text = read_file(file)
|
1191
|
+
|
1192
|
+
result = Hash.new { |names, name|
|
1193
|
+
names[name] = {}
|
1194
|
+
}
|
1195
|
+
|
1196
|
+
count = 0
|
1197
|
+
|
1198
|
+
# Default to 'main' for the section.
|
1199
|
+
section = :main
|
1200
|
+
result[section][:_meta] = {}
|
1201
|
+
text.split(/\n/).each do |line|
|
1202
|
+
count += 1
|
1203
|
+
case line
|
1204
|
+
when /^\s*\[(\w+)\]\s*$/
|
1205
|
+
section = $1.intern # Section names
|
1206
|
+
#disallow application_defaults in config file
|
1207
|
+
if section == :application_defaults
|
1208
|
+
raise Puppet::Error, "Illegal section 'application_defaults' in config file #{file} at line #{line}"
|
1209
|
+
end
|
1210
|
+
# Add a meta section
|
1211
|
+
result[section][:_meta] ||= {}
|
1212
|
+
when /^\s*#/; next # Skip comments
|
1213
|
+
when /^\s*$/; next # Skip blanks
|
1214
|
+
when /^\s*(\w+)\s*=\s*(.*?)\s*$/ # settings
|
1215
|
+
var = $1.intern
|
1216
|
+
|
1217
|
+
# We don't want to munge modes, because they're specified in octal, so we'll
|
1218
|
+
# just leave them as a String, since Puppet handles that case correctly.
|
1219
|
+
if var == :mode
|
1220
|
+
value = $2
|
1221
|
+
else
|
1222
|
+
value = munge_value($2)
|
1223
|
+
end
|
1224
|
+
|
1225
|
+
# Check to see if this is a file argument and it has extra options
|
1226
|
+
begin
|
1227
|
+
if value.is_a?(String) and options = extract_fileinfo(value)
|
1228
|
+
value = options[:value]
|
1229
|
+
options.delete(:value)
|
1230
|
+
result[section][:_meta][var] = options
|
1231
|
+
end
|
1232
|
+
result[section][var] = value
|
1233
|
+
rescue Puppet::Error => detail
|
1234
|
+
raise ParseError.new(detail.message, file, line, detail)
|
1235
|
+
end
|
1236
|
+
else
|
1237
|
+
raise ParseError.new("Could not match line #{line}", file, line)
|
1238
|
+
end
|
1239
|
+
end
|
1240
|
+
|
1241
|
+
result
|
1242
|
+
end
|
1243
|
+
|
1244
|
+
# Read the file in.
|
1245
|
+
def read_file(file)
|
1246
|
+
begin
|
1247
|
+
return File.read(file)
|
1248
|
+
rescue Errno::ENOENT
|
1249
|
+
raise ArgumentError, "No such file #{file}"
|
1250
|
+
rescue Errno::EACCES
|
1251
|
+
raise ArgumentError, "Permission denied to file #{file}"
|
1252
|
+
end
|
1253
|
+
end
|
1254
|
+
|
1255
|
+
# Set file metadata.
|
1256
|
+
def set_metadata(meta)
|
1257
|
+
meta.each do |var, values|
|
1258
|
+
values.each do |param, value|
|
1259
|
+
@config[var].send(param.to_s + "=", value)
|
1260
|
+
end
|
1261
|
+
end
|
1262
|
+
end
|
1263
|
+
|
1264
|
+
# Private method for internal test use only; allows to do a comprehensive clear of all settings between tests.
|
1265
|
+
#
|
1266
|
+
# @return nil
|
1267
|
+
def clear_everything_for_tests()
|
1268
|
+
@sync.synchronize do
|
1269
|
+
unsafe_clear(true, true)
|
1270
|
+
@global_defaults_initialized = false
|
1271
|
+
@app_defaults_initialized = false
|
1272
|
+
end
|
1273
|
+
end
|
1274
|
+
private :clear_everything_for_tests
|
1275
|
+
|
1276
|
+
def which_configuration_file
|
1277
|
+
# (#15337) All of the logic to determine the configuration file to use
|
1278
|
+
# should be centralized into this method. The simplified approach is:
|
1279
|
+
# 1. If there is an explicit configuration file, use that. (--confdir or
|
1280
|
+
# --config)
|
1281
|
+
# 2. If we're running as a root process, use the system puppet.conf
|
1282
|
+
# (usually /etc/puppet/puppet.conf)
|
1283
|
+
# 3: Otherwise, use the user puppet.conf (usually ~/.puppet/puppet.conf)
|
1284
|
+
if explicit_config_file? or Puppet.features.root? then
|
1285
|
+
return main_config_file
|
1286
|
+
else
|
1287
|
+
return user_config_file
|
1288
|
+
end
|
1289
|
+
end
|
1290
|
+
|
1291
|
+
def explicit_config_file?
|
1292
|
+
# Figure out if the user has provided an explicit configuration file. If
|
1293
|
+
# so, return the path to the file, if not return nil.
|
1294
|
+
#
|
1295
|
+
# The easiest way to determine whether an explicit one has been specified
|
1296
|
+
# is to simply attempt to evaluate the value of ":config". This will
|
1297
|
+
# obviously be successful if they've passed an explicit value for :config,
|
1298
|
+
# but it will also result in successful interpolation if they've only
|
1299
|
+
# passed an explicit value for :confdir.
|
1300
|
+
#
|
1301
|
+
# If they've specified neither, then the interpolation will fail and we'll
|
1302
|
+
# get an exception.
|
1303
|
+
#
|
1304
|
+
begin
|
1305
|
+
return true if self[:config]
|
1306
|
+
rescue InterpolationError => err
|
1307
|
+
# This means we failed to interpolate, which means that they didn't
|
1308
|
+
# explicitly specify either :config or :confdir... so we'll fall out to
|
1309
|
+
# the default value.
|
1310
|
+
return false
|
1311
|
+
end
|
1312
|
+
end
|
1313
|
+
private :explicit_config_file?
|
1314
|
+
|
1315
|
+
end
|