puppet 3.0.0.rc5 → 3.0.0.rc7
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/LICENSE +1 -1
- data/README_DEVELOPER.md +209 -1
- data/README_HIERA.md +148 -0
- data/Rakefile +25 -27
- data/bin/extlookup2hiera +56 -0
- data/conf/auth.conf +34 -34
- data/examples/hiera/README.md +91 -0
- data/examples/hiera/etc/hiera.yaml +15 -0
- data/examples/hiera/etc/hieradb/common.yaml +3 -0
- data/examples/hiera/etc/hieradb/dc1.yaml +6 -0
- data/examples/hiera/etc/hieradb/development.yaml +2 -0
- data/examples/hiera/etc/puppet.conf +3 -0
- data/examples/hiera/modules/data/manifests/common.pp +3 -0
- data/examples/hiera/modules/ntp/manifests/config.pp +5 -0
- data/examples/hiera/modules/ntp/manifests/data.pp +3 -0
- data/examples/hiera/modules/ntp/templates/ntp.conf.erb +3 -0
- data/examples/hiera/modules/users/manifests/common.pp +3 -0
- data/examples/hiera/modules/users/manifests/dc1.pp +3 -0
- data/examples/hiera/modules/users/manifests/development.pp +3 -0
- data/examples/hiera/site.pp +3 -0
- data/ext/build_defaults.yaml +23 -0
- data/ext/debian/README.Debian +8 -0
- data/ext/debian/README.source +2 -0
- data/ext/debian/TODO.Debian +1 -0
- data/ext/debian/changelog.erb +1104 -0
- data/ext/debian/compat +1 -0
- data/ext/debian/control +143 -0
- data/ext/debian/copyright +361 -0
- data/ext/debian/docs +1 -0
- data/ext/debian/fileserver.conf +17 -0
- data/ext/debian/puppet-common.dirs +8 -0
- data/ext/debian/puppet-common.install +4 -0
- data/ext/debian/puppet-common.lintian-overrides +5 -0
- data/ext/debian/puppet-common.manpages +2 -0
- data/ext/debian/puppet-common.postinst +35 -0
- data/ext/debian/puppet-common.postrm +32 -0
- data/ext/debian/puppet-el.dirs +1 -0
- data/ext/debian/puppet-el.emacsen-install +25 -0
- data/ext/debian/puppet-el.emacsen-remove +11 -0
- data/ext/debian/puppet-el.emacsen-startup +9 -0
- data/ext/debian/puppet-el.install +1 -0
- data/ext/debian/puppet-testsuite.install +2 -0
- data/ext/debian/puppet-testsuite.lintian-overrides +4 -0
- data/ext/debian/puppet.conf +14 -0
- data/ext/debian/puppet.default +7 -0
- data/ext/debian/puppet.init +118 -0
- data/ext/debian/puppet.lintian-overrides +3 -0
- data/ext/debian/puppet.logrotate +11 -0
- data/ext/debian/puppet.manpages +32 -0
- data/ext/debian/puppet.postinst +20 -0
- data/ext/debian/puppet.postrm +20 -0
- data/ext/debian/puppet.preinst +20 -0
- data/ext/debian/puppetmaster-common.install +2 -0
- data/ext/debian/puppetmaster-common.manpages +2 -0
- data/ext/debian/puppetmaster-common.puppetqd.default +27 -0
- data/ext/debian/puppetmaster-common.puppetqd.init +84 -0
- data/ext/debian/puppetmaster-passenger.dirs +4 -0
- data/ext/debian/puppetmaster-passenger.postinst +66 -0
- data/ext/debian/puppetmaster-passenger.postrm +33 -0
- data/ext/debian/puppetmaster.README.debian +16 -0
- data/ext/debian/puppetmaster.default +38 -0
- data/ext/debian/puppetmaster.init +158 -0
- data/ext/debian/puppetmaster.lintian-overrides +3 -0
- data/ext/debian/puppetmaster.postinst +20 -0
- data/ext/debian/puppetmaster.postrm +5 -0
- data/ext/debian/puppetmaster.preinst +22 -0
- data/ext/debian/rules +128 -0
- data/ext/debian/source/format +1 -0
- data/ext/debian/source/options +1 -0
- data/ext/debian/vim-puppet.README.Debian +13 -0
- data/ext/debian/vim-puppet.dirs +3 -0
- data/ext/debian/vim-puppet.yaml +5 -0
- data/ext/debian/watch +2 -0
- data/ext/emacs/puppet-mode.el +1 -0
- data/ext/envpuppet +4 -0
- data/ext/envpuppet.bat +3 -2
- data/{conf → ext}/freebsd/puppetd +0 -0
- data/{conf → ext}/freebsd/puppetmasterd +0 -0
- data/{conf → ext}/gentoo/conf.d/puppet +0 -0
- data/{conf → ext}/gentoo/conf.d/puppetmaster +0 -0
- data/{conf → ext}/gentoo/init.d/puppet +0 -0
- data/{conf → ext}/gentoo/init.d/puppetmaster +0 -0
- data/{conf → ext}/gentoo/puppet/fileserver.conf +0 -0
- data/{conf → ext}/gentoo/puppet/puppet.conf +0 -0
- data/ext/ips/puppet-agent +49 -0
- data/ext/ips/puppet-master +44 -0
- data/ext/ips/puppet.conf +29 -0
- data/ext/ips/puppet.p5m.erb +12 -0
- data/ext/ips/puppetagent.xml +46 -0
- data/ext/ips/puppetmaster.xml +42 -0
- data/ext/ips/rules +19 -0
- data/ext/ips/transforms +34 -0
- data/{conf → ext}/osx/PackageInfo.plist +0 -0
- data/{conf → ext}/osx/createpackage.sh +1 -1
- data/ext/osx/file_mapping.yaml +33 -0
- data/ext/osx/preflight.erb +37 -0
- data/{tasks/rake/templates → ext/osx}/prototype.plist.erb +0 -0
- data/ext/packaging/README-Solaris.md +117 -0
- data/ext/packaging/README.md +89 -0
- data/ext/packaging/tasks/00_utils.rb +236 -0
- data/ext/packaging/tasks/10_setupvars.rake +62 -0
- data/ext/packaging/tasks/apple.rake +201 -0
- data/ext/packaging/tasks/clean.rake +5 -0
- data/ext/packaging/tasks/deb.rake +105 -0
- data/ext/packaging/tasks/gem.rake +52 -0
- data/ext/packaging/tasks/ips.rake +78 -0
- data/ext/packaging/tasks/mock.rake +88 -0
- data/ext/packaging/tasks/release.rake +20 -0
- data/ext/packaging/tasks/rpm.rake +39 -0
- data/ext/packaging/tasks/ship.rake +34 -0
- data/ext/packaging/tasks/sign.rake +76 -0
- data/ext/packaging/tasks/tar.rake +20 -0
- data/ext/project_data.yaml +25 -0
- data/ext/rack/files/apache2.conf +2 -1
- data/{conf → ext}/redhat/client.init +0 -0
- data/{conf → ext}/redhat/client.sysconfig +0 -0
- data/{conf → ext}/redhat/fileserver.conf +0 -0
- data/{conf → ext}/redhat/logrotate +0 -0
- data/{conf → ext}/redhat/puppet.conf +0 -0
- data/{conf/redhat/puppet.spec → ext/redhat/puppet.spec.erb} +140 -33
- data/{conf → ext}/redhat/queue.init +0 -0
- data/{conf → ext}/redhat/rundir-perms.patch +0 -0
- data/{conf → ext}/redhat/server.init +0 -0
- data/{conf → ext}/redhat/server.sysconfig +0 -0
- data/{conf → ext}/solaris/pkginfo +0 -0
- data/{conf → ext}/solaris/smf/puppetd.xml +0 -0
- data/{conf → ext}/solaris/smf/puppetmasterd.xml +0 -0
- data/{conf → ext}/solaris/smf/svc-puppetd +0 -0
- data/{conf → ext}/solaris/smf/svc-puppetmasterd +0 -0
- data/{conf → ext}/suse/client.init +0 -0
- data/{conf → ext}/suse/fileserver.conf +0 -0
- data/{conf → ext}/suse/logrotate +0 -0
- data/{conf → ext}/suse/puppet.conf +0 -0
- data/{conf → ext}/suse/puppet.spec +1 -1
- data/{conf → ext}/suse/server.init +0 -0
- data/ext/systemd/puppetagent.service +13 -0
- data/ext/systemd/puppetmaster.service +13 -0
- data/{conf → ext}/windows/eventlog/Rakefile +0 -0
- data/{conf → ext}/windows/eventlog/puppetres.dll +0 -0
- data/{conf → ext}/windows/eventlog/puppetres.mc +0 -0
- data/ext/windows/service/daemon.bat +6 -0
- data/ext/windows/service/daemon.rb +90 -0
- data/install.rb +22 -32
- data/lib/hiera/backend/puppet_backend.rb +102 -0
- data/lib/hiera/scope.rb +42 -0
- data/lib/hiera_puppet.rb +89 -0
- data/lib/puppet.rb +1 -1
- data/lib/puppet/agent.rb +2 -2
- data/lib/puppet/agent/locker.rb +12 -9
- data/lib/puppet/application.rb +10 -8
- data/lib/puppet/application/agent.rb +12 -8
- data/lib/puppet/application/apply.rb +2 -2
- data/lib/puppet/application/cert.rb +6 -6
- data/lib/puppet/application/certificate.rb +1 -4
- data/lib/puppet/application/describe.rb +1 -1
- data/lib/puppet/application/device.rb +5 -2
- data/lib/puppet/application/doc.rb +1 -1
- data/lib/puppet/application/face_base.rb +3 -13
- data/lib/puppet/application/filebucket.rb +1 -1
- data/lib/puppet/application/inspect.rb +1 -1
- data/lib/puppet/application/kick.rb +4 -2
- data/lib/puppet/application/master.rb +2 -2
- data/lib/puppet/application/queue.rb +3 -1
- data/lib/puppet/application/resource.rb +1 -1
- data/lib/puppet/configurer.rb +11 -7
- data/lib/puppet/configurer/downloader.rb +1 -4
- data/lib/puppet/daemon.rb +4 -4
- data/lib/puppet/defaults.rb +64 -60
- data/lib/puppet/external/dot.rb +1 -1
- data/lib/puppet/external/pson/common.rb +15 -0
- data/lib/puppet/external/pson/pure.rb +0 -62
- data/lib/puppet/external/pson/pure/generator.rb +1 -1
- data/lib/puppet/external/pson/pure/parser.rb +2 -2
- data/lib/puppet/face/ca.rb +19 -14
- data/lib/puppet/face/config.rb +2 -2
- data/lib/puppet/face/facts.rb +1 -1
- data/lib/puppet/face/help/action.erb +0 -1
- data/lib/puppet/face/help/face.erb +0 -1
- data/lib/puppet/face/help/man.erb +3 -6
- data/lib/puppet/face/module/install.rb +1 -1
- data/lib/puppet/face/module/list.rb +1 -1
- data/lib/puppet/face/module/uninstall.rb +1 -1
- data/lib/puppet/face/node.rb +1 -1
- data/lib/puppet/face/node/clean.rb +30 -25
- data/lib/puppet/feature/base.rb +0 -3
- data/lib/puppet/feature/rails.rb +2 -1
- data/lib/puppet/file_serving/terminus_selector.rb +1 -1
- data/lib/puppet/indirector/catalog/active_record.rb +5 -0
- data/lib/puppet/indirector/catalog/static_compiler.rb +2 -3
- data/lib/puppet/indirector/certificate/disabled_ca.rb +22 -0
- data/lib/puppet/indirector/certificate_request/disabled_ca.rb +22 -0
- data/lib/puppet/indirector/certificate_revocation_list/disabled_ca.rb +22 -0
- data/lib/puppet/indirector/face.rb +3 -3
- data/lib/puppet/indirector/facts/active_record.rb +5 -0
- data/lib/puppet/indirector/facts/facter.rb +1 -4
- data/lib/puppet/indirector/facts/inventory_active_record.rb +6 -0
- data/lib/puppet/indirector/file_bucket_file/file.rb +2 -1
- data/lib/puppet/indirector/indirection.rb +2 -2
- data/lib/puppet/indirector/key/disabled_ca.rb +22 -0
- data/lib/puppet/indirector/node/active_record.rb +5 -0
- data/lib/puppet/indirector/request.rb +4 -0
- data/lib/puppet/indirector/resource/active_record.rb +5 -0
- data/lib/puppet/network/authentication.rb +30 -0
- data/lib/puppet/network/http.rb +0 -13
- data/lib/puppet/network/http/connection.rb +10 -2
- data/lib/puppet/network/http/handler.rb +8 -0
- data/lib/puppet/network/http/mongrel/rest.rb +5 -0
- data/lib/puppet/network/http/rack/rest.rb +7 -0
- data/lib/puppet/network/http/webrick.rb +3 -6
- data/lib/puppet/network/http/webrick/rest.rb +4 -0
- data/lib/puppet/network/server.rb +9 -33
- data/lib/puppet/node.rb +1 -1
- data/lib/puppet/node/facts.rb +0 -1
- data/lib/puppet/parser/compiler.rb +1 -1
- data/lib/puppet/parser/functions.rb +12 -1
- data/lib/puppet/parser/functions/hiera.rb +8 -0
- data/lib/puppet/parser/functions/hiera_array.rb +8 -0
- data/lib/puppet/parser/functions/hiera_hash.rb +8 -0
- data/lib/puppet/parser/functions/hiera_include.rb +11 -0
- data/lib/puppet/parser/functions/shellquote.rb +21 -29
- data/lib/puppet/parser/lexer.rb +2 -1
- data/lib/puppet/parser/scope.rb +8 -0
- data/lib/puppet/provider/exec/windows.rb +1 -1
- data/lib/puppet/provider/group/groupadd.rb +2 -3
- data/lib/puppet/provider/package/pkg.rb +37 -10
- data/lib/puppet/provider/service/daemontools.rb +1 -1
- data/lib/puppet/provider/service/launchd.rb +1 -1
- data/lib/puppet/provider/service/redhat.rb +1 -1
- data/lib/puppet/provider/service/runit.rb +1 -1
- data/lib/puppet/provider/user/useradd.rb +8 -3
- data/lib/puppet/provider/user/windows_adsi.rb +11 -0
- data/lib/puppet/provider/zfs/zfs.rb +29 -2
- data/lib/puppet/provider/zone/solaris.rb +144 -39
- data/lib/puppet/provider/zpool/zpool.rb +7 -10
- data/lib/puppet/settings.rb +50 -86
- data/lib/puppet/settings/duration_setting.rb +34 -0
- data/lib/puppet/settings/terminus_setting.rb +16 -0
- data/lib/puppet/ssl/base.rb +49 -9
- data/lib/puppet/ssl/certificate.rb +13 -9
- data/lib/puppet/ssl/certificate_authority.rb +4 -0
- data/lib/puppet/ssl/certificate_authority/interface.rb +10 -17
- data/lib/puppet/ssl/certificate_factory.rb +4 -21
- data/lib/puppet/ssl/certificate_request.rb +1 -10
- data/lib/puppet/ssl/certificate_revocation_list.rb +1 -3
- data/lib/puppet/ssl/digest.rb +20 -0
- data/lib/puppet/ssl/host.rb +31 -6
- data/lib/puppet/test/test_helper.rb +1 -1
- data/lib/puppet/transaction/report.rb +2 -1
- data/lib/puppet/type.rb +1 -1
- data/lib/puppet/type/augeas.rb +1 -1
- data/lib/puppet/type/cron.rb +1 -1
- data/lib/puppet/type/exec.rb +7 -8
- data/lib/puppet/type/file.rb +1 -1
- data/lib/puppet/type/file/content.rb +2 -2
- 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 +6 -2
- data/lib/puppet/type/file/source.rb +1 -1
- data/lib/puppet/type/schedule.rb +1 -1
- data/lib/puppet/type/scheduled_task.rb +1 -1
- data/lib/puppet/type/tidy.rb +1 -1
- data/lib/puppet/type/zone.rb +126 -253
- data/lib/puppet/util.rb +10 -23
- data/lib/puppet/util/adsi.rb +22 -14
- data/lib/puppet/util/log/destinations.rb +7 -0
- data/lib/puppet/util/log/rate_limited_logger.rb +40 -0
- data/lib/puppet/util/metric.rb +2 -2
- data/lib/puppet/util/monkey_patches.rb +8 -0
- data/lib/puppet/util/platform.rb +7 -0
- data/lib/puppet/util/selinux.rb +31 -36
- data/lib/puppet/util/windows/error.rb +1 -1
- data/lib/puppet/util/windows/process.rb +3 -3
- data/lib/puppet/util/windows/security.rb +7 -7
- data/lib/puppet/util/windows/user.rb +65 -2
- data/lib/puppet/util/zaml.rb +90 -46
- data/lib/puppet/version.rb +1 -1
- data/spec/fixtures/hiera.yaml +9 -0
- data/spec/fixtures/manifests/site.pp +0 -0
- data/spec/integration/defaults_spec.rb +25 -11
- data/spec/integration/faces/ca_spec.rb +11 -16
- data/spec/integration/network/server/webrick_spec.rb +14 -27
- data/spec/integration/node_spec.rb +4 -1
- data/spec/integration/parser/functions/require_spec.rb +3 -3
- data/spec/integration/parser/undef_param_spec.rb +88 -0
- data/spec/integration/provider/mount_spec.rb +4 -1
- data/spec/integration/ssl/certificate_authority_spec.rb +18 -0
- data/spec/lib/puppet_spec/files.rb +3 -3
- data/spec/lib/puppet_spec/settings.rb +0 -1
- data/spec/shared_contexts/platform.rb +8 -0
- data/spec/spec_helper.rb +6 -0
- data/spec/unit/agent/locker_spec.rb +8 -2
- data/spec/unit/application/agent_spec.rb +29 -7
- data/spec/unit/application/apply_spec.rb +1 -1
- data/spec/unit/application/device_spec.rb +18 -1
- data/spec/unit/application/face_base_spec.rb +16 -2
- data/spec/unit/application/kick_spec.rb +8 -0
- data/spec/unit/application/queue_spec.rb +5 -0
- data/spec/unit/application_spec.rb +13 -23
- data/spec/unit/configurer/downloader_spec.rb +2 -11
- data/spec/unit/configurer_spec.rb +6 -0
- data/spec/unit/face/node_spec.rb +1 -1
- data/spec/unit/hiera/backend/puppet_backend_spec.rb +140 -0
- data/spec/unit/hiera/scope_spec.rb +62 -0
- data/spec/unit/hiera_puppet_spec.rb +111 -0
- data/spec/unit/indirector/catalog/active_record_spec.rb +4 -0
- data/spec/unit/indirector/catalog/static_compiler_spec.rb +194 -0
- data/spec/unit/indirector/certificate/disabled_ca_spec.rb +33 -0
- data/spec/unit/indirector/certificate_request/disabled_ca_spec.rb +33 -0
- data/spec/unit/indirector/certificate_revocation_list/disabled_ca_spec.rb +33 -0
- data/spec/unit/indirector/facts/active_record_spec.rb +37 -26
- data/spec/unit/indirector/facts/inventory_active_record_spec.rb +5 -0
- data/spec/unit/indirector/hiera_spec.rb +2 -1
- data/spec/unit/indirector/key/disabled_ca_spec.rb +33 -0
- data/spec/unit/indirector/node/active_record_spec.rb +7 -0
- data/spec/unit/indirector/request_spec.rb +22 -0
- data/spec/unit/indirector/resource/active_record_spec.rb +5 -0
- data/spec/unit/module_tool/application_spec.rb +1 -1
- data/spec/unit/network/authentication_spec.rb +86 -0
- data/spec/unit/network/http/connection_spec.rb +21 -0
- data/spec/unit/network/http/handler_spec.rb +12 -0
- data/spec/unit/network/http/rack/rest_spec.rb +7 -0
- data/spec/unit/network/http/webrick_spec.rb +11 -26
- data/spec/unit/network/server_spec.rb +79 -192
- data/spec/unit/node/facts_spec.rb +2 -2
- data/spec/unit/parser/ast/vardef_spec.rb +4 -4
- data/spec/unit/parser/files_spec.rb +3 -0
- data/spec/unit/parser/functions/defined_spec.rb +5 -5
- data/spec/unit/parser/functions/fqdn_rand_spec.rb +1 -1
- data/spec/unit/parser/functions/hiera_array_spec.rb +23 -0
- data/spec/unit/parser/functions/hiera_hash_spec.rb +19 -0
- data/spec/unit/parser/functions/hiera_include_spec.rb +19 -0
- data/spec/unit/parser/functions/hiera_spec.rb +21 -0
- data/spec/unit/parser/functions/include_spec.rb +3 -3
- data/spec/unit/parser/functions/realize_spec.rb +3 -3
- data/spec/unit/parser/functions/require_spec.rb +5 -5
- data/spec/unit/parser/functions/shellquote_spec.rb +0 -4
- data/spec/unit/parser/functions_spec.rb +6 -10
- data/spec/unit/parser/lexer_spec.rb +13 -0
- data/spec/unit/parser/scope_spec.rb +16 -1
- data/spec/unit/provider/exec/posix_spec.rb +7 -6
- data/spec/unit/provider/group/groupadd_spec.rb +36 -30
- data/spec/unit/provider/package/pkg_spec.rb +16 -2
- data/spec/unit/provider/service/redhat_spec.rb +2 -2
- data/spec/unit/provider/sshkey/parsed_spec.rb +4 -0
- data/spec/unit/provider/user/user_role_add_spec.rb +125 -126
- data/spec/unit/provider/user/useradd_spec.rb +147 -118
- data/spec/unit/provider/user/windows_adsi_spec.rb +22 -0
- data/spec/unit/provider/zone/solaris_spec.rb +126 -7
- data/spec/unit/provider/zpool/zpool_spec.rb +4 -3
- data/spec/unit/puppet_spec.rb +7 -0
- data/spec/unit/settings/duration_setting_spec.rb +45 -0
- data/spec/unit/settings/terminus_setting_spec.rb +28 -0
- data/spec/unit/settings_spec.rb +21 -23
- data/spec/unit/ssl/base_spec.rb +68 -19
- data/spec/unit/ssl/certificate_authority/interface_spec.rb +19 -30
- data/spec/unit/ssl/certificate_authority_spec.rb +3 -2
- data/spec/unit/ssl/certificate_factory_spec.rb +15 -6
- data/spec/unit/ssl/certificate_request_spec.rb +80 -113
- data/spec/unit/ssl/certificate_revocation_list_spec.rb +1 -1
- data/spec/unit/ssl/certificate_spec.rb +26 -2
- data/spec/unit/ssl/digest_spec.rb +35 -0
- data/spec/unit/ssl/host_spec.rb +73 -27
- data/spec/unit/ssl/key_spec.rb +0 -4
- data/spec/unit/type/exec_spec.rb +1 -1
- data/spec/unit/type/file_spec.rb +2 -1
- data/spec/unit/type/scheduled_task_spec.rb +2 -2
- data/spec/unit/type/zone_spec.rb +52 -10
- data/spec/unit/util/adsi_spec.rb +19 -0
- data/spec/unit/util/checksums_spec.rb +2 -3
- data/spec/unit/util/execution_spec.rb +1 -1
- data/spec/unit/util/log/destinations_spec.rb +1 -0
- data/spec/unit/util/log/rate_limited_logger_spec.rb +51 -0
- data/spec/unit/util/logging_spec.rb +6 -6
- data/spec/unit/util/selinux_spec.rb +24 -32
- data/spec/unit/util/zaml_spec.rb +94 -6
- data/spec/unit/util_spec.rb +17 -0
- data/spec/watchr.rb +2 -6
- data/tasks/{rake/manpages.rake → manpages.rake} +0 -0
- data/tasks/{rake/parser.rake → parser.rake} +0 -0
- metadata +1003 -119
- data/CHANGELOG +0 -9233
- data/conf/osx/preflight +0 -24
- data/lib/puppet/network/http/mongrel.rb +0 -35
- data/lib/puppet/util/config_timeout.rb +0 -24
- data/spec/unit/network/http/mongrel/rest_spec.rb +0 -257
- data/spec/unit/network/http/mongrel_spec.rb +0 -91
- data/spec/unit/network/http_spec.rb +0 -31
- data/spec/unit/util/config_timeout_spec.rb +0 -57
- data/tasks/rake/apple.rake +0 -176
- data/tasks/rake/changelog.rake +0 -15
- data/tasks/rake/ci.rake +0 -22
- data/tasks/rake/dailybuild.rake +0 -9
- data/tasks/rake/gem.rake +0 -63
- data/tasks/rake/git_workflow.rake +0 -134
- data/tasks/rake/metrics.rake +0 -14
- data/tasks/rake/sign.rake +0 -14
- data/tasks/rake/testbranch.rake +0 -16
- data/tasks/rake/yard.rake +0 -11
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'hiera/scope'
|
3
|
+
|
4
|
+
describe Hiera::Scope do
|
5
|
+
describe "#initialize" do
|
6
|
+
it "should store the supplied puppet scope" do
|
7
|
+
real = {}
|
8
|
+
scope = Hiera::Scope.new(real)
|
9
|
+
scope.real.should == real
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "#[]" do
|
14
|
+
it "should treat '' as nil" do
|
15
|
+
real = mock
|
16
|
+
real.expects(:lookupvar).with("foo").returns("")
|
17
|
+
|
18
|
+
scope = Hiera::Scope.new(real)
|
19
|
+
scope["foo"].should == nil
|
20
|
+
end
|
21
|
+
|
22
|
+
it "sould return found data" do
|
23
|
+
real = mock
|
24
|
+
real.expects(:lookupvar).with("foo").returns("bar")
|
25
|
+
|
26
|
+
scope = Hiera::Scope.new(real)
|
27
|
+
scope["foo"].should == "bar"
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should get calling_class and calling_module from puppet scope" do
|
31
|
+
real = mock
|
32
|
+
resource = mock
|
33
|
+
resource.expects(:name).returns("Foo::Bar").twice
|
34
|
+
|
35
|
+
real.expects(:resource).returns(resource).twice
|
36
|
+
|
37
|
+
scope = Hiera::Scope.new(real)
|
38
|
+
scope["calling_class"].should == "foo::bar"
|
39
|
+
scope["calling_module"].should == "foo"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe "#include?" do
|
44
|
+
it "should correctly report missing data" do
|
45
|
+
real = mock
|
46
|
+
real.expects(:lookupvar).with("foo").returns("")
|
47
|
+
|
48
|
+
scope = Hiera::Scope.new(real)
|
49
|
+
scope.include?("foo").should == false
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should always return true for calling_class and calling_module" do
|
53
|
+
real = mock
|
54
|
+
real.expects(:lookupvar).with("calling_class").never
|
55
|
+
real.expects(:lookupvar).with("calling_module").never
|
56
|
+
|
57
|
+
scope = Hiera::Scope.new(real)
|
58
|
+
scope.include?("calling_class").should == true
|
59
|
+
scope.include?("calling_module").should == true
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,111 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'hiera_puppet'
|
3
|
+
|
4
|
+
describe 'HieraPuppet' do
|
5
|
+
describe 'HieraPuppet#hiera_config' do
|
6
|
+
let(:hiera_config_data) do
|
7
|
+
{ :backend => 'yaml' }
|
8
|
+
end
|
9
|
+
|
10
|
+
context "when the hiera_config_file exists" do
|
11
|
+
before do
|
12
|
+
Hiera::Config.expects(:load).returns(hiera_config_data)
|
13
|
+
HieraPuppet.expects(:hiera_config_file).returns(true)
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should return a configuration hash" do
|
17
|
+
expected_results = {
|
18
|
+
:backend => 'yaml',
|
19
|
+
:logger => 'puppet'
|
20
|
+
}
|
21
|
+
HieraPuppet.send(:hiera_config).should == expected_results
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
context "when the hiera_config_file does not exist" do
|
26
|
+
before do
|
27
|
+
Hiera::Config.expects(:load).never
|
28
|
+
HieraPuppet.expects(:hiera_config_file).returns(nil)
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should return a configuration hash" do
|
32
|
+
HieraPuppet.send(:hiera_config).should == { :logger => 'puppet' }
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe 'HieraPuppet#hiera_config_file' do
|
38
|
+
it "should return nil when we cannot derive the hiera config file form Puppet.settings" do
|
39
|
+
begin
|
40
|
+
Puppet.settings[:hiera_config] = nil
|
41
|
+
rescue ArgumentError => detail
|
42
|
+
raise unless detail.message =~ /unknown configuration parameter/
|
43
|
+
end
|
44
|
+
HieraPuppet.send(:hiera_config_file).should be_nil
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should use Puppet.settings[:hiera_config] as the hiera config file" do
|
48
|
+
begin
|
49
|
+
Puppet.settings[:hiera_config] = "/dev/null/my_hiera.yaml"
|
50
|
+
rescue ArgumentError => detail
|
51
|
+
raise unless detail.message =~ /unknown configuration parameter/
|
52
|
+
pending("This example does not apply to Puppet #{Puppet.version} because it does not have this setting")
|
53
|
+
end
|
54
|
+
|
55
|
+
File.stubs(:exist?).with(Puppet[:hiera_config]).returns(true)
|
56
|
+
HieraPuppet.send(:hiera_config_file).should == Puppet[:hiera_config]
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should use Puppet.settings[:confdir] as the base directory when hiera_config is not set" do
|
60
|
+
begin
|
61
|
+
Puppet.settings[:hiera_config] = nil
|
62
|
+
rescue ArgumentError => detail
|
63
|
+
raise unless detail.message =~ /unknown configuration parameter/
|
64
|
+
end
|
65
|
+
Puppet.settings[:confdir] = "/dev/null/puppet"
|
66
|
+
hiera_config = File.join(Puppet[:confdir], 'hiera.yaml')
|
67
|
+
File.stubs(:exist?).with(hiera_config).returns(true)
|
68
|
+
|
69
|
+
HieraPuppet.send(:hiera_config_file).should == hiera_config
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
describe 'HieraPuppet#lookup' do
|
74
|
+
let :scope do Puppet::Parser::Scope.new_for_test_harness('foo') end
|
75
|
+
|
76
|
+
before :each do
|
77
|
+
Puppet[:hiera_config] = PuppetSpec::Files.tmpfile('hiera_config')
|
78
|
+
end
|
79
|
+
|
80
|
+
it "should return the value from Hiera" do
|
81
|
+
Hiera.any_instance.stubs(:lookup).returns('8080')
|
82
|
+
HieraPuppet.lookup('port', nil, scope, nil, :priority).should == '8080'
|
83
|
+
|
84
|
+
Hiera.any_instance.stubs(:lookup).returns(['foo', 'bar'])
|
85
|
+
HieraPuppet.lookup('ntpservers', nil, scope, nil, :array).should == ['foo', 'bar']
|
86
|
+
|
87
|
+
Hiera.any_instance.stubs(:lookup).returns({'uid' => '1000'})
|
88
|
+
HieraPuppet.lookup('user', nil, scope, nil, :hash).should == {'uid' => '1000'}
|
89
|
+
end
|
90
|
+
|
91
|
+
it "should raise a useful error when the answer is nil" do
|
92
|
+
Hiera.any_instance.stubs(:lookup).returns(nil)
|
93
|
+
expect do
|
94
|
+
HieraPuppet.lookup('port', nil, scope, nil, :priority)
|
95
|
+
end.to raise_error(Puppet::ParseError,
|
96
|
+
/Could not find data item port in any Hiera data file and no default supplied/)
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
describe 'HieraPuppet#parse_args' do
|
101
|
+
it 'should return a 3 item array' do
|
102
|
+
args = ['foo', '8080', nil, nil]
|
103
|
+
HieraPuppet.parse_args(args).should == ['foo', '8080', nil]
|
104
|
+
end
|
105
|
+
|
106
|
+
it 'should raise a useful error when no key is supplied' do
|
107
|
+
expect { HieraPuppet.parse_args([]) }.to raise_error(Puppet::ParseError,
|
108
|
+
/Please supply a parameter to perform a Hiera lookup/)
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
@@ -15,6 +15,10 @@ describe "Puppet::Resource::Catalog::ActiveRecord", :if => can_use_scratch_datab
|
|
15
15
|
Puppet::Resource::Catalog::ActiveRecord.new
|
16
16
|
end
|
17
17
|
|
18
|
+
it "should issue a deprecation warning" do
|
19
|
+
Puppet.expects(:deprecation_warning).with() { |msg| msg =~ /ActiveRecord-based storeconfigs and inventory are deprecated/ }
|
20
|
+
terminus
|
21
|
+
end
|
18
22
|
|
19
23
|
it "should be a subclass of the ActiveRecord terminus class" do
|
20
24
|
Puppet::Resource::Catalog::ActiveRecord.ancestors.should be_include(Puppet::Indirector::ActiveRecord)
|
@@ -0,0 +1,194 @@
|
|
1
|
+
#! /usr/bin/env ruby -S rspec
|
2
|
+
require 'spec_helper'
|
3
|
+
require 'puppet/indirector/catalog/static_compiler'
|
4
|
+
require 'puppet/file_serving/metadata'
|
5
|
+
require 'puppet/file_serving/content'
|
6
|
+
require 'yaml'
|
7
|
+
|
8
|
+
describe Puppet::Resource::Catalog::StaticCompiler do
|
9
|
+
before :all do
|
10
|
+
@num_file_resources = 10
|
11
|
+
end
|
12
|
+
|
13
|
+
let(:request) do
|
14
|
+
Puppet::Indirector::Request.new(:the_indirection_named_foo,
|
15
|
+
:find,
|
16
|
+
"the-node-named-foo",
|
17
|
+
:environment => "production")
|
18
|
+
end
|
19
|
+
|
20
|
+
describe "#find" do
|
21
|
+
it "returns a catalog" do
|
22
|
+
subject.find(request).should be_a_kind_of(Puppet::Resource::Catalog)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "returns nil if there is no compiled catalog" do
|
26
|
+
compiler = mock('compiler indirection')
|
27
|
+
compiler.expects(:find).with(request).returns(nil)
|
28
|
+
|
29
|
+
subject.expects(:compiler).returns(compiler)
|
30
|
+
subject.find(request).should be_nil
|
31
|
+
end
|
32
|
+
|
33
|
+
describe "a catalog with file resources containing source parameters with puppet:// URIs" do
|
34
|
+
it "filters file resource source URI's to checksums" do
|
35
|
+
stub_the_compiler
|
36
|
+
resource_catalog = subject.find(request)
|
37
|
+
resource_catalog.resources.each do |resource|
|
38
|
+
next unless resource.type == "File"
|
39
|
+
resource[:content].should == "{md5}361fadf1c712e812d198c4cab5712a79"
|
40
|
+
resource[:source].should be_nil
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
it "does not modify file resources with non-puppet:// URI's" do
|
45
|
+
uri = "/this/is/not/a/puppet/uri.txt"
|
46
|
+
stub_the_compiler(:source => uri)
|
47
|
+
resource_catalog = subject.find(request)
|
48
|
+
resource_catalog.resources.each do |resource|
|
49
|
+
next unless resource.type == "File"
|
50
|
+
resource[:content].should be_nil
|
51
|
+
resource[:source].should == uri
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
it "copies the owner, group and mode from the fileserer" do
|
56
|
+
stub_the_compiler
|
57
|
+
resource_catalog = subject.find(request)
|
58
|
+
resource_catalog.resources.each do |resource|
|
59
|
+
next unless resource.type == "File"
|
60
|
+
resource[:owner].should == 0
|
61
|
+
resource[:group].should == 0
|
62
|
+
resource[:mode].should == 420
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
describe "(#15193) when storing content to the filebucket" do
|
69
|
+
it "explicitly uses the indirection method" do
|
70
|
+
# Do not stub the store_content method which is stubbed by default in the
|
71
|
+
# value of the stub_methods option.
|
72
|
+
stub_the_compiler(:stub_methods => false)
|
73
|
+
|
74
|
+
# We expect the content to be retrieved from the FileServer ...
|
75
|
+
fake_content = mock('FileServer Content')
|
76
|
+
fake_content.expects(:content).returns("HELLO WORLD")
|
77
|
+
|
78
|
+
# Mock the FileBucket to behave as if the file content does not exist.
|
79
|
+
# NOTE, we're simulating the first call returning false, indicating the
|
80
|
+
# file is not present, then all subsequent calls returning true. This
|
81
|
+
# mocked behavior is intended to replicate the real behavior of the same
|
82
|
+
# file being stored to the filebucket multiple times.
|
83
|
+
Puppet::FileBucket::File.indirection.
|
84
|
+
expects(:find).times(@num_file_resources).
|
85
|
+
returns(false).then.returns(true)
|
86
|
+
|
87
|
+
Puppet::FileServing::Content.indirection.
|
88
|
+
expects(:find).once.
|
89
|
+
returns(fake_content)
|
90
|
+
|
91
|
+
# Once retrived from the FileServer, we expect the file to be stored into
|
92
|
+
# the FileBucket only once. All of the file resources in the fake
|
93
|
+
# catalog have the same content.
|
94
|
+
Puppet::FileBucket::File.indirection.expects(:save).once.with do |file|
|
95
|
+
file.contents == "HELLO WORLD"
|
96
|
+
end
|
97
|
+
|
98
|
+
# Obtain the Static Catalog
|
99
|
+
resource_catalog = subject.find(request)
|
100
|
+
|
101
|
+
# Ensure all of the file resources were filtered
|
102
|
+
resource_catalog.resources.each do |resource|
|
103
|
+
next unless resource.type == "File"
|
104
|
+
resource[:content].should == "{md5}361fadf1c712e812d198c4cab5712a79"
|
105
|
+
resource[:source].should be_nil
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
# Spec helper methods
|
111
|
+
|
112
|
+
def stub_the_compiler(options = {:stub_methods => [:store_content]})
|
113
|
+
# Build a resource catalog suitable for specifying the behavior of the
|
114
|
+
# static compiler.
|
115
|
+
compiler = mock('indirection terminus compiler')
|
116
|
+
compiler.stubs(:find).returns(build_catalog(options))
|
117
|
+
subject.stubs(:compiler).returns(compiler)
|
118
|
+
# Mock the store content method to prevent copying the contents to the
|
119
|
+
# file bucket.
|
120
|
+
(options[:stub_methods] || []).each do |mthd|
|
121
|
+
subject.stubs(mthd)
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
def build_catalog(options = {})
|
126
|
+
options = options.dup
|
127
|
+
options[:source] ||= 'puppet:///modules/mymodule/config_file.txt'
|
128
|
+
options[:request] ||= request
|
129
|
+
|
130
|
+
# Build a catalog suitable for the static compiler to operate on
|
131
|
+
catalog = Puppet::Resource::Catalog.new("#{options[:request].key}")
|
132
|
+
|
133
|
+
# Mock out the fileserver, otherwise converting the catalog to a
|
134
|
+
fake_fileserver_metadata = fileserver_metadata(options)
|
135
|
+
|
136
|
+
# Stub the call to the FileServer metadata API so we don't have to have
|
137
|
+
# a real fileserver initialized for testing.
|
138
|
+
Puppet::FileServing::Metadata.
|
139
|
+
indirection.stubs(:find).
|
140
|
+
with() { |*args| args[0] == options[:source].sub('puppet:///','') }.
|
141
|
+
returns(fake_fileserver_metadata)
|
142
|
+
|
143
|
+
# I want a resource that all the file resources require and another
|
144
|
+
# that requires them.
|
145
|
+
resources = Array.new
|
146
|
+
resources << Puppet::Resource.new("notify", "alpha")
|
147
|
+
resources << Puppet::Resource.new("notify", "omega")
|
148
|
+
|
149
|
+
# Create some File resources with source parameters.
|
150
|
+
1.upto(@num_file_resources) do |idx|
|
151
|
+
parameters = {
|
152
|
+
:ensure => 'file',
|
153
|
+
:source => options[:source],
|
154
|
+
:require => "Notify[alpha]",
|
155
|
+
:before => "Notify[omega]"
|
156
|
+
}
|
157
|
+
# The static compiler does not operate on a RAL catalog, so we're
|
158
|
+
# using Puppet::Resource to produce a resource catalog.
|
159
|
+
agnostic_path = File.expand_path("/tmp/file_#{idx}.txt") # Windows Friendly
|
160
|
+
rsrc = Puppet::Resource.new("file", agnostic_path, :parameters => parameters)
|
161
|
+
rsrc.file = 'site.pp'
|
162
|
+
rsrc.line = idx
|
163
|
+
resources << rsrc
|
164
|
+
end
|
165
|
+
|
166
|
+
resources.each do |rsrc|
|
167
|
+
catalog.add_resource(rsrc)
|
168
|
+
end
|
169
|
+
|
170
|
+
# Return the resource catalog
|
171
|
+
catalog
|
172
|
+
end
|
173
|
+
|
174
|
+
def fileserver_metadata(options = {})
|
175
|
+
yaml = <<EOFILESERVERMETADATA
|
176
|
+
--- !ruby/object:Puppet::FileServing::Metadata
|
177
|
+
checksum: "{md5}361fadf1c712e812d198c4cab5712a79"
|
178
|
+
checksum_type: md5
|
179
|
+
destination:
|
180
|
+
expiration: #{Time.now + 1800}
|
181
|
+
ftype: file
|
182
|
+
group: 0
|
183
|
+
links: !ruby/sym manage
|
184
|
+
mode: 420
|
185
|
+
owner: 0
|
186
|
+
path: #{File.expand_path('/etc/puppet/modules/mymodule/files/config_file.txt')}
|
187
|
+
source: #{options[:source]}
|
188
|
+
stat_method: !ruby/sym lstat
|
189
|
+
EOFILESERVERMETADATA
|
190
|
+
# Return a deserialized metadata object suitable for returning from a stub.
|
191
|
+
YAML.load(yaml)
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
@@ -0,0 +1,33 @@
|
|
1
|
+
#! /usr/bin/env ruby -S rspec
|
2
|
+
require 'spec_helper'
|
3
|
+
require 'puppet/indirector/certificate/disabled_ca'
|
4
|
+
|
5
|
+
describe Puppet::SSL::Certificate::DisabledCa do
|
6
|
+
def request(type, remote)
|
7
|
+
r = Puppet::Indirector::Request.new(:certificate, type, "foo.com", nil)
|
8
|
+
if remote
|
9
|
+
r.ip = '10.0.0.1'
|
10
|
+
r.node = 'agent.example.com'
|
11
|
+
end
|
12
|
+
r
|
13
|
+
end
|
14
|
+
|
15
|
+
context "when not a CA" do
|
16
|
+
before :each do
|
17
|
+
Puppet[:ca] = false
|
18
|
+
Puppet::SSL::Host.ca_location = :none
|
19
|
+
end
|
20
|
+
|
21
|
+
[:find, :head, :search, :save, :destroy].each do |name|
|
22
|
+
it "should fail remote #{name} requests" do
|
23
|
+
expect { subject.send(name, request(name, true)) }.
|
24
|
+
to raise_error Puppet::Error, /is not a CA/
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should forward local #{name} requests" do
|
28
|
+
Puppet::SSL::Certificate.indirection.terminus(:file).expects(name)
|
29
|
+
subject.send(name, request(name, false))
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
#! /usr/bin/env ruby -S rspec
|
2
|
+
require 'spec_helper'
|
3
|
+
require 'puppet/indirector/certificate_request/disabled_ca'
|
4
|
+
|
5
|
+
describe Puppet::SSL::CertificateRequest::DisabledCa do
|
6
|
+
def request(type, remote)
|
7
|
+
r = Puppet::Indirector::Request.new(:certificate_request, type, "foo.com", nil)
|
8
|
+
if remote
|
9
|
+
r.ip = '10.0.0.1'
|
10
|
+
r.node = 'agent.example.com'
|
11
|
+
end
|
12
|
+
r
|
13
|
+
end
|
14
|
+
|
15
|
+
context "when not a CA" do
|
16
|
+
before :each do
|
17
|
+
Puppet[:ca] = false
|
18
|
+
Puppet::SSL::Host.ca_location = :none
|
19
|
+
end
|
20
|
+
|
21
|
+
[:find, :head, :search, :save, :destroy].each do |name|
|
22
|
+
it "should fail remote #{name} requests" do
|
23
|
+
expect { subject.send(name, request(name, true)) }.
|
24
|
+
to raise_error Puppet::Error, /is not a CA/
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should forward local #{name} requests" do
|
28
|
+
Puppet::SSL::CertificateRequest.indirection.terminus(:file).expects(name)
|
29
|
+
subject.send(name, request(name, false))
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|