puppet 2.7.19 → 2.7.20.rc1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- data/CONTRIBUTING.md +61 -238
- data/Gemfile +32 -0
- data/Gemfile.lock +44 -0
- data/LICENSE +1 -1
- data/README_DEVELOPER.md +300 -5
- data/Rakefile +41 -37
- data/ext/build_defaults.yaml +20 -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 +142 -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 +3 -0
- data/ext/debian/puppet-common.lintian-overrides +7 -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 +3 -0
- data/ext/debian/puppet-testsuite.lintian-overrides +4 -0
- data/ext/debian/puppet.NEWS +86 -0
- data/ext/debian/puppet.conf +14 -0
- data/ext/debian/puppet.default +7 -0
- data/ext/debian/puppet.dirs +1 -0
- data/ext/debian/puppet.init +118 -0
- data/ext/debian/puppet.install +4 -0
- data/ext/debian/puppet.lintian-overrides +3 -0
- data/ext/debian/puppet.logrotate +11 -0
- data/ext/debian/puppet.manpages +36 -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 +5 -0
- data/ext/debian/puppetmaster-common.manpages +5 -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.NEWS +13 -0
- data/ext/debian/puppetmaster.README.debian +16 -0
- data/ext/debian/puppetmaster.default +38 -0
- data/ext/debian/puppetmaster.dirs +1 -0
- data/ext/debian/puppetmaster.init +158 -0
- data/ext/debian/puppetmaster.install +1 -0
- data/ext/debian/puppetmaster.lintian-overrides +3 -0
- data/ext/debian/puppetmaster.manpages +1 -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 +127 -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/{conf → ext}/osx/PackageInfo.plist +0 -0
- data/{conf → ext}/osx/createpackage.sh +0 -0
- data/ext/osx/file_mapping.yaml +38 -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 +255 -0
- data/ext/packaging/spec/spec_helper.rb +12 -0
- data/ext/packaging/spec/tasks/00_utils_spec.rb +66 -0
- data/ext/packaging/tasks/00_utils.rake +382 -0
- data/ext/packaging/tasks/10_setupvars.rake +71 -0
- data/ext/packaging/tasks/20_setupextravars.rake +25 -0
- data/ext/packaging/tasks/apple.rake +201 -0
- data/ext/packaging/tasks/clean.rake +5 -0
- data/ext/packaging/tasks/deb.rake +108 -0
- data/ext/packaging/tasks/doc.rake +20 -0
- data/ext/packaging/tasks/fetch.rake +18 -0
- data/ext/packaging/tasks/gem.rake +68 -0
- data/ext/packaging/tasks/ips.rake +80 -0
- data/ext/packaging/tasks/mock.rake +126 -0
- data/ext/packaging/tasks/pe_deb.rake +9 -0
- data/ext/packaging/tasks/pe_remote.rake +45 -0
- data/ext/packaging/tasks/pe_rpm.rake +21 -0
- data/ext/packaging/tasks/pe_ship.rake +30 -0
- data/ext/packaging/tasks/pe_sign.rake +27 -0
- data/ext/packaging/tasks/pe_sles.rake +96 -0
- data/ext/packaging/tasks/release.rake +73 -0
- data/ext/packaging/tasks/remote_build.rake +78 -0
- data/ext/packaging/tasks/rpm.rake +52 -0
- data/ext/packaging/tasks/ship.rake +78 -0
- data/ext/packaging/tasks/sign.rake +82 -0
- data/ext/packaging/tasks/tag.rake +8 -0
- data/ext/packaging/tasks/tar.rake +68 -0
- data/ext/packaging/tasks/template.rake +13 -0
- data/ext/packaging/tasks/update.rake +16 -0
- data/ext/packaging/tasks/version.rake +21 -0
- data/ext/project_data.yaml +24 -0
- data/{conf/redhat/puppet.spec → ext/redhat/puppet.spec.erb} +18 -10
- data/install.rb +8 -8
- data/lib/puppet.rb +2 -6
- data/lib/puppet/agent/locker.rb +2 -0
- data/lib/puppet/application.rb +1 -1
- data/lib/puppet/application/agent.rb +1 -1
- data/lib/puppet/application/apply.rb +1 -1
- data/lib/puppet/application/cert.rb +5 -6
- data/lib/puppet/application/describe.rb +1 -1
- data/lib/puppet/application/device.rb +1 -1
- data/lib/puppet/application/doc.rb +1 -1
- data/lib/puppet/application/filebucket.rb +1 -1
- data/lib/puppet/application/inspect.rb +1 -1
- data/lib/puppet/application/kick.rb +1 -1
- data/lib/puppet/application/master.rb +1 -1
- data/lib/puppet/application/resource.rb +1 -1
- data/lib/puppet/defaults.rb +21 -3
- data/lib/puppet/external/dot.rb +1 -1
- data/lib/puppet/face/help/global.erb +1 -1
- 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/clean.rb +23 -18
- data/lib/puppet/face/parser.rb +11 -2
- data/lib/puppet/file_collection.rb +16 -27
- data/lib/puppet/file_collection/lookup.rb +6 -16
- data/lib/puppet/file_serving/base.rb +4 -4
- data/lib/puppet/indirector/catalog/static_compiler.rb +3 -4
- 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 +2 -2
- data/lib/puppet/indirector/key/disabled_ca.rb +22 -0
- data/lib/puppet/indirector/node/exec.rb +13 -1
- data/lib/puppet/indirector/request.rb +4 -0
- data/lib/puppet/metatype/manager.rb +17 -10
- data/lib/puppet/network/authstore.rb +1 -1
- data/lib/puppet/network/rights.rb +1 -2
- data/lib/puppet/node/environment.rb +1 -0
- data/lib/puppet/parameter/value.rb +9 -3
- data/lib/puppet/parser/ast.rb +1 -4
- data/lib/puppet/parser/files.rb +1 -1
- data/lib/puppet/parser/functions.rb +68 -22
- data/lib/puppet/parser/functions/create_resources.rb +2 -3
- data/lib/puppet/parser/functions/shellquote.rb +21 -25
- data/lib/puppet/parser/lexer.rb +40 -6
- data/lib/puppet/parser/relationship.rb +3 -1
- data/lib/puppet/parser/resource.rb +2 -3
- data/lib/puppet/parser/resource/param.rb +3 -5
- data/lib/puppet/parser/scope.rb +7 -4
- data/lib/puppet/property.rb +5 -3
- data/lib/puppet/provider.rb +5 -5
- data/lib/puppet/provider/aixobject.rb +1 -1
- data/lib/puppet/provider/augeas/augeas.rb +1 -1
- data/lib/puppet/provider/exec/windows.rb +1 -1
- data/lib/puppet/provider/file/windows.rb +10 -29
- data/lib/puppet/provider/group/groupadd.rb +2 -3
- data/lib/puppet/provider/group/ldap.rb +1 -1
- data/lib/puppet/provider/group/windows_adsi.rb +1 -1
- data/lib/puppet/provider/ldap.rb +5 -1
- data/lib/puppet/provider/nameservice.rb +3 -3
- data/lib/puppet/provider/nameservice/directoryservice.rb +2 -2
- data/lib/puppet/provider/package/gem.rb +6 -2
- data/lib/puppet/provider/package/portage.rb +4 -2
- data/lib/puppet/provider/parsedfile.rb +1 -1
- data/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb +2 -2
- data/lib/puppet/provider/service/base.rb +2 -41
- 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 +6 -5
- data/lib/puppet/provider/service/runit.rb +1 -1
- data/lib/puppet/provider/service/service.rb +43 -0
- data/lib/puppet/provider/service/windows.rb +1 -8
- data/lib/puppet/provider/user/user_role_add.rb +2 -1
- data/lib/puppet/provider/user/useradd.rb +8 -3
- data/lib/puppet/provider/user/windows_adsi.rb +12 -1
- data/lib/puppet/provider/zone/solaris.rb +1 -1
- data/lib/puppet/rails/inventory_node.rb +26 -13
- data/lib/puppet/reports.rb +1 -1
- data/lib/puppet/resource.rb +20 -5
- data/lib/puppet/resource/status.rb +1 -1
- data/lib/puppet/ssl/certificate_authority.rb +2 -0
- data/lib/puppet/ssl/host.rb +31 -6
- data/lib/puppet/test/test_helper.rb +3 -1
- data/lib/puppet/transaction/event.rb +1 -1
- data/lib/puppet/transaction/report.rb +2 -2
- data/lib/puppet/type.rb +30 -25
- data/lib/puppet/type/augeas.rb +1 -1
- data/lib/puppet/type/cron.rb +2 -2
- data/lib/puppet/type/exec.rb +6 -6
- data/lib/puppet/type/file.rb +5 -15
- data/lib/puppet/type/file/content.rb +1 -1
- 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/mount.rb +1 -1
- data/lib/puppet/type/package.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/whit.rb +16 -9
- data/lib/puppet/util.rb +27 -11
- data/lib/puppet/util/adsi.rb +25 -23
- data/lib/puppet/util/autoload.rb +1 -1
- data/lib/puppet/util/classgen.rb +1 -1
- data/lib/puppet/util/feature.rb +3 -1
- data/lib/puppet/util/fileparsing.rb +9 -9
- data/lib/puppet/util/filetype.rb +55 -40
- data/lib/puppet/util/instance_loader.rb +5 -5
- data/lib/puppet/util/instrumentation.rb +3 -5
- data/lib/puppet/util/log_paths.rb +1 -3
- data/lib/puppet/util/monkey_patches.rb +34 -8
- data/lib/puppet/util/platform.rb +7 -0
- data/lib/puppet/util/posix.rb +3 -3
- data/lib/puppet/util/provider_features.rb +2 -3
- data/lib/puppet/util/rdoc.rb +4 -3
- data/lib/puppet/util/reference.rb +1 -1
- data/lib/puppet/util/selinux.rb +31 -36
- data/lib/puppet/util/tagging.rb +28 -6
- data/lib/puppet/util/windows.rb +1 -0
- 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 +9 -46
- data/lib/puppet/util/windows/sid.rb +96 -0
- data/lib/puppet/util/windows/user.rb +65 -2
- data/lib/puppet/util/zaml.rb +109 -59
- data/lib/puppet/version.rb +18 -0
- data/spec/fixtures/unit/util/filetype/aixtab_output +44 -0
- data/spec/fixtures/unit/util/filetype/suntab_output +9 -0
- data/spec/integration/defaults_spec.rb +26 -7
- data/spec/integration/parser/functions_spec.rb +0 -4
- data/spec/integration/util/file_locking_spec.rb +1 -1
- data/spec/integration/util/windows/security_spec.rb +3 -23
- data/spec/lib/puppet_spec/files.rb +3 -3
- data/spec/shared_contexts/platform.rb +8 -0
- data/spec/spec_helper.rb +6 -1
- data/spec/unit/application/queue_spec.rb +2 -1
- data/spec/unit/configurer_spec.rb +1 -1
- data/spec/unit/face/{instrumentation_data.rb → instrumentation_data_spec.rb} +0 -0
- data/spec/unit/face/{instrumentation_listener.rb → instrumentation_listener_spec.rb} +0 -0
- data/spec/unit/face/{instrumentation_probe.rb → instrumentation_probe_spec.rb} +0 -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/key/disabled_ca_spec.rb +33 -0
- data/spec/unit/indirector/request_spec.rb +22 -0
- data/spec/unit/network/http/webrick_spec.rb +0 -7
- data/spec/unit/node/environment_spec.rb +8 -8
- data/spec/unit/parser/ast_spec.rb +0 -5
- data/spec/unit/parser/collector_spec.rb +1 -0
- data/spec/unit/parser/files_spec.rb +2 -2
- data/spec/unit/parser/functions/create_resources_spec.rb +3 -4
- data/spec/unit/parser/functions/require_spec.rb +0 -6
- data/spec/unit/parser/functions/shellquote_spec.rb +0 -5
- data/spec/unit/parser/functions/template_spec.rb +6 -1
- data/spec/unit/parser/functions_spec.rb +73 -23
- data/spec/unit/parser/lexer_spec.rb +133 -8
- data/spec/unit/parser/relationship_spec.rb +24 -0
- data/spec/unit/parser/resource_spec.rb +0 -4
- data/spec/unit/parser/scope_spec.rb +2 -2
- data/spec/unit/property_spec.rb +21 -1
- data/spec/unit/provider/exec/posix_spec.rb +7 -6
- data/spec/unit/provider/file/windows_spec.rb +29 -29
- data/spec/unit/provider/group/groupadd_spec.rb +36 -30
- data/spec/unit/provider/group/windows_adsi_spec.rb +2 -2
- data/spec/unit/provider/package/gem_spec.rb +12 -0
- data/spec/unit/provider/scheduled_task/win32_taskscheduler_spec.rb +14 -11
- data/spec/unit/provider/service/redhat_spec.rb +11 -1
- data/spec/unit/provider/service/windows_spec.rb +19 -0
- data/spec/unit/provider/user/ldap_spec.rb +22 -8
- data/spec/unit/provider/user/user_role_add_spec.rb +12 -0
- data/spec/unit/provider/user/useradd_spec.rb +146 -118
- data/spec/unit/provider/user/windows_adsi_spec.rb +24 -2
- data/spec/unit/puppet_spec.rb +10 -0
- data/spec/unit/resource/status_spec.rb +1 -1
- data/spec/unit/resource_spec.rb +73 -0
- data/spec/unit/ssl/certificate_authority_spec.rb +25 -1
- data/spec/unit/ssl/host_spec.rb +73 -27
- data/spec/unit/ssl/key_spec.rb +0 -4
- data/spec/unit/transaction/event_spec.rb +1 -1
- data/spec/unit/type/exec_spec.rb +1 -1
- data/spec/unit/type/file/content_spec.rb +6 -4
- data/spec/unit/type/file/{ctime.rb → ctime_spec.rb} +0 -0
- data/spec/unit/type/file/{mtime.rb → mtime_spec.rb} +0 -0
- data/spec/unit/type/file/{type.rb → type_spec.rb} +0 -0
- data/spec/unit/type/file_spec.rb +2 -12
- data/spec/unit/type/host_spec.rb +14 -5
- data/spec/unit/type/mount_spec.rb +8 -0
- data/spec/unit/type/scheduled_task_spec.rb +2 -2
- data/spec/unit/util/adsi_spec.rb +23 -8
- data/spec/unit/util/command_line_spec.rb +11 -2
- data/spec/unit/util/feature_spec.rb +12 -1
- data/spec/unit/util/filetype_spec.rb +161 -55
- data/spec/unit/util/log_spec.rb +1 -1
- data/spec/unit/util/monkey_patches_spec.rb +7 -0
- data/spec/unit/util/rdoc_spec.rb +8 -2
- data/spec/unit/util/selinux_spec.rb +24 -32
- data/spec/unit/util/windows/sid_spec.rb +100 -0
- data/spec/unit/util/zaml_spec.rb +165 -25
- data/spec/unit/util_spec.rb +3 -9
- data/spec/watchr.rb +2 -6
- data/tasks/rake/gem.rake +4 -2
- data/tasks/rake/sign.rake +1 -1
- data/test/language/parser.rb +1 -0
- data/test/language/scope.rb +0 -5
- data/test/language/snippets.rb +1 -2
- data/test/lib/puppettest.rb +16 -27
- data/test/lib/puppettest/parsertesting.rb +0 -1
- data/test/network/authstore.rb +2 -4
- data/test/puppet/defaults.rb +0 -4
- data/test/util/fileparsing.rb +2 -6
- metadata +1706 -1617
- data/conf/osx/preflight +0 -24
- data/spec/spec.opts +0 -4
- data/spec/unit/file_collection/lookup_spec.rb +0 -45
- data/spec/unit/file_collection_spec.rb +0 -52
- data/tasks/rake/apple.rake +0 -176
- data/test/puppet/errortest.rb +0 -19
@@ -7,6 +7,8 @@ describe Puppet::Parser::Relationship do
|
|
7
7
|
before do
|
8
8
|
@source = Puppet::Resource.new(:mytype, "source")
|
9
9
|
@target = Puppet::Resource.new(:mytype, "target")
|
10
|
+
@extra_resource = Puppet::Resource.new(:mytype, "extra")
|
11
|
+
@extra_resource2 = Puppet::Resource.new(:mytype, "extra2")
|
10
12
|
@dep = Puppet::Parser::Relationship.new(@source, @target, :relationship)
|
11
13
|
end
|
12
14
|
|
@@ -15,6 +17,8 @@ describe Puppet::Parser::Relationship do
|
|
15
17
|
@catalog = Puppet::Resource::Catalog.new
|
16
18
|
@catalog.add_resource(@source)
|
17
19
|
@catalog.add_resource(@target)
|
20
|
+
@catalog.add_resource(@extra_resource)
|
21
|
+
@catalog.add_resource(@extra_resource2)
|
18
22
|
end
|
19
23
|
|
20
24
|
it "should fail if the source resource cannot be found" do
|
@@ -44,10 +48,30 @@ describe Puppet::Parser::Relationship do
|
|
44
48
|
it "should supplement rather than clobber existing relationship values" do
|
45
49
|
@source[:before] = "File[/bar]"
|
46
50
|
@dep.evaluate(@catalog)
|
51
|
+
# this test did not work before. It was appending the resources
|
52
|
+
# together as a string
|
53
|
+
(@source[:before].class == Array).should be_true
|
47
54
|
@source[:before].should be_include("Mytype[target]")
|
48
55
|
@source[:before].should be_include("File[/bar]")
|
49
56
|
end
|
50
57
|
|
58
|
+
it "should supplement rather than clobber existing resource relationships" do
|
59
|
+
@source[:before] = @extra_resource
|
60
|
+
@dep.evaluate(@catalog)
|
61
|
+
(@source[:before].class == Array).should be_true
|
62
|
+
@source[:before].should be_include("Mytype[target]")
|
63
|
+
@source[:before].should be_include(@extra_resource)
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should supplement rather than clobber multiple existing resource relationships" do
|
67
|
+
@source[:before] = [@extra_resource, @extra_resource2]
|
68
|
+
@dep.evaluate(@catalog)
|
69
|
+
(@source[:before].class == Array).should be_true
|
70
|
+
@source[:before].should be_include("Mytype[target]")
|
71
|
+
@source[:before].should be_include(@extra_resource)
|
72
|
+
@source[:before].should be_include(@extra_resource2)
|
73
|
+
end
|
74
|
+
|
51
75
|
it "should use the collected retargets if the target is a Collector" do
|
52
76
|
orig_target = @target
|
53
77
|
@target = Puppet::Parser::Collector.new(stub("scope"), :file, "equery", "vquery", :virtual)
|
@@ -52,10 +52,6 @@ describe Puppet::Parser::Resource do
|
|
52
52
|
@known_resource_types.add Puppet::Resource::Type.new(:node, name)
|
53
53
|
end
|
54
54
|
|
55
|
-
it "should use the file lookup module" do
|
56
|
-
Puppet::Parser::Resource.ancestors.should be_include(Puppet::FileCollection::Lookup)
|
57
|
-
end
|
58
|
-
|
59
55
|
it "should get its environment from its scope" do
|
60
56
|
scope = stub 'scope', :source => stub("source"), :namespaces => nil
|
61
57
|
scope.expects(:environment).returns("foo").at_least_once
|
@@ -64,11 +64,11 @@ describe Puppet::Parser::Scope do
|
|
64
64
|
end
|
65
65
|
|
66
66
|
it "should raise NoMethodError if the method doesn't look like a function" do
|
67
|
-
expect { @scope.sprintf(["%b", 123]) }.
|
67
|
+
expect { @scope.sprintf(["%b", 123]) }.to raise_error(NoMethodError)
|
68
68
|
end
|
69
69
|
|
70
70
|
it "should raise NoMethodError if the method looks like a function but doesn't exist" do
|
71
|
-
expect { @scope.function_fake_bs(['cows']) }.
|
71
|
+
expect { @scope.function_fake_bs(['cows']) }.to raise_error(NoMethodError)
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
data/spec/unit/property_spec.rb
CHANGED
@@ -8,7 +8,12 @@ describe Puppet::Property do
|
|
8
8
|
let :subclass do
|
9
9
|
# We need a completely fresh subclass every time, because we modify both
|
10
10
|
# class and instance level things inside the tests.
|
11
|
-
subclass = Class.new(Puppet::Property) do
|
11
|
+
subclass = Class.new(Puppet::Property) do
|
12
|
+
class << self
|
13
|
+
attr_accessor :name
|
14
|
+
end
|
15
|
+
@name = :foo
|
16
|
+
end
|
12
17
|
subclass.initvars
|
13
18
|
subclass
|
14
19
|
end
|
@@ -361,6 +366,21 @@ describe Puppet::Property do
|
|
361
366
|
lambda { property.set(:foo) }.should raise_error(Puppet::Error)
|
362
367
|
end
|
363
368
|
|
369
|
+
it "fails when the provider does not handle the attribute" do
|
370
|
+
subclass.name = "unknown"
|
371
|
+
lambda { property.set(:a_value) }.should raise_error(Puppet::Error)
|
372
|
+
end
|
373
|
+
|
374
|
+
it "propogates the errors about missing methods from the provider" do
|
375
|
+
provider = resource.provider
|
376
|
+
def provider.bad_method=(value)
|
377
|
+
value.this_method_does_not_exist
|
378
|
+
end
|
379
|
+
|
380
|
+
subclass.name = :bad_method
|
381
|
+
lambda { property.set(:a_value) }.should raise_error(NoMethodError, /this_method_does_not_exist/)
|
382
|
+
end
|
383
|
+
|
364
384
|
describe "that was defined without a block" do
|
365
385
|
it "should call the settor on the provider" do
|
366
386
|
subclass.newvalue(:bar)
|
@@ -5,10 +5,11 @@ describe Puppet::Type.type(:exec).provider(:posix) do
|
|
5
5
|
include PuppetSpec::Files
|
6
6
|
|
7
7
|
def make_exe
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
cmdpath = tmpdir('cmdpath')
|
9
|
+
exepath = tmpfile('my_command', cmdpath)
|
10
|
+
FileUtils.touch(exepath)
|
11
|
+
File.chmod(0755, exepath)
|
12
|
+
exepath
|
12
13
|
end
|
13
14
|
|
14
15
|
let(:resource) { Puppet::Type.type(:exec).new(:title => File.expand_path('/foo'), :provider => :posix) }
|
@@ -74,8 +75,8 @@ describe Puppet::Type.type(:exec).provider(:posix) do
|
|
74
75
|
end
|
75
76
|
|
76
77
|
it "should fail if the command is in the path but not executable" do
|
77
|
-
command =
|
78
|
-
|
78
|
+
command = make_exe
|
79
|
+
File.chmod(0644, command)
|
79
80
|
FileTest.stubs(:executable?).with(command).returns(false)
|
80
81
|
resource[:path] = [File.dirname(command)]
|
81
82
|
filename = File.basename(command)
|
@@ -14,6 +14,8 @@ describe Puppet::Type.type(:file).provider(:windows), :if => Puppet.features.mic
|
|
14
14
|
let(:path) { tmpfile('windows_file_spec') }
|
15
15
|
let(:resource) { Puppet::Type.type(:file).new :path => path, :mode => 0777, :provider => described_class.name }
|
16
16
|
let(:provider) { resource.provider }
|
17
|
+
let(:sid) { 'S-1-1-50' }
|
18
|
+
let(:account) { 'quinn' }
|
17
19
|
|
18
20
|
describe "#mode" do
|
19
21
|
it "should return a string with the higher-order bits stripped away" do
|
@@ -47,47 +49,41 @@ describe Puppet::Type.type(:file).provider(:windows), :if => Puppet.features.mic
|
|
47
49
|
|
48
50
|
describe "#id2name" do
|
49
51
|
it "should return the name of the user identified by the sid" do
|
50
|
-
|
51
|
-
Puppet::Util::
|
52
|
+
Puppet::Util::Windows::Security.expects(:valid_sid?).with(sid).returns(true)
|
53
|
+
Puppet::Util::Windows::Security.expects(:sid_to_name).with(sid).returns(account)
|
52
54
|
|
53
|
-
provider.id2name(
|
55
|
+
provider.id2name(sid).should == account
|
54
56
|
end
|
55
57
|
|
56
58
|
it "should return the argument if it's already a name" do
|
57
|
-
|
59
|
+
Puppet::Util::Windows::Security.expects(:valid_sid?).with(account).returns(false)
|
60
|
+
Puppet::Util::Windows::Security.expects(:sid_to_name).never
|
61
|
+
|
62
|
+
provider.id2name(account).should == account
|
58
63
|
end
|
59
64
|
|
60
65
|
it "should return nil if the user doesn't exist" do
|
61
|
-
Puppet::Util::
|
66
|
+
Puppet::Util::Windows::Security.expects(:valid_sid?).with(sid).returns(true)
|
67
|
+
Puppet::Util::Windows::Security.expects(:sid_to_name).with(sid).returns(nil)
|
62
68
|
|
63
|
-
provider.id2name(
|
69
|
+
provider.id2name(sid).should == nil
|
64
70
|
end
|
65
71
|
end
|
66
72
|
|
67
73
|
describe "#name2id" do
|
68
|
-
it "should
|
69
|
-
Puppet::Util::
|
70
|
-
|
71
|
-
provider.name2id('anybody').should == 'S-1-1-50'
|
72
|
-
end
|
73
|
-
|
74
|
-
it "should return the argument if it's already a sid" do
|
75
|
-
provider.name2id('S-1-1-50').should == 'S-1-1-50'
|
76
|
-
end
|
77
|
-
|
78
|
-
it "should return nil if the user doesn't exist" do
|
79
|
-
Puppet::Util::ADSI.stubs(:execquery).returns []
|
74
|
+
it "should delegate to name_to_sid" do
|
75
|
+
Puppet::Util::Windows::Security.expects(:name_to_sid).with(account).returns(sid)
|
80
76
|
|
81
|
-
provider.name2id(
|
77
|
+
provider.name2id(account).should == sid
|
82
78
|
end
|
83
79
|
end
|
84
80
|
|
85
81
|
describe "#owner" do
|
86
82
|
it "should return the sid of the owner if the file does exist" do
|
87
83
|
FileUtils.touch(resource[:path])
|
88
|
-
provider.stubs(:get_owner).with(resource[:path]).returns(
|
84
|
+
provider.stubs(:get_owner).with(resource[:path]).returns(sid)
|
89
85
|
|
90
|
-
provider.owner.should ==
|
86
|
+
provider.owner.should == sid
|
91
87
|
end
|
92
88
|
|
93
89
|
it "should return absent if the file doesn't exist" do
|
@@ -97,23 +93,25 @@ describe Puppet::Type.type(:file).provider(:windows), :if => Puppet.features.mic
|
|
97
93
|
|
98
94
|
describe "#owner=" do
|
99
95
|
it "should set the owner to the specified value" do
|
100
|
-
provider.expects(:set_owner).with(
|
101
|
-
provider.owner =
|
96
|
+
provider.expects(:set_owner).with(sid, resource[:path])
|
97
|
+
provider.owner = sid
|
102
98
|
end
|
103
99
|
|
104
100
|
it "should propagate any errors encountered when setting the owner" do
|
105
101
|
provider.stubs(:set_owner).raises(ArgumentError)
|
106
102
|
|
107
|
-
expect {
|
103
|
+
expect {
|
104
|
+
provider.owner = sid
|
105
|
+
}.to raise_error(Puppet::Error, /Failed to set owner/)
|
108
106
|
end
|
109
107
|
end
|
110
108
|
|
111
109
|
describe "#group" do
|
112
110
|
it "should return the sid of the group if the file does exist" do
|
113
111
|
FileUtils.touch(resource[:path])
|
114
|
-
provider.stubs(:get_group).with(resource[:path]).returns(
|
112
|
+
provider.stubs(:get_group).with(resource[:path]).returns(sid)
|
115
113
|
|
116
|
-
provider.group.should ==
|
114
|
+
provider.group.should == sid
|
117
115
|
end
|
118
116
|
|
119
117
|
it "should return absent if the file doesn't exist" do
|
@@ -123,14 +121,16 @@ describe Puppet::Type.type(:file).provider(:windows), :if => Puppet.features.mic
|
|
123
121
|
|
124
122
|
describe "#group=" do
|
125
123
|
it "should set the group to the specified value" do
|
126
|
-
provider.expects(:set_group).with(
|
127
|
-
provider.group =
|
124
|
+
provider.expects(:set_group).with(sid, resource[:path])
|
125
|
+
provider.group = sid
|
128
126
|
end
|
129
127
|
|
130
128
|
it "should propagate any errors encountered when setting the group" do
|
131
129
|
provider.stubs(:set_group).raises(ArgumentError)
|
132
130
|
|
133
|
-
expect {
|
131
|
+
expect {
|
132
|
+
provider.group = sid
|
133
|
+
}.to raise_error(Puppet::Error, /Failed to set group/)
|
134
134
|
end
|
135
135
|
end
|
136
136
|
|
@@ -1,40 +1,46 @@
|
|
1
1
|
#!/usr/bin/env rspec
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
describe provider_class do
|
4
|
+
describe Puppet::Type.type(:group).provider(:groupadd) do
|
7
5
|
before do
|
8
|
-
|
9
|
-
|
6
|
+
described_class.stubs(:command).with(:add).returns '/usr/sbin/groupadd'
|
7
|
+
described_class.stubs(:command).with(:delete).returns '/usr/sbin/groupdel'
|
8
|
+
described_class.stubs(:command).with(:modify).returns '/usr/sbin/groupmod'
|
10
9
|
end
|
11
10
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
11
|
+
let(:resource) { Puppet::Type.type(:group).new(:name => 'mygroup', :provider => provider) }
|
12
|
+
let(:provider) { described_class.new(:name => 'mygroup') }
|
13
|
+
|
14
|
+
describe "#create" do
|
15
|
+
it "should add -o when allowdupe is enabled and the group is being created" do
|
16
|
+
resource[:allowdupe] = :true
|
17
|
+
provider.expects(:execute).with(['/usr/sbin/groupadd', '-o', 'mygroup'])
|
18
|
+
provider.create
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "on system that feature system_groups", :if => described_class.system_groups? do
|
22
|
+
it "should add -r when system is enabled and the group is being created" do
|
23
|
+
resource[:system] = :true
|
24
|
+
provider.expects(:execute).with(['/usr/sbin/groupadd', '-r', 'mygroup'])
|
25
|
+
provider.create
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe "on system that do not feature system_groups", :unless => described_class.system_groups? do
|
30
|
+
it "should not add -r when system is enabled and the group is being created" do
|
31
|
+
resource[:system] = :true
|
32
|
+
provider.expects(:execute).with(['/usr/sbin/groupadd', 'mygroup'])
|
33
|
+
provider.create
|
34
|
+
end
|
35
|
+
end
|
20
36
|
end
|
21
37
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
@provider.gid = 150
|
29
|
-
end
|
30
|
-
|
31
|
-
it "should add -r when system is enabled and the group is being created" do
|
32
|
-
@resource.stubs(:should).returns "fakeval"
|
33
|
-
@resource.stubs(:[]).returns "fakeval"
|
34
|
-
@resource.expects(:system?).returns true
|
35
|
-
@resource.stubs(:allowdupe?).returns true
|
36
|
-
@provider.expects(:execute).with { |args| args.include?("-r") }
|
37
|
-
|
38
|
-
@provider.create
|
38
|
+
describe "#gid=" do
|
39
|
+
it "should add -o when allowdupe is enabled and the gid is being modified" do
|
40
|
+
resource[:allowdupe] = :true
|
41
|
+
provider.expects(:execute).with(['/usr/sbin/groupmod', '-g', 150, '-o', 'mygroup'])
|
42
|
+
provider.gid = 150
|
43
|
+
end
|
39
44
|
end
|
40
45
|
end
|
46
|
+
|
@@ -88,8 +88,8 @@ describe Puppet::Type.type(:group).provider(:windows_adsi) do
|
|
88
88
|
provider.delete
|
89
89
|
end
|
90
90
|
|
91
|
-
it "should report the group's SID as gid" do
|
92
|
-
Puppet::Util::
|
91
|
+
it "should report the group's SID as gid", :if => Puppet.features.microsoft_windows? do
|
92
|
+
Puppet::Util::Windows::Security.expects(:name_to_sid).with('testers').returns('S-1-5-32-547')
|
93
93
|
provider.gid.should == 'S-1-5-32-547'
|
94
94
|
end
|
95
95
|
|
@@ -99,6 +99,18 @@ describe provider_class do
|
|
99
99
|
})
|
100
100
|
provider.latest.should == "3.0"
|
101
101
|
end
|
102
|
+
|
103
|
+
it "should list from the specified source repository" do
|
104
|
+
resource[:source] = "http://foo.bar.baz/gems"
|
105
|
+
provider.class.expects(:gemlist).
|
106
|
+
with({:justme => 'myresource', :source => "http://foo.bar.baz/gems"}).
|
107
|
+
returns({
|
108
|
+
:name => 'myresource',
|
109
|
+
:ensure => ["3.0"],
|
110
|
+
:provider => :gem,
|
111
|
+
})
|
112
|
+
provider.latest.should == "3.0"
|
113
|
+
end
|
102
114
|
end
|
103
115
|
|
104
116
|
describe "#instances" do
|
@@ -565,29 +565,32 @@ describe Puppet::Type.type(:scheduled_task).provider(:win32_taskscheduler), :if
|
|
565
565
|
end
|
566
566
|
end
|
567
567
|
|
568
|
-
describe '#user_insync?' do
|
568
|
+
describe '#user_insync?', :if => Puppet.features.microsoft_windows? do
|
569
569
|
let(:resource) { described_class.new(:name => 'foobar', :command => 'C:\Windows\System32\notepad.exe') }
|
570
570
|
|
571
|
-
before :each do
|
572
|
-
Puppet::Util::ADSI.stubs(:sid_for_account).with('system').returns('SYSTEM SID')
|
573
|
-
Puppet::Util::ADSI.stubs(:sid_for_account).with('joe').returns('SID A')
|
574
|
-
Puppet::Util::ADSI.stubs(:sid_for_account).with('MACHINE\joe').returns('SID A')
|
575
|
-
Puppet::Util::ADSI.stubs(:sid_for_account).with('bob').returns('SID B')
|
576
|
-
end
|
577
|
-
|
578
571
|
it 'should consider the user as in sync if the name matches' do
|
572
|
+
Puppet::Util::Windows::Security.expects(:name_to_sid).with('joe').twice.returns('SID A')
|
573
|
+
|
579
574
|
resource.should be_user_insync('joe', ['joe'])
|
580
575
|
end
|
581
576
|
|
582
577
|
it 'should consider the user as in sync if the current user is fully qualified' do
|
578
|
+
Puppet::Util::Windows::Security.expects(:name_to_sid).with('joe').returns('SID A')
|
579
|
+
Puppet::Util::Windows::Security.expects(:name_to_sid).with('MACHINE\joe').returns('SID A')
|
580
|
+
|
583
581
|
resource.should be_user_insync('MACHINE\joe', ['joe'])
|
584
582
|
end
|
585
583
|
|
586
584
|
it 'should consider a current user of the empty string to be the same as the system user' do
|
585
|
+
Puppet::Util::Windows::Security.expects(:name_to_sid).with('system').twice.returns('SYSTEM SID')
|
586
|
+
|
587
587
|
resource.should be_user_insync('', ['system'])
|
588
588
|
end
|
589
589
|
|
590
590
|
it 'should consider different users as being different' do
|
591
|
+
Puppet::Util::Windows::Security.expects(:name_to_sid).with('joe').returns('SID A')
|
592
|
+
Puppet::Util::Windows::Security.expects(:name_to_sid).with('bob').returns('SID B')
|
593
|
+
|
591
594
|
resource.should_not be_user_insync('joe', ['bob'])
|
592
595
|
end
|
593
596
|
end
|
@@ -1456,7 +1459,7 @@ describe Puppet::Type.type(:scheduled_task).provider(:win32_taskscheduler), :if
|
|
1456
1459
|
end
|
1457
1460
|
end
|
1458
1461
|
|
1459
|
-
describe '#user=' do
|
1462
|
+
describe '#user=', :if => Puppet.features.microsoft_windows? do
|
1460
1463
|
before :each do
|
1461
1464
|
@mock_task = mock
|
1462
1465
|
@mock_task.responds_like(Win32::TaskScheduler.new)
|
@@ -1466,7 +1469,7 @@ describe Puppet::Type.type(:scheduled_task).provider(:win32_taskscheduler), :if
|
|
1466
1469
|
end
|
1467
1470
|
|
1468
1471
|
it 'should use nil for user and password when setting the user to the SYSTEM account' do
|
1469
|
-
Puppet::Util::
|
1472
|
+
Puppet::Util::Windows::Security.stubs(:name_to_sid).with('system').returns('SYSTEM SID')
|
1470
1473
|
|
1471
1474
|
resource = Puppet::Type.type(:scheduled_task).new(
|
1472
1475
|
:name => 'Test Task',
|
@@ -1480,7 +1483,7 @@ describe Puppet::Type.type(:scheduled_task).provider(:win32_taskscheduler), :if
|
|
1480
1483
|
end
|
1481
1484
|
|
1482
1485
|
it 'should use the specified user and password when setting the user to anything other than SYSTEM' do
|
1483
|
-
Puppet::Util::
|
1486
|
+
Puppet::Util::Windows::Security.stubs(:name_to_sid).with('my_user_name').returns('SID A')
|
1484
1487
|
|
1485
1488
|
resource = Puppet::Type.type(:scheduled_task).new(
|
1486
1489
|
:name => 'Test Task',
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#!/usr/bin/env rspec
|
1
|
+
#!/usr/bin/env ruby -S rspec
|
2
2
|
#
|
3
3
|
# Unit testing for the RedHat service Provider
|
4
4
|
#
|
@@ -45,6 +45,16 @@ describe provider_class, :as_platform => :posix do
|
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
|
+
it "(#15797) should use 'on' when calling enable" do
|
49
|
+
provider_class.expects(:chkconfig).with(@resource[:name], :on)
|
50
|
+
@provider.enable
|
51
|
+
end
|
52
|
+
|
53
|
+
it "(#15797) should explicitly turn off the service in all run levels" do
|
54
|
+
provider_class.expects(:chkconfig).with("--level", "0123456", @resource[:name], :off)
|
55
|
+
@provider.disable
|
56
|
+
end
|
57
|
+
|
48
58
|
it "should have an enabled? method" do
|
49
59
|
@provider.should respond_to(:enabled?)
|
50
60
|
end
|