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
@@ -1,111 +1,140 @@
|
|
1
1
|
#! /usr/bin/env ruby -S rspec
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
@provider = provider_class.new(@resource)
|
4
|
+
describe Puppet::Type.type(:user).provider(:useradd) do
|
5
|
+
|
6
|
+
before :each do
|
7
|
+
described_class.stubs(:command).with(:password).returns '/usr/bin/chage'
|
8
|
+
described_class.stubs(:command).with(:add).returns '/usr/sbin/useradd'
|
9
|
+
described_class.stubs(:command).with(:modify).returns '/usr/sbin/usermod'
|
10
|
+
described_class.stubs(:command).with(:delete).returns '/usr/sbin/userdel'
|
12
11
|
end
|
13
12
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
13
|
+
let(:resource) do
|
14
|
+
Puppet::Type.type(:user).new(
|
15
|
+
:name => 'myuser',
|
16
|
+
:managehome => :false,
|
17
|
+
:system => :false,
|
18
|
+
:provider => provider
|
19
|
+
)
|
21
20
|
end
|
22
21
|
|
23
|
-
|
24
|
-
@resource.expects(:allowdupe?).returns true
|
25
|
-
@provider.expects(:execute).with { |args| args.include?("-o") }
|
22
|
+
let(:provider) { described_class.new(:name => 'myuser') }
|
26
23
|
|
27
|
-
|
28
|
-
|
24
|
+
describe "#create" do
|
25
|
+
|
26
|
+
it "should add -o when allowdupe is enabled and the user is being created" do
|
27
|
+
resource[:allowdupe] = true
|
28
|
+
provider.expects(:execute).with(['/usr/sbin/useradd', '-o', 'myuser'])
|
29
|
+
provider.create
|
30
|
+
end
|
31
|
+
|
32
|
+
describe "on systems that support has_system", :if => described_class.system_users? do
|
33
|
+
it "should add -r when system is enabled" do
|
34
|
+
resource[:system] = :true
|
35
|
+
provider.should be_system_users
|
36
|
+
provider.expects(:execute).with(['/usr/sbin/useradd', '-r', 'myuser'])
|
37
|
+
provider.create
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe "on systems that do not support has_system", :unless => described_class.system_users? do
|
42
|
+
it "should not add -r when system is enabled" do
|
43
|
+
resource[:system] = :true
|
44
|
+
provider.should_not be_system_users
|
45
|
+
provider.expects(:execute).with(['/usr/sbin/useradd', 'myuser'])
|
46
|
+
provider.create
|
47
|
+
end
|
48
|
+
end
|
29
49
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
50
|
+
it "should set password age rules" do
|
51
|
+
described_class.has_feature :manages_password_age
|
52
|
+
resource[:password_min_age] = 5
|
53
|
+
resource[:password_max_age] = 10
|
54
|
+
provider.expects(:execute).with(['/usr/sbin/useradd', 'myuser'])
|
55
|
+
provider.expects(:execute).with(['/usr/bin/chage', '-m', 5, '-M', 10, 'myuser'])
|
56
|
+
provider.create
|
57
|
+
end
|
36
58
|
end
|
37
59
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
@provider.create
|
60
|
+
describe "#uid=" do
|
61
|
+
it "should add -o when allowdupe is enabled and the uid is being modified" do
|
62
|
+
resource[:allowdupe] = :true
|
63
|
+
provider.expects(:execute).with(['/usr/sbin/usermod', '-u', 150, '-o', 'myuser'])
|
64
|
+
provider.uid = 150
|
65
|
+
end
|
45
66
|
end
|
46
67
|
|
47
|
-
describe "
|
68
|
+
describe "#check_allow_dup" do
|
48
69
|
it "should check allow dup" do
|
49
|
-
|
50
|
-
|
70
|
+
resource.expects(:allowdupe?)
|
71
|
+
provider.check_allow_dup
|
51
72
|
end
|
52
73
|
|
53
74
|
it "should return an array with a flag if dup is allowed" do
|
54
|
-
|
55
|
-
|
75
|
+
resource[:allowdupe] = :true
|
76
|
+
provider.check_allow_dup.must == ["-o"]
|
56
77
|
end
|
57
78
|
|
58
79
|
it "should return an empty array if no dup is allowed" do
|
59
|
-
|
60
|
-
|
80
|
+
resource[:allowdupe] = :false
|
81
|
+
provider.check_allow_dup.must == []
|
61
82
|
end
|
62
83
|
end
|
63
84
|
|
64
|
-
describe "
|
85
|
+
describe "#check_system_users" do
|
65
86
|
it "should check system users" do
|
66
|
-
|
67
|
-
|
87
|
+
described_class.expects(:system_users?).returns true
|
88
|
+
resource.expects(:system?)
|
89
|
+
provider.check_system_users
|
68
90
|
end
|
69
91
|
|
70
92
|
it "should return an array with a flag if it's a system user" do
|
71
|
-
|
72
|
-
|
93
|
+
described_class.expects(:system_users?).returns true
|
94
|
+
resource[:system] = :true
|
95
|
+
provider.check_system_users.must == ["-r"]
|
73
96
|
end
|
74
97
|
|
75
98
|
it "should return an empty array if it's not a system user" do
|
76
|
-
|
77
|
-
|
99
|
+
described_class.expects(:system_users?).returns true
|
100
|
+
resource[:system] = :false
|
101
|
+
provider.check_system_users.must == []
|
102
|
+
end
|
103
|
+
|
104
|
+
it "should return an empty array if system user is not featured" do
|
105
|
+
described_class.expects(:system_users?).returns false
|
106
|
+
resource[:system] = :true
|
107
|
+
provider.check_system_users.must == []
|
78
108
|
end
|
79
109
|
end
|
80
110
|
|
81
|
-
describe "
|
111
|
+
describe "#check_manage_home" do
|
82
112
|
it "should check manage home" do
|
83
|
-
|
84
|
-
|
113
|
+
resource.expects(:managehome?)
|
114
|
+
provider.check_manage_home
|
85
115
|
end
|
86
116
|
|
87
117
|
it "should return an array with -m flag if home is managed" do
|
88
|
-
|
89
|
-
|
118
|
+
resource[:managehome] = :true
|
119
|
+
provider.check_manage_home.must == ["-m"]
|
90
120
|
end
|
91
|
-
|
121
|
+
|
92
122
|
it "should return an array with -r flag if home is managed" do
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
@provider.deletecmd.must == ["userdel", "-r", "fakeval"]
|
123
|
+
resource[:managehome] = :true
|
124
|
+
resource[:ensure] = :absent
|
125
|
+
provider.deletecmd.must == ['/usr/sbin/userdel', '-r', 'myuser']
|
97
126
|
end
|
98
127
|
|
99
128
|
it "should return an array with -M if home is not managed and on Redhat" do
|
100
|
-
Facter.stubs(:value).with(
|
101
|
-
|
102
|
-
|
129
|
+
Facter.stubs(:value).with(:operatingsystem).returns("RedHat")
|
130
|
+
resource[:managehome] = :false
|
131
|
+
provider.check_manage_home.must == ["-M"]
|
103
132
|
end
|
104
133
|
|
105
134
|
it "should return an empty array if home is not managed and not on Redhat" do
|
106
|
-
Facter.stubs(:value).with(
|
107
|
-
|
108
|
-
|
135
|
+
Facter.stubs(:value).with(:operatingsystem).returns("some OS")
|
136
|
+
resource[:managehome] = :false
|
137
|
+
provider.check_manage_home.must == []
|
109
138
|
end
|
110
139
|
end
|
111
140
|
|
@@ -116,107 +145,107 @@ describe provider_class do
|
|
116
145
|
it "should return and array of flags and values"
|
117
146
|
end
|
118
147
|
|
119
|
-
describe "
|
148
|
+
describe "#addcmd" do
|
120
149
|
before do
|
121
|
-
|
122
|
-
|
123
|
-
|
150
|
+
resource[:allowdupe] = :true
|
151
|
+
resource[:managehome] = :true
|
152
|
+
resource[:system] = :true
|
124
153
|
end
|
125
154
|
|
126
155
|
it "should call command with :add" do
|
127
|
-
|
128
|
-
|
156
|
+
provider.expects(:command).with(:add)
|
157
|
+
provider.addcmd
|
129
158
|
end
|
130
159
|
|
131
160
|
it "should add properties" do
|
132
|
-
|
133
|
-
|
161
|
+
provider.expects(:add_properties).returns(['-foo_add_properties'])
|
162
|
+
provider.addcmd.should include '-foo_add_properties'
|
134
163
|
end
|
135
164
|
|
136
165
|
it "should check and add if dup allowed" do
|
137
|
-
|
138
|
-
|
166
|
+
provider.expects(:check_allow_dup).returns(['-allow_dup_flag'])
|
167
|
+
provider.addcmd.should include '-allow_dup_flag'
|
139
168
|
end
|
140
169
|
|
141
170
|
it "should check and add if home is managed" do
|
142
|
-
|
143
|
-
|
171
|
+
provider.expects(:check_manage_home).returns(['-manage_home_flag'])
|
172
|
+
provider.addcmd.should include '-manage_home_flag'
|
144
173
|
end
|
145
174
|
|
146
175
|
it "should add the resource :name" do
|
147
|
-
|
148
|
-
@provider.addcmd
|
176
|
+
provider.addcmd.should include 'myuser'
|
149
177
|
end
|
150
178
|
|
151
|
-
|
152
|
-
|
179
|
+
describe "on systems featuring system_users", :if => described_class.system_users? do
|
180
|
+
it "should return an array with -r if system? is true" do
|
181
|
+
resource[:system] = :true
|
182
|
+
provider.addcmd.should include("-r")
|
183
|
+
end
|
153
184
|
|
154
|
-
|
185
|
+
it "should return an array without -r if system? is false" do
|
186
|
+
resource[:system] = :false
|
187
|
+
provider.addcmd.should_not include("-r")
|
188
|
+
end
|
155
189
|
end
|
156
190
|
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
191
|
+
describe "on systems not featuring system_users", :unless => described_class.system_users? do
|
192
|
+
[:false, :true].each do |system|
|
193
|
+
it "should return an array without -r if system? is #{system}" do
|
194
|
+
resource[:system] = system
|
195
|
+
provider.addcmd.should_not include("-r")
|
196
|
+
end
|
197
|
+
end
|
161
198
|
end
|
162
199
|
|
163
200
|
it "should return an array with full command" do
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
201
|
+
described_class.expects(:system_users?).returns true
|
202
|
+
provider.stubs(:add_properties).returns(["-G", "somegroup"])
|
203
|
+
resource[:expiry] = "2012-08-18"
|
204
|
+
|
205
|
+
provider.addcmd.must == ["/usr/sbin/useradd", "-G", "somegroup", "-o", "-m", '-e 2012-08-18', "-r", "myuser"]
|
169
206
|
end
|
170
207
|
|
171
208
|
it "should return an array without -e if expiry is undefined full command" do
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
@resource.stubs(:[]).with(:expiry).returns nil
|
176
|
-
@provider.addcmd.must == ["useradd", "-G", "somegroup", "-o", "-m", "-r", "someuser"]
|
209
|
+
described_class.expects(:system_users?).returns true
|
210
|
+
provider.stubs(:add_properties).returns(["-G", "somegroup"])
|
211
|
+
provider.addcmd.must == ["/usr/sbin/useradd", "-G", "somegroup", "-o", "-m", "-r", "myuser"]
|
177
212
|
end
|
178
213
|
end
|
179
214
|
|
180
|
-
describe "
|
215
|
+
describe "#passcmd" do
|
181
216
|
before do
|
182
|
-
|
183
|
-
|
184
|
-
|
217
|
+
resource[:allowdupe] = :true
|
218
|
+
resource[:managehome] = :true
|
219
|
+
resource[:system] = :true
|
220
|
+
described_class.has_feature :manages_password_age
|
185
221
|
end
|
186
222
|
|
187
223
|
it "should call command with :pass" do
|
188
|
-
|
189
|
-
|
224
|
+
# command(:password) is only called inside passcmd if
|
225
|
+
# password_min_age or password_max_age is set
|
226
|
+
resource[:password_min_age] = 123
|
227
|
+
provider.expects(:command).with(:password)
|
228
|
+
provider.passcmd
|
190
229
|
end
|
191
230
|
|
192
231
|
it "should return nil if neither min nor max is set" do
|
193
|
-
|
194
|
-
@resource.stubs(:should).with(:password_max_age).returns nil
|
195
|
-
@provider.passcmd.must == nil
|
232
|
+
provider.passcmd.must be_nil
|
196
233
|
end
|
197
234
|
|
198
235
|
it "should return a chage command array with -m <value> and the user name if password_min_age is set" do
|
199
|
-
|
200
|
-
|
201
|
-
@resource.stubs(:should).with(:password_min_age).returns 123
|
202
|
-
@resource.stubs(:should).with(:password_max_age).returns nil
|
203
|
-
@provider.passcmd.must == ['chage','-m',123,'someuser']
|
236
|
+
resource[:password_min_age] = 123
|
237
|
+
provider.passcmd.must == ['/usr/bin/chage','-m',123,'myuser']
|
204
238
|
end
|
205
239
|
|
206
240
|
it "should return a chage command array with -M <value> if password_max_age is set" do
|
207
|
-
|
208
|
-
|
209
|
-
@resource.stubs(:should).with(:password_min_age).returns nil
|
210
|
-
@resource.stubs(:should).with(:password_max_age).returns 999
|
211
|
-
@provider.passcmd.must == ['chage','-M',999,'someuser']
|
241
|
+
resource[:password_max_age] = 999
|
242
|
+
provider.passcmd.must == ['/usr/bin/chage','-M',999,'myuser']
|
212
243
|
end
|
213
244
|
|
214
245
|
it "should return a chage command array with -M <value> -m <value> if both password_min_age and password_max_age are set" do
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
@resource.stubs(:should).with(:password_max_age).returns 999
|
219
|
-
@provider.passcmd.must == ['chage','-m',123,'-M',999,'someuser']
|
246
|
+
resource[:password_min_age] = 123
|
247
|
+
resource[:password_max_age] = 999
|
248
|
+
provider.passcmd.must == ['/usr/bin/chage','-m',123,'-M',999,'myuser']
|
220
249
|
end
|
221
250
|
end
|
222
251
|
end
|
@@ -83,6 +83,17 @@ describe Puppet::Type.type(:user).provider(:windows_adsi) do
|
|
83
83
|
provider.create
|
84
84
|
end
|
85
85
|
|
86
|
+
it "should load the profile if managehome is set", :if => Puppet.features.microsoft_windows? do
|
87
|
+
resource[:password] = '0xDeadBeef'
|
88
|
+
resource[:managehome] = true
|
89
|
+
|
90
|
+
user = stub_everything 'user'
|
91
|
+
Puppet::Util::ADSI::User.expects(:create).with('testuser').returns user
|
92
|
+
Puppet::Util::Windows::User.expects(:load_profile).with('testuser', '0xDeadBeef')
|
93
|
+
|
94
|
+
provider.create
|
95
|
+
end
|
96
|
+
|
86
97
|
it "should set a user's password" do
|
87
98
|
provider.user.expects(:password=).with('plaintextbad')
|
88
99
|
|
@@ -125,6 +136,17 @@ describe Puppet::Type.type(:user).provider(:windows_adsi) do
|
|
125
136
|
provider.delete
|
126
137
|
end
|
127
138
|
|
139
|
+
it 'should delete the profile if managehome is set' do
|
140
|
+
resource[:managehome] = true
|
141
|
+
|
142
|
+
sid = 'S-A-B-C'
|
143
|
+
Puppet::Util::ADSI.expects(:sid_for_account).with('testuser').returns(sid)
|
144
|
+
Puppet::Util::ADSI::UserProfile.expects(:delete).with(sid)
|
145
|
+
connection.expects(:Delete).with('user', 'testuser')
|
146
|
+
|
147
|
+
provider.delete
|
148
|
+
end
|
149
|
+
|
128
150
|
it "should commit the user when flushed" do
|
129
151
|
provider.user.expects(:commit)
|
130
152
|
|
@@ -3,13 +3,23 @@ require 'spec_helper'
|
|
3
3
|
|
4
4
|
describe Puppet::Type.type(:zone).provider(:solaris) do
|
5
5
|
let(:resource) { Puppet::Type.type(:zone).new(:name => 'dummy', :path => '/', :provider => :solaris) }
|
6
|
-
let(:provider) { resource
|
6
|
+
let(:provider) { described_class.new(resource) }
|
7
7
|
|
8
8
|
context "#configure" do
|
9
9
|
it "should add the create args to the create str" do
|
10
10
|
resource.stubs(:properties).returns([])
|
11
11
|
resource[:create_args] = "create_args"
|
12
|
-
provider.expects(:setconfig).with("create -b create_args
|
12
|
+
provider.expects(:setconfig).with("create -b create_args")
|
13
|
+
provider.configure
|
14
|
+
end
|
15
|
+
it "should add the create args to the create str" do
|
16
|
+
iptype = stub "property"
|
17
|
+
iptype.stubs(:name).with().returns(:iptype)
|
18
|
+
iptype.stubs(:safe_insync?).with(iptype).returns(false)
|
19
|
+
provider.stubs(:properties).returns({:iptype => iptype})
|
20
|
+
resource.stubs(:properties).with().returns([iptype])
|
21
|
+
resource[:create_args] = "create_args"
|
22
|
+
provider.expects(:setconfig).with("create -b create_args\nset ip-type=shared")
|
13
23
|
provider.configure
|
14
24
|
end
|
15
25
|
end
|
@@ -59,18 +69,127 @@ describe Puppet::Type.type(:zone).provider(:solaris) do
|
|
59
69
|
end
|
60
70
|
context "#setconfig" do
|
61
71
|
it "should correctly set configuration" do
|
62
|
-
provider.expects(:
|
63
|
-
|
64
|
-
provider.setconfig("
|
72
|
+
provider.expects(:command).with(:cfg).returns('/usr/sbin/zonecfg')
|
73
|
+
provider.expects(:exec_cmd).with(:input => "set zonepath=/\ncommit\nexit", :cmd => '/usr/sbin/zonecfg -z dummy -f -').returns({:out=>'', :exit => 0})
|
74
|
+
provider.setconfig("set zonepath=\/")
|
75
|
+
provider.flush
|
65
76
|
end
|
66
77
|
|
67
78
|
it "should correctly warn on 'not allowed'" do
|
68
|
-
provider.expects(:
|
79
|
+
provider.expects(:command).with(:cfg).returns('/usr/sbin/zonecfg')
|
80
|
+
provider.expects(:exec_cmd).with(:input => "set zonepath=/\ncommit\nexit", :cmd => '/usr/sbin/zonecfg -z dummy -f -').returns({:out=>"Zone z2 already installed; set zonepath not allowed.\n", :exit => 0})
|
81
|
+
provider.setconfig("set zonepath=\/")
|
69
82
|
expect {
|
70
|
-
provider.
|
83
|
+
provider.flush
|
71
84
|
}.to raise_error(ArgumentError, /Failed to apply configuration/)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
context "#getconfig" do
|
88
|
+
zone_info =<<-EOF
|
89
|
+
zonename: dummy
|
90
|
+
zonepath: /dummy/z
|
91
|
+
brand: native
|
92
|
+
autoboot: true
|
93
|
+
bootargs:
|
94
|
+
pool:
|
95
|
+
limitpriv:
|
96
|
+
scheduling-class:
|
97
|
+
ip-type: shared
|
98
|
+
hostid:
|
99
|
+
net:
|
100
|
+
address: 1.1.1.1
|
101
|
+
physical: ex0001
|
102
|
+
defrouter not specified
|
103
|
+
net:
|
104
|
+
address: 1.1.1.2
|
105
|
+
physical: ex0002
|
106
|
+
defrouter not specified
|
107
|
+
EOF
|
108
|
+
it "should correctly parse zone info" do
|
109
|
+
provider.expects(:zonecfg).with(:info).returns(zone_info)
|
110
|
+
provider.getconfig.should == {
|
111
|
+
:brand=>"native",
|
112
|
+
:autoboot=>"true",
|
113
|
+
:"ip-type"=>"shared",
|
114
|
+
:zonename=>"dummy",
|
115
|
+
"net"=>[{:physical=>"ex0001", :address=>"1.1.1.1"}, {:physical=>"ex0002", :address=>"1.1.1.2"}],
|
116
|
+
:zonepath=>"/dummy/z"
|
117
|
+
}
|
118
|
+
end
|
119
|
+
end
|
120
|
+
context "#flush" do
|
121
|
+
it "should correctly execute pending commands" do
|
122
|
+
provider.expects(:command).with(:cfg).returns('/usr/sbin/zonecfg')
|
123
|
+
provider.expects(:exec_cmd).with(:input => "set iptype=shared\ncommit\nexit", :cmd => '/usr/sbin/zonecfg -z dummy -f -').returns({:out=>'', :exit => 0})
|
124
|
+
provider.setconfig("set iptype=shared")
|
125
|
+
provider.flush
|
126
|
+
end
|
127
|
+
|
128
|
+
it "should correctly raise error on failure" do
|
129
|
+
provider.expects(:command).with(:cfg).returns('/usr/sbin/zonecfg')
|
130
|
+
provider.expects(:exec_cmd).with(:input => "set iptype=shared\ncommit\nexit", :cmd => '/usr/sbin/zonecfg -z dummy -f -').returns({:out=>'', :exit => 1})
|
131
|
+
provider.setconfig("set iptype=shared")
|
132
|
+
expect {
|
133
|
+
provider.flush
|
134
|
+
}.to raise_error(ArgumentError, /Failed to apply/)
|
135
|
+
end
|
136
|
+
end
|
137
|
+
context "#start" do
|
138
|
+
it "should not require path if sysidcfg is specified" do
|
139
|
+
resource[:path] = '/mypath'
|
140
|
+
resource[:sysidcfg] = 'dummy'
|
141
|
+
File.stubs(:exists?).with('/mypath/root/etc/sysidcfg').returns true
|
142
|
+
File.stubs(:directory?).with('/mypath/root/etc').returns true
|
143
|
+
provider.expects(:zoneadm).with(:boot)
|
144
|
+
provider.start
|
145
|
+
end
|
72
146
|
|
147
|
+
it "should require path if sysidcfg is specified" do
|
148
|
+
resource.stubs(:[]).with(:path).returns nil
|
149
|
+
resource.stubs(:[]).with(:sysidcfg).returns 'dummy'
|
150
|
+
expect {
|
151
|
+
provider.start
|
152
|
+
}.to raise_error(Puppet::Error, /Path is required/)
|
153
|
+
end
|
154
|
+
end
|
155
|
+
context "#line2hash" do
|
156
|
+
it "should parse lines correctly" do
|
157
|
+
described_class.line2hash('0:dummy:running:/z::native:shared').should == {:ensure=>:running, :iptype=>"shared", :path=>"/z", :name=>"dummy", :id=>"0"}
|
158
|
+
end
|
159
|
+
it "should parse lines correctly(2)" do
|
160
|
+
described_class.line2hash('0:dummy:running:/z:ipkg:native:shared').should == {:ensure=>:running, :iptype=>"shared", :path=>"/z", :name=>"dummy", :id=>"0"}
|
161
|
+
end
|
162
|
+
it "should parse lines correctly(3)" do
|
163
|
+
described_class.line2hash('-:dummy:running:/z:ipkg:native:shared').should == {:ensure=>:running, :iptype=>"shared", :path=>"/z", :name=>"dummy"}
|
164
|
+
end
|
165
|
+
it "should parse lines correctly(3)" do
|
166
|
+
described_class.line2hash('-:dummy:running:/z:ipkg:native:exclusive').should == {:ensure=>:running, :iptype=>"exclusive", :path=>"/z", :name=>"dummy"}
|
73
167
|
end
|
168
|
+
end
|
169
|
+
context "#multi_conf" do
|
170
|
+
it "should correctly add and remove properties" do
|
171
|
+
provider.stubs(:properties).with().returns({:ip => ['1.1.1.1', '2.2.2.2']})
|
172
|
+
should = ['1.1.1.1', '3.3.3.3']
|
173
|
+
p = Proc.new do |a, str|
|
174
|
+
case a
|
175
|
+
when :add; 'add:' + str
|
176
|
+
when :rm; 'rm:' + str
|
177
|
+
end
|
178
|
+
end
|
179
|
+
provider.multi_conf(:ip, should, &p).should == "rm:2.2.2.2\nadd:3.3.3.3"
|
180
|
+
end
|
181
|
+
end
|
182
|
+
context "single props" do
|
183
|
+
{:iptype => /set ip-type/, :autoboot => /set autoboot/, :path => /set zonepath/, :pool => /set pool/, :shares => /add rctl/}.each do |p, v|
|
184
|
+
it "#{p.to_s}: should correctly return conf string" do
|
185
|
+
provider.send(p.to_s + '_conf', 'dummy').should =~ v
|
186
|
+
end
|
187
|
+
it "#{p.to_s}: should correctly set property string" do
|
188
|
+
provider.expects((p.to_s + '_conf').intern).returns('dummy')
|
189
|
+
provider.expects(:setconfig).with('dummy').returns('dummy2')
|
190
|
+
provider.send(p.to_s + '=', 'dummy').should == 'dummy2'
|
191
|
+
end
|
74
192
|
|
193
|
+
end
|
75
194
|
end
|
76
195
|
end
|