puppet 2.7.3 → 2.7.4
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- data/CHANGELOG +166 -0
- data/install.rb +27 -7
- data/lib/puppet/application/agent.rb +29 -29
- data/lib/puppet/application/doc.rb +1 -1
- data/lib/puppet/application/inspect.rb +9 -1
- data/lib/puppet/application/master.rb +2 -0
- data/lib/puppet/application/queue.rb +1 -1
- data/lib/puppet/application/resource.rb +3 -0
- data/lib/puppet/application.rb +4 -5
- data/lib/puppet/configurer.rb +1 -4
- data/lib/puppet/defaults.rb +45 -15
- data/lib/puppet/feature/base.rb +28 -17
- data/lib/puppet/feature/rails.rb +0 -3
- data/lib/puppet/feature/rubygems.rb +0 -3
- data/lib/puppet/file_bucket/dipper.rb +3 -2
- data/lib/puppet/file_bucket/file.rb +3 -3
- data/lib/puppet/file_serving/base.rb +4 -5
- data/lib/puppet/file_serving/configuration.rb +7 -13
- data/lib/puppet/file_serving/content.rb +0 -4
- data/lib/puppet/file_serving/fileset.rb +7 -6
- data/lib/puppet/file_serving/indirection_hooks.rb +1 -4
- data/lib/puppet/file_serving/metadata.rb +0 -4
- data/lib/puppet/file_serving/mount/file.rb +9 -12
- data/lib/puppet/file_serving/mount.rb +0 -5
- data/lib/puppet/file_serving/terminus_helper.rb +0 -4
- data/lib/puppet/file_serving.rb +0 -4
- data/lib/puppet/indirector/catalog/compiler.rb +0 -18
- data/lib/puppet/indirector/catalog/store_configs.rb +5 -0
- data/lib/puppet/indirector/direct_file_server.rb +0 -4
- data/lib/puppet/indirector/facts/facter.rb +2 -2
- data/lib/puppet/indirector/facts/store_configs.rb +5 -0
- data/lib/puppet/indirector/file_content/file.rb +0 -4
- data/lib/puppet/indirector/file_content/file_server.rb +0 -4
- data/lib/puppet/indirector/file_content/rest.rb +0 -4
- data/lib/puppet/indirector/file_metadata/file.rb +0 -4
- data/lib/puppet/indirector/file_metadata/file_server.rb +0 -4
- data/lib/puppet/indirector/file_metadata/rest.rb +0 -4
- data/lib/puppet/indirector/file_server.rb +1 -5
- data/lib/puppet/indirector/indirection.rb +3 -5
- data/lib/puppet/indirector/node/store_configs.rb +5 -0
- data/lib/puppet/indirector/request.rb +3 -1
- data/lib/puppet/indirector/resource/active_record.rb +97 -0
- data/lib/puppet/indirector/resource/store_configs.rb +3 -0
- data/lib/puppet/indirector/ssl_file.rb +5 -1
- data/lib/puppet/indirector/store_configs.rb +30 -0
- data/lib/puppet/indirector/yaml.rb +5 -0
- data/lib/puppet/indirector.rb +7 -0
- data/lib/puppet/network/client.rb +0 -5
- data/lib/puppet/network/http_pool.rb +0 -56
- data/lib/puppet/node/environment.rb +9 -11
- data/lib/puppet/parameter/path.rb +1 -5
- data/lib/puppet/parameter.rb +1 -7
- data/lib/puppet/parser/ast/collection.rb +2 -2
- data/lib/puppet/parser/ast/collexpr.rb +10 -39
- data/lib/puppet/parser/collector.rb +41 -90
- data/lib/puppet/parser/compiler.rb +0 -3
- data/lib/puppet/parser/functions/create_resources.rb +22 -10
- data/lib/puppet/parser/functions/versioncmp.rb +9 -6
- data/lib/puppet/parser/resource.rb +1 -1
- data/lib/puppet/parser/type_loader.rb +2 -1
- data/lib/puppet/provider/augeas/augeas.rb +5 -3
- data/lib/puppet/provider/cron/crontab.rb +2 -2
- data/lib/puppet/provider/exec/posix.rb +23 -96
- data/lib/puppet/provider/exec/shell.rb +11 -2
- data/lib/puppet/provider/exec/windows.rb +35 -0
- data/lib/puppet/provider/exec.rb +79 -0
- data/lib/puppet/provider/group/windows_adsi.rb +48 -0
- data/lib/puppet/provider/host/parsed.rb +3 -0
- data/lib/puppet/provider/macauthorization/macauthorization.rb +4 -4
- data/lib/puppet/provider/mount.rb +0 -3
- data/lib/puppet/provider/naginator.rb +0 -3
- data/lib/puppet/provider/package/appdmg.rb +0 -1
- data/lib/puppet/provider/package/apple.rb +3 -7
- data/lib/puppet/provider/package/apt.rb +0 -1
- data/lib/puppet/provider/package/aptitude.rb +0 -1
- data/lib/puppet/provider/package/aptrpm.rb +0 -1
- data/lib/puppet/provider/package/blastwave.rb +0 -1
- data/lib/puppet/provider/package/dpkg.rb +5 -6
- data/lib/puppet/provider/package/fink.rb +3 -4
- data/lib/puppet/provider/package/freebsd.rb +0 -1
- data/lib/puppet/provider/package/gem.rb +0 -1
- data/lib/puppet/provider/package/hpux.rb +3 -3
- data/lib/puppet/provider/package/macports.rb +0 -1
- data/lib/puppet/provider/package/msi.rb +82 -0
- data/lib/puppet/provider/package/openbsd.rb +18 -19
- data/lib/puppet/provider/package/pip.rb +0 -1
- data/lib/puppet/provider/package/pkg.rb +0 -1
- data/lib/puppet/provider/package/pkgdmg.rb +9 -7
- data/lib/puppet/provider/package/pkgutil.rb +0 -1
- data/lib/puppet/provider/package/ports.rb +0 -1
- data/lib/puppet/provider/package/portupgrade.rb +183 -193
- data/lib/puppet/provider/package/rpm.rb +1 -1
- data/lib/puppet/provider/package/sun.rb +0 -1
- data/lib/puppet/provider/package/sunfreeware.rb +0 -2
- data/lib/puppet/provider/package/up2date.rb +0 -1
- data/lib/puppet/provider/package/urpmi.rb +0 -1
- data/lib/puppet/provider/package/yum.rb +1 -1
- data/lib/puppet/provider/package.rb +4 -3
- data/lib/puppet/provider/service/systemd.rb +64 -0
- data/lib/puppet/provider/service/windows.rb +110 -0
- data/lib/puppet/provider/user/windows_adsi.rb +71 -0
- data/lib/puppet/rails/resource.rb +1 -1
- data/lib/puppet/relationship.rb +0 -3
- data/lib/puppet/reports/tagmail.rb +15 -11
- data/lib/puppet/resource/catalog.rb +17 -24
- data/lib/puppet/ssl/certificate_authority.rb +7 -5
- data/lib/puppet/ssl/host.rb +6 -10
- data/lib/puppet/type/augeas.rb +19 -13
- data/lib/puppet/type/cron.rb +13 -12
- data/lib/puppet/type/exec.rb +17 -17
- data/lib/puppet/type/file/content.rb +7 -3
- data/lib/puppet/type/file/source.rb +14 -9
- data/lib/puppet/type/file.rb +44 -23
- data/lib/puppet/type/filebucket.rb +13 -5
- data/lib/puppet/type/package.rb +14 -1
- data/lib/puppet/type/service.rb +11 -1
- data/lib/puppet/type/ssh_authorized_key.rb +3 -1
- data/lib/puppet/type.rb +8 -17
- data/lib/puppet/util/adsi.rb +278 -0
- data/lib/puppet/util/autoload.rb +0 -2
- data/lib/puppet/util/cacher.rb +15 -67
- data/lib/puppet/util/feature.rb +0 -3
- data/lib/puppet/util/graph.rb +0 -3
- data/lib/puppet/util/ldap/connection.rb +0 -3
- data/lib/puppet/util/ldap/generator.rb +0 -3
- data/lib/puppet/util/ldap.rb +0 -3
- data/lib/puppet/util/log_paths.rb +0 -3
- data/lib/puppet/util/network_device/cisco/device.rb +2 -1
- data/lib/puppet/util/network_device/cisco/facts.rb +1 -1
- data/lib/puppet/util/pidlock.rb +5 -1
- data/lib/puppet/util/rdoc/parser.rb +3 -1
- data/lib/puppet/util/run_mode.rb +2 -2
- data/lib/puppet/util/settings/file_setting.rb +3 -2
- data/lib/puppet/util/settings.rb +4 -6
- data/lib/puppet/util/suidmanager.rb +62 -15
- data/lib/puppet/util.rb +113 -131
- data/lib/puppet.rb +1 -1
- data/spec/integration/application/doc_spec.rb +1 -1
- data/spec/integration/defaults_spec.rb +22 -17
- data/spec/integration/file_serving/content_spec.rb +0 -6
- data/spec/integration/file_serving/metadata_spec.rb +0 -6
- data/spec/integration/file_serving/terminus_helper_spec.rb +1 -1
- data/spec/integration/indirector/direct_file_server_spec.rb +5 -7
- data/spec/integration/indirector/file_content/file_server_spec.rb +2 -6
- data/spec/integration/indirector/file_metadata/file_server_spec.rb +1 -5
- data/spec/integration/network/server/webrick_spec.rb +6 -9
- data/spec/integration/node/facts_spec.rb +0 -6
- data/spec/integration/node_spec.rb +3 -4
- data/spec/integration/parser/compiler_spec.rb +2 -1
- data/spec/integration/parser/parser_spec.rb +2 -4
- data/spec/integration/provider/mount_spec.rb +1 -1
- data/spec/integration/provider/package_spec.rb +13 -3
- data/spec/integration/provider/ssh_authorized_key_spec.rb +4 -4
- data/spec/integration/reports_spec.rb +0 -4
- data/spec/integration/resource/catalog_spec.rb +0 -5
- data/spec/integration/ssl/certificate_authority_spec.rb +6 -14
- data/spec/integration/ssl/certificate_request_spec.rb +10 -17
- data/spec/integration/ssl/certificate_revocation_list_spec.rb +8 -13
- data/spec/integration/ssl/host_spec.rb +8 -14
- data/spec/integration/transaction/report_spec.rb +0 -5
- data/spec/integration/transaction_spec.rb +11 -13
- data/spec/integration/type/file_spec.rb +16 -16
- data/spec/integration/type/tidy_spec.rb +1 -1
- data/spec/integration/util/settings_spec.rb +2 -2
- data/spec/integration/util_spec.rb +13 -0
- data/spec/lib/puppet_spec/files.rb +18 -10
- data/spec/shared_behaviours/file_server_terminus.rb +1 -5
- data/spec/shared_behaviours/file_serving.rb +0 -4
- data/spec/shared_behaviours/memory_terminus.rb +0 -4
- data/spec/shared_behaviours/path_parameters.rb +20 -18
- data/spec/shared_behaviours/store_configs_terminus.rb +21 -0
- data/spec/spec_helper.rb +31 -0
- data/spec/unit/agent_spec.rb +0 -4
- data/spec/unit/application/apply_spec.rb +8 -2
- data/spec/unit/application/certificate_spec.rb +2 -0
- data/spec/unit/application/device_spec.rb +8 -6
- data/spec/unit/application/inspect_spec.rb +2 -1
- data/spec/unit/application/master_spec.rb +7 -2
- data/spec/unit/application/queue_spec.rb +3 -4
- data/spec/unit/application/resource_spec.rb +26 -0
- data/spec/unit/application/secret_agent_spec.rb +3 -1
- data/spec/unit/application_spec.rb +4 -0
- data/spec/unit/configurer/downloader_spec.rb +4 -3
- data/spec/unit/configurer_spec.rb +11 -4
- data/spec/unit/daemon_spec.rb +3 -1
- data/spec/unit/face/ca_spec.rb +1 -1
- data/spec/unit/face/node_spec.rb +5 -1
- data/spec/unit/face/secret_agent_spec.rb +3 -1
- data/spec/unit/file_bucket/dipper_spec.rb +4 -4
- data/spec/unit/file_bucket/file_spec.rb +9 -3
- data/spec/unit/file_serving/configuration_spec.rb +26 -37
- data/spec/unit/file_serving/fileset_spec.rb +71 -55
- data/spec/unit/file_serving/indirection_hooks_spec.rb +0 -4
- data/spec/unit/file_serving/mount/file_spec.rb +163 -169
- data/spec/unit/file_serving/terminus_helper_spec.rb +0 -4
- data/spec/unit/indirector/catalog/compiler_spec.rb +0 -22
- data/spec/unit/indirector/catalog/store_configs_spec.rb +17 -0
- data/spec/unit/indirector/certificate/ca_spec.rb +0 -4
- data/spec/unit/indirector/certificate/file_spec.rb +0 -4
- data/spec/unit/indirector/certificate_request/ca_spec.rb +1 -5
- data/spec/unit/indirector/certificate_request/file_spec.rb +0 -4
- data/spec/unit/indirector/certificate_revocation_list/ca_spec.rb +0 -4
- data/spec/unit/indirector/certificate_revocation_list/file_spec.rb +0 -4
- data/spec/unit/indirector/certificate_status/file_spec.rb +1 -1
- data/spec/unit/indirector/direct_file_server_spec.rb +0 -4
- data/spec/unit/indirector/facts/facter_spec.rb +0 -4
- data/spec/unit/indirector/facts/inventory_active_record_spec.rb +3 -0
- data/spec/unit/indirector/facts/store_configs_spec.rb +17 -0
- data/spec/unit/indirector/file_bucket_file/file_spec.rb +3 -3
- data/spec/unit/indirector/file_content/file_server_spec.rb +0 -4
- data/spec/unit/indirector/file_content/file_spec.rb +0 -4
- data/spec/unit/indirector/file_metadata/file_server_spec.rb +0 -4
- data/spec/unit/indirector/file_metadata/file_spec.rb +0 -4
- data/spec/unit/indirector/file_server_spec.rb +1 -5
- data/spec/unit/indirector/indirection_spec.rb +0 -4
- data/spec/unit/indirector/key/ca_spec.rb +0 -4
- data/spec/unit/indirector/key/file_spec.rb +0 -4
- data/spec/unit/indirector/node/store_configs_spec.rb +16 -0
- data/spec/unit/indirector/report/processor_spec.rb +0 -4
- data/spec/unit/indirector/resource/active_record_spec.rb +192 -0
- data/spec/unit/indirector/resource/ral_spec.rb +1 -1
- data/spec/unit/indirector/resource/store_configs_spec.rb +12 -0
- data/spec/unit/indirector/resource_type/parser_spec.rb +3 -3
- data/spec/unit/indirector/ssl_file_spec.rb +25 -6
- data/spec/unit/indirector/store_configs_spec.rb +8 -0
- data/spec/unit/indirector/yaml_spec.rb +14 -0
- data/spec/unit/module_spec.rb +2 -2
- data/spec/unit/network/handler/fileserver_spec.rb +5 -5
- data/spec/unit/network/http/mongrel_spec.rb +0 -4
- data/spec/unit/network/http/webrick_spec.rb +5 -9
- data/spec/unit/network/http_pool_spec.rb +4 -75
- data/spec/unit/network/http_spec.rb +0 -4
- data/spec/unit/network/server_spec.rb +0 -4
- data/spec/unit/node/environment_spec.rb +18 -31
- data/spec/unit/node/facts_spec.rb +0 -4
- data/spec/unit/node_spec.rb +1 -8
- data/spec/unit/other/selinux_spec.rb +3 -1
- data/spec/unit/parameter_spec.rb +0 -10
- data/spec/unit/parser/ast/collexpr_spec.rb +17 -13
- data/spec/unit/parser/collector_spec.rb +147 -263
- data/spec/unit/parser/compiler_spec.rb +3 -1
- data/spec/unit/parser/files_spec.rb +7 -4
- data/spec/unit/parser/functions/extlookup_spec.rb +6 -3
- data/spec/unit/parser/functions/sprintf_spec.rb +2 -1
- data/spec/unit/parser/type_loader_spec.rb +7 -7
- data/spec/unit/property_spec.rb +1 -1
- data/spec/unit/provider/augeas/augeas_spec.rb +14 -0
- data/spec/unit/provider/exec/posix_spec.rb +102 -106
- data/spec/unit/provider/exec/shell_spec.rb +1 -1
- data/spec/unit/provider/exec/windows_spec.rb +119 -0
- data/spec/unit/provider/group/ldap_spec.rb +0 -4
- data/spec/unit/provider/group/windows_adsi_spec.rb +79 -0
- data/spec/unit/provider/ldap_spec.rb +0 -4
- data/spec/unit/provider/macauthorization_spec.rb +5 -0
- data/spec/unit/provider/mount/parsed_spec.rb +1 -5
- data/spec/unit/provider/package/msi_spec.rb +170 -0
- data/spec/unit/provider/service/redhat_spec.rb +2 -0
- data/spec/unit/provider/service/smf_spec.rb +3 -0
- data/spec/unit/provider/service/systemd_spec.rb +25 -0
- data/spec/unit/provider/service/windows_spec.rb +166 -0
- data/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +2 -2
- data/spec/unit/provider/user/ldap_spec.rb +0 -4
- data/spec/unit/provider/user/user_role_add_spec.rb +1 -1
- data/spec/unit/provider/user/useradd_spec.rb +1 -1
- data/spec/unit/provider/user/windows_adsi_spec.rb +110 -0
- data/spec/unit/relationship_spec.rb +0 -4
- data/spec/unit/resource/catalog_spec.rb +37 -25
- data/spec/unit/resource/status_spec.rb +4 -2
- data/spec/unit/resource_spec.rb +5 -5
- data/spec/unit/simple_graph_spec.rb +0 -4
- data/spec/unit/ssl/certificate_authority_spec.rb +2 -2
- data/spec/unit/ssl/host_spec.rb +12 -13
- data/spec/unit/ssl/inventory_spec.rb +2 -2
- data/spec/unit/sslcertificates/ca_spec.rb +6 -10
- data/spec/unit/transaction/event_manager_spec.rb +4 -2
- data/spec/unit/transaction/event_spec.rb +3 -1
- data/spec/unit/transaction/report_spec.rb +2 -6
- data/spec/unit/transaction/resource_harness_spec.rb +9 -5
- data/spec/unit/transaction_spec.rb +3 -1
- data/spec/unit/type/cron_spec.rb +1 -1
- data/spec/unit/type/exec_spec.rb +80 -47
- data/spec/unit/type/file/checksum_spec.rb +9 -8
- data/spec/unit/type/file/content_spec.rb +2 -1
- data/spec/unit/type/file/selinux_spec.rb +10 -8
- data/spec/unit/type/file/source_spec.rb +18 -36
- data/spec/unit/type/file_spec.rb +170 -217
- data/spec/unit/type/group_spec.rb +1 -1
- data/spec/unit/type/mount_spec.rb +5 -5
- data/spec/unit/type/noop_metaparam_spec.rb +3 -1
- data/spec/unit/type/package_spec.rb +15 -3
- data/spec/unit/type/resources_spec.rb +2 -2
- data/spec/unit/type/service_spec.rb +19 -4
- data/spec/unit/type/ssh_authorized_key_spec.rb +10 -4
- data/spec/unit/type/tidy_spec.rb +3 -1
- data/spec/unit/type/user_spec.rb +1 -1
- data/spec/unit/type_spec.rb +29 -34
- data/spec/unit/util/adsi_spec.rb +202 -0
- data/spec/unit/util/autoload_spec.rb +23 -19
- data/spec/unit/util/backups_spec.rb +16 -13
- data/spec/unit/util/cacher_spec.rb +64 -141
- data/spec/unit/util/checksums_spec.rb +0 -4
- data/spec/unit/util/constant_inflector_spec.rb +0 -4
- data/spec/unit/util/execution_stub_spec.rb +1 -1
- data/spec/unit/util/ldap/connection_spec.rb +0 -4
- data/spec/unit/util/ldap/generator_spec.rb +0 -4
- data/spec/unit/util/ldap/manager_spec.rb +0 -4
- data/spec/unit/util/log_spec.rb +4 -2
- data/spec/unit/util/logging_spec.rb +2 -2
- data/spec/unit/util/nagios_maker_spec.rb +0 -4
- data/spec/unit/util/network_device/cisco/device_spec.rb +2 -1
- data/spec/unit/util/network_device/cisco/facts_spec.rb +3 -1
- data/spec/unit/util/network_device/config_spec.rb +5 -3
- data/spec/unit/util/rdoc/parser_spec.rb +7 -1
- data/spec/unit/util/run_mode_spec.rb +6 -2
- data/spec/unit/util/settings/file_setting_spec.rb +29 -2
- data/spec/unit/util/settings_spec.rb +28 -15
- data/spec/unit/util/storage_spec.rb +1 -1
- data/spec/unit/util/suidmanager_spec.rb +310 -0
- data/spec/unit/util/tagging_spec.rb +0 -4
- data/spec/unit/util_spec.rb +335 -0
- data/test/language/ast/variable.rb +0 -4
- data/test/lib/puppettest/support/resources.rb +0 -4
- data/test/lib/puppettest/testcase.rb +0 -4
- data/test/lib/puppettest.rb +0 -1
- data/test/network/handler/master.rb +0 -5
- data/test/network/server/webrick.rb +5 -22
- data/test/ral/manager/attributes.rb +0 -4
- data/test/ral/manager/instances.rb +0 -4
- data/test/ral/manager/manager.rb +0 -4
- data/test/ral/providers/cron/crontab.rb +1 -0
- data/test/ral/providers/service/base.rb +0 -4
- data/test/ral/type/filesources.rb +0 -1
- data/test/ral/type/resources.rb +0 -4
- data/test/util/utiltest.rb +0 -13
- metadata +36 -9
- data/spec/unit/network/client_spec.rb +0 -45
- data/test/puppet/tc_suidmanager.rb +0 -120
@@ -43,6 +43,8 @@ class CompilerTestResource
|
|
43
43
|
end
|
44
44
|
|
45
45
|
describe Puppet::Parser::Compiler do
|
46
|
+
include PuppetSpec::Files
|
47
|
+
|
46
48
|
def resource(type, title)
|
47
49
|
Puppet::Parser::Resource.new(type, title, :scope => @scope)
|
48
50
|
end
|
@@ -413,7 +415,7 @@ describe Puppet::Parser::Compiler do
|
|
413
415
|
end
|
414
416
|
|
415
417
|
it "should fail to add resources that conflict with existing resources" do
|
416
|
-
path =
|
418
|
+
path = make_absolute("/foo")
|
417
419
|
file1 = Puppet::Type.type(:file).new :path => path
|
418
420
|
file2 = Puppet::Type.type(:file).new :path => path
|
419
421
|
|
@@ -4,9 +4,10 @@ require 'spec_helper'
|
|
4
4
|
require 'puppet/parser/files'
|
5
5
|
|
6
6
|
describe Puppet::Parser::Files do
|
7
|
+
include PuppetSpec::Files
|
7
8
|
|
8
9
|
before do
|
9
|
-
@basepath =
|
10
|
+
@basepath = make_absolute("/somepath")
|
10
11
|
end
|
11
12
|
|
12
13
|
it "should have a method for finding a template" do
|
@@ -77,8 +78,9 @@ describe Puppet::Parser::Files do
|
|
77
78
|
it "should accept relative templatedirs" do
|
78
79
|
FileTest.stubs(:exist?).returns true
|
79
80
|
Puppet[:templatedir] = "my/templates"
|
80
|
-
|
81
|
-
|
81
|
+
# We expand_path to normalize backslashes and slashes on Windows
|
82
|
+
File.expects(:directory?).with(File.expand_path(File.join(Dir.getwd,"my/templates"))).returns(true)
|
83
|
+
Puppet::Parser::Files.find_template("mytemplate").should == File.expand_path(File.join(Dir.getwd,"my/templates/mytemplate"))
|
82
84
|
end
|
83
85
|
|
84
86
|
it "should use the environment templatedir if no module is found and an environment is specified" do
|
@@ -158,7 +160,8 @@ describe Puppet::Parser::Files do
|
|
158
160
|
end
|
159
161
|
|
160
162
|
it "should look for files relative to the current directory" do
|
161
|
-
|
163
|
+
# We expand_path to normalize backslashes and slashes on Windows
|
164
|
+
cwd = File.expand_path(Dir.getwd)
|
162
165
|
Dir.expects(:glob).with("#{cwd}/foobar/init.pp").returns(["#{cwd}/foobar/init.pp"])
|
163
166
|
Puppet::Parser::Files.find_manifests("foobar/init.pp")[1].should == ["#{cwd}/foobar/init.pp"]
|
164
167
|
end
|
@@ -3,6 +3,8 @@ require 'spec_helper'
|
|
3
3
|
require 'tempfile'
|
4
4
|
|
5
5
|
describe "the extlookup function" do
|
6
|
+
include PuppetSpec::Files
|
7
|
+
|
6
8
|
before :all do
|
7
9
|
Puppet::Parser::Functions.autoloader.loadall
|
8
10
|
end
|
@@ -64,9 +66,10 @@ describe "the extlookup function" do
|
|
64
66
|
|
65
67
|
describe "should look in $extlookup_datadir for data files listed by $extlookup_precedence" do
|
66
68
|
before do
|
67
|
-
|
68
|
-
|
69
|
-
File.open("
|
69
|
+
dir = tmpdir('extlookup_datadir')
|
70
|
+
@scope.stubs(:lookupvar).with('::extlookup_datadir').returns(dir)
|
71
|
+
File.open(File.join(dir, "one.csv"),"w"){|one| one.puts "key,value1" }
|
72
|
+
File.open(File.join(dir, "two.csv"),"w") do |two|
|
70
73
|
two.puts "key,value2"
|
71
74
|
two.puts "key2,value_two"
|
72
75
|
end
|
@@ -30,7 +30,8 @@ describe "the sprintf function" do
|
|
30
30
|
|
31
31
|
it "should format large floats" do
|
32
32
|
result = @scope.function_sprintf(["%+.2e", "27182818284590451"])
|
33
|
-
|
33
|
+
str = Puppet.features.microsoft_windows? ? "+2.72e+016" : "+2.72e+16"
|
34
|
+
result.should(eql(str))
|
34
35
|
end
|
35
36
|
|
36
37
|
it "should perform more complex formatting" do
|
@@ -56,8 +56,8 @@ describe Puppet::Parser::TypeLoader do
|
|
56
56
|
end
|
57
57
|
|
58
58
|
it "should use the directory of the current file if one is set" do
|
59
|
-
Puppet::Parser::Files.expects(:find_manifests).with { |pat, opts| opts[:cwd] == "/current" }.returns ["modname", %w{one}]
|
60
|
-
@loader.import("myfile", "/current/file")
|
59
|
+
Puppet::Parser::Files.expects(:find_manifests).with { |pat, opts| opts[:cwd] == make_absolute("/current") }.returns ["modname", %w{one}]
|
60
|
+
@loader.import("myfile", make_absolute("/current/file"))
|
61
61
|
end
|
62
62
|
|
63
63
|
it "should pass the environment when looking for files" do
|
@@ -71,15 +71,15 @@ describe Puppet::Parser::TypeLoader do
|
|
71
71
|
end
|
72
72
|
|
73
73
|
it "should parse each found file" do
|
74
|
-
Puppet::Parser::Files.expects(:find_manifests).returns ["modname",
|
75
|
-
@loader.expects(:parse_file).with("/one").returns(Puppet::Parser::AST::Hostclass.new(''))
|
74
|
+
Puppet::Parser::Files.expects(:find_manifests).returns ["modname", [make_absolute("/one")]]
|
75
|
+
@loader.expects(:parse_file).with(make_absolute("/one")).returns(Puppet::Parser::AST::Hostclass.new(''))
|
76
76
|
@loader.import("myfile")
|
77
77
|
end
|
78
78
|
|
79
79
|
it "should make each file qualified before attempting to parse it" do
|
80
80
|
Puppet::Parser::Files.expects(:find_manifests).returns ["modname", %w{one}]
|
81
|
-
@loader.expects(:parse_file).with("/current/one").returns(Puppet::Parser::AST::Hostclass.new(''))
|
82
|
-
@loader.import("myfile", "/current/file")
|
81
|
+
@loader.expects(:parse_file).with(make_absolute("/current/one")).returns(Puppet::Parser::AST::Hostclass.new(''))
|
82
|
+
@loader.import("myfile", make_absolute("/current/file"))
|
83
83
|
end
|
84
84
|
|
85
85
|
it "should not attempt to import files that have already been imported" do
|
@@ -102,7 +102,7 @@ describe Puppet::Parser::TypeLoader do
|
|
102
102
|
@modulebase2 = File.join(@base, "second")
|
103
103
|
FileUtils.mkdir_p(@modulebase2)
|
104
104
|
|
105
|
-
Puppet[:modulepath] = "#{@modulebase1}
|
105
|
+
Puppet[:modulepath] = "#{@modulebase1}#{File::PATH_SEPARATOR}#{@modulebase2}"
|
106
106
|
end
|
107
107
|
|
108
108
|
def mk_module(basedir, name)
|
data/spec/unit/property_spec.rb
CHANGED
@@ -442,6 +442,20 @@ describe provider_class do
|
|
442
442
|
@provider.expects(:diff).with("#{file}", "#{file}.augnew").returns("")
|
443
443
|
@provider.should be_need_to_run
|
444
444
|
end
|
445
|
+
|
446
|
+
it "should fail with an error if saving fails" do
|
447
|
+
file = "/etc/hosts"
|
448
|
+
|
449
|
+
@resource[:context] = "/files"
|
450
|
+
@resource[:changes] = ["set #{file}/foo bar"]
|
451
|
+
|
452
|
+
@augeas_stub.stubs(:save).returns(false)
|
453
|
+
@augeas_stub.stubs(:match).with("/augeas/events/saved").returns([])
|
454
|
+
@augeas_stub.expects(:close)
|
455
|
+
|
456
|
+
@provider.expects(:diff).never()
|
457
|
+
lambda { @provider.need_to_run? }.should raise_error
|
458
|
+
end
|
445
459
|
end
|
446
460
|
end
|
447
461
|
|
@@ -1,120 +1,116 @@
|
|
1
1
|
#!/usr/bin/env rspec
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
|
-
|
4
|
+
describe Puppet::Type.type(:exec).provider(:posix) do
|
5
|
+
include PuppetSpec::Files
|
6
|
+
|
7
|
+
def make_exe
|
8
|
+
command = tmpfile('my_command')
|
9
|
+
FileUtils.touch(command)
|
10
|
+
File.chmod(0755, command)
|
11
|
+
command
|
12
|
+
end
|
13
|
+
|
14
|
+
let(:resource) { Puppet::Type.type(:exec).new(:title => File.expand_path('/foo'), :provider => :posix) }
|
15
|
+
let(:provider) { described_class.new(resource) }
|
16
|
+
|
17
|
+
describe "#validatecmd" do
|
18
|
+
it "should fail if no path is specified and the command is not fully qualified" do
|
19
|
+
expect { provider.validatecmd("foo") }.to raise_error(
|
20
|
+
Puppet::Error,
|
21
|
+
"'foo' is not qualified and no path was specified. Please qualify the command or specify a path."
|
22
|
+
)
|
23
|
+
end
|
5
24
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
25
|
+
it "should pass if a path is given" do
|
26
|
+
provider.resource[:path] = ['/bogus/bin']
|
27
|
+
provider.validatecmd("../foo")
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should pass if command is fully qualifed" do
|
31
|
+
provider.resource[:path] = ['/bogus/bin']
|
32
|
+
provider.validatecmd(File.expand_path("/bin/blah/foo"))
|
33
|
+
end
|
10
34
|
end
|
11
35
|
|
12
|
-
|
13
|
-
describe "when
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
36
|
+
describe "#run" do
|
37
|
+
describe "when the command is an absolute path" do
|
38
|
+
let(:command) { tmpfile('foo') }
|
39
|
+
|
40
|
+
it "should fail if the command doesn't exist" do
|
41
|
+
expect { provider.run(command) }.to raise_error(ArgumentError, "Could not find command '#{command}'")
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should fail if the command isn't a file" do
|
45
|
+
FileUtils.mkdir(command)
|
46
|
+
FileUtils.chmod(0755, command)
|
47
|
+
|
48
|
+
expect { provider.run(command) }.to raise_error(ArgumentError, "'#{command}' is a directory, not a file")
|
49
|
+
end
|
50
|
+
|
51
|
+
it "should fail if the command isn't executable" do
|
52
|
+
FileUtils.touch(command)
|
53
|
+
File.stubs(:executable?).with(command).returns(false)
|
54
|
+
|
55
|
+
expect { provider.run(command) }.to raise_error(ArgumentError, "'#{command}' is not executable")
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
describe "when the command is a relative path" do
|
60
|
+
it "should execute the command if it finds it in the path and is executable" do
|
61
|
+
command = make_exe
|
62
|
+
provider.resource[:path] = [File.dirname(command)]
|
63
|
+
filename = File.basename(command)
|
64
|
+
|
65
|
+
Puppet::Util.expects(:execute).with { |cmdline, arguments| (cmdline == filename) && (arguments.is_a? Hash) }
|
66
|
+
|
67
|
+
provider.run(filename)
|
22
68
|
end
|
23
69
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
"'foo' is not qualified and no path was specified. Please qualify the command or specify a path."
|
29
|
-
)
|
30
|
-
end
|
31
|
-
|
32
|
-
it "should pass if a path is given" do
|
33
|
-
@provider.resource[:path] = ['/bogus/bin']
|
34
|
-
@provider.validatecmd("../foo")
|
35
|
-
end
|
36
|
-
|
37
|
-
it "should pass if command is fully qualifed" do
|
38
|
-
@provider.resource[:path] = ['/bogus/bin']
|
39
|
-
@provider.validatecmd("/bin/blah/foo")
|
40
|
-
end
|
70
|
+
it "should fail if the command isn't in the path" do
|
71
|
+
resource[:path] = ["/fake/path"]
|
72
|
+
|
73
|
+
expect { provider.run('foo') }.to raise_error(ArgumentError, "Could not find command 'foo'")
|
41
74
|
end
|
42
75
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
end
|
52
|
-
|
53
|
-
it "should fail if the command isn't executable" do
|
54
|
-
@provider.resource[:path] = ['/bogus/bin']
|
55
|
-
File.stubs(:exists?).with("foo").returns(true)
|
56
|
-
|
57
|
-
lambda { @provider.run("foo") }.should raise_error(ArgumentError, "'foo' is not executable")
|
58
|
-
end
|
59
|
-
|
60
|
-
it "should not be able to execute shell builtins" do
|
61
|
-
@provider.resource[:path] = ['/bin']
|
62
|
-
lambda { @provider.run("cd ..") }.should raise_error(ArgumentError, "Could not find command 'cd'")
|
63
|
-
end
|
64
|
-
|
65
|
-
it "should execute the command if the command given includes arguments or subcommands" do
|
66
|
-
@provider.resource[:path] = ['/bogus/bin']
|
67
|
-
File.stubs(:exists?).returns(false)
|
68
|
-
File.stubs(:exists?).with("foo").returns(true)
|
69
|
-
File.stubs(:executable?).with("foo").returns(true)
|
70
|
-
|
71
|
-
Puppet::Util.expects(:execute).with() { |command, arguments| (command == ['foo bar --sillyarg=true --blah']) && (arguments.is_a? Hash) }
|
72
|
-
@provider.run("foo bar --sillyarg=true --blah")
|
73
|
-
end
|
74
|
-
|
75
|
-
it "should fail if quoted command doesn't exist" do
|
76
|
-
@provider.resource[:path] = ['/bogus/bin']
|
77
|
-
File.stubs(:exists?).returns(false)
|
78
|
-
File.stubs(:exists?).with("foo").returns(true)
|
79
|
-
File.stubs(:executable?).with("foo").returns(true)
|
80
|
-
|
81
|
-
lambda { @provider.run('"foo bar --sillyarg=true --blah"') }.should raise_error(ArgumentError, "Could not find command 'foo bar --sillyarg=true --blah'")
|
82
|
-
end
|
83
|
-
|
84
|
-
it "should execute the command if it finds it in the path and is executable" do
|
85
|
-
@provider.resource[:path] = ['/bogus/bin']
|
86
|
-
File.stubs(:exists?).with("foo").returns(true)
|
87
|
-
File.stubs(:executable?).with("foo").returns(true)
|
88
|
-
Puppet::Util.expects(:execute).with() { |command, arguments| (command == ['foo']) && (arguments.is_a? Hash) }
|
89
|
-
|
90
|
-
@provider.run("foo")
|
91
|
-
end
|
92
|
-
|
93
|
-
if feature == "microsoft_windows"
|
94
|
-
[".exe", ".ps1", ".bat", ".com", ""].each do |extension|
|
95
|
-
it "should check file extension #{extension} when it can't find the executable" do
|
96
|
-
@provider.resource[:path] = ['/bogus/bin']
|
97
|
-
File.stubs(:exists?).returns(false)
|
98
|
-
File.stubs(:exists?).with("/bogus/bin/foo#{extension}").returns(true)
|
99
|
-
File.stubs(:executable?).with("foo").returns(true)
|
100
|
-
Puppet::Util.expects(:execute).with() { |command, arguments| (command == ['foo']) && (arguments.is_a? Hash) }
|
101
|
-
|
102
|
-
@provider.run("foo")
|
103
|
-
end
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
it "should warn if you're overriding something in environment" do
|
108
|
-
@provider.resource[:environment] = ['WHATEVER=/something/else', 'WHATEVER=/foo']
|
109
|
-
File.stubs(:exists?).returns(false)
|
110
|
-
File.stubs(:exists?).with("foo").returns(true)
|
111
|
-
File.stubs(:executable?).with("foo").returns(true)
|
112
|
-
|
113
|
-
Puppet::Util.expects(:execute).with() { |command, arguments| (command == ['foo']) && (arguments.is_a? Hash) }
|
114
|
-
@provider.run("foo")
|
115
|
-
@logs.map {|l| "#{l.level}: #{l.message}" }.should == ["warning: Overriding environment setting 'WHATEVER' with '/foo'"]
|
116
|
-
end
|
76
|
+
it "should fail if the command is in the path but not executable" do
|
77
|
+
command = tmpfile('foo')
|
78
|
+
FileUtils.touch(command)
|
79
|
+
FileTest.stubs(:executable?).with(command).returns(false)
|
80
|
+
resource[:path] = [File.dirname(command)]
|
81
|
+
filename = File.basename(command)
|
82
|
+
|
83
|
+
expect { provider.run(filename) }.to raise_error(ArgumentError, "Could not find command '#{filename}'")
|
117
84
|
end
|
118
85
|
end
|
86
|
+
|
87
|
+
it "should not be able to execute shell builtins" do
|
88
|
+
provider.resource[:path] = ['/bin']
|
89
|
+
expect { provider.run("cd ..") }.to raise_error(ArgumentError, "Could not find command 'cd'")
|
90
|
+
end
|
91
|
+
|
92
|
+
it "should execute the command if the command given includes arguments or subcommands" do
|
93
|
+
provider.resource[:path] = ['/bogus/bin']
|
94
|
+
command = make_exe
|
95
|
+
|
96
|
+
Puppet::Util.expects(:execute).with { |cmdline, arguments| (cmdline == "#{command} bar --sillyarg=true --blah") && (arguments.is_a? Hash) }
|
97
|
+
provider.run("#{command} bar --sillyarg=true --blah")
|
98
|
+
end
|
99
|
+
|
100
|
+
it "should fail if quoted command doesn't exist" do
|
101
|
+
provider.resource[:path] = ['/bogus/bin']
|
102
|
+
command = "#{File.expand_path('/foo')} bar --sillyarg=true --blah"
|
103
|
+
|
104
|
+
expect { provider.run(%Q["#{command}"]) }.to raise_error(ArgumentError, "Could not find command '#{command}'")
|
105
|
+
end
|
106
|
+
|
107
|
+
it "should warn if you're overriding something in environment" do
|
108
|
+
provider.resource[:environment] = ['WHATEVER=/something/else', 'WHATEVER=/foo']
|
109
|
+
command = make_exe
|
110
|
+
|
111
|
+
Puppet::Util.expects(:execute).with { |cmdline, arguments| (cmdline == command) && (arguments.is_a? Hash) }
|
112
|
+
provider.run(command)
|
113
|
+
@logs.map {|l| "#{l.level}: #{l.message}" }.should == ["warning: Overriding environment setting 'WHATEVER' with '/foo'"]
|
114
|
+
end
|
119
115
|
end
|
120
116
|
end
|
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
|
4
4
|
provider_class = Puppet::Type.type(:exec).provider(:shell)
|
5
5
|
|
6
|
-
describe provider_class do
|
6
|
+
describe provider_class, :unless => Puppet.features.microsoft_windows? do
|
7
7
|
before :each do
|
8
8
|
@resource = Puppet::Resource.new(:exec, 'foo')
|
9
9
|
@provider = provider_class.new(@resource)
|
@@ -0,0 +1,119 @@
|
|
1
|
+
#!/usr/bin/env rspec
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Puppet::Type.type(:exec).provider(:windows) do
|
6
|
+
include PuppetSpec::Files
|
7
|
+
|
8
|
+
let(:resource) { Puppet::Type.type(:exec).new(:title => 'C:\foo', :provider => :windows) }
|
9
|
+
let(:provider) { described_class.new(resource) }
|
10
|
+
|
11
|
+
before :each do
|
12
|
+
Puppet.features.stubs(:microsoft_windows?).returns(true)
|
13
|
+
Puppet.features.stubs(:posix?).returns(false)
|
14
|
+
end
|
15
|
+
|
16
|
+
after :all do
|
17
|
+
# This provider may not be suitable on some machines, so we want to reset
|
18
|
+
# the default so it isn't used by mistake in future specs.
|
19
|
+
Puppet::Type.type(:exec).defaultprovider = nil
|
20
|
+
end
|
21
|
+
|
22
|
+
describe "#extractexe" do
|
23
|
+
describe "when the command has no arguments" do
|
24
|
+
it "should return the command if it's quoted" do
|
25
|
+
provider.extractexe('"foo"').should == 'foo'
|
26
|
+
end
|
27
|
+
|
28
|
+
it "should return the command if it's quoted and contains spaces" do
|
29
|
+
provider.extractexe('"foo bar"').should == 'foo bar'
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should return the command if it's not quoted" do
|
33
|
+
provider.extractexe('foo').should == 'foo'
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe "when the command has arguments" do
|
38
|
+
it "should return the command if it's quoted" do
|
39
|
+
provider.extractexe('"foo" bar baz').should == 'foo'
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should return the command if it's quoted and contains spaces" do
|
43
|
+
provider.extractexe('"foo bar" baz "quux quiz"').should == 'foo bar'
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should return the command if it's not quoted" do
|
47
|
+
provider.extractexe('foo bar baz').should == 'foo'
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe "#checkexe" do
|
53
|
+
describe "when the command is absolute", :if => Puppet.features.microsoft_windows? do
|
54
|
+
it "should return if the command exists and is a file" do
|
55
|
+
command = tmpfile('command')
|
56
|
+
FileUtils.touch(command)
|
57
|
+
|
58
|
+
provider.checkexe(command).should == nil
|
59
|
+
end
|
60
|
+
it "should fail if the command doesn't exist" do
|
61
|
+
command = tmpfile('command')
|
62
|
+
|
63
|
+
expect { provider.checkexe(command) }.to raise_error(ArgumentError, "Could not find command '#{command}'")
|
64
|
+
end
|
65
|
+
it "should fail if the command isn't a file" do
|
66
|
+
command = tmpfile('command')
|
67
|
+
FileUtils.mkdir(command)
|
68
|
+
|
69
|
+
expect { provider.checkexe(command) }.to raise_error(ArgumentError, "'#{command}' is a directory, not a file")
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
describe "when the command is relative" do
|
74
|
+
describe "and a path is specified" do
|
75
|
+
before :each do
|
76
|
+
provider.stubs(:which)
|
77
|
+
end
|
78
|
+
|
79
|
+
it "should search for executables with no extension" do
|
80
|
+
provider.expects(:which).with('foo').returns('foo')
|
81
|
+
|
82
|
+
provider.checkexe('foo')
|
83
|
+
end
|
84
|
+
|
85
|
+
%w[bat com ps1 exe].each do |ext|
|
86
|
+
it "should search for executables with the extension '#{ext}'" do
|
87
|
+
provider.expects(:which).with("foo.#{ext}").returns("foo.#{ext}")
|
88
|
+
|
89
|
+
provider.checkexe('foo')
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
it "should fail if the command isn't in the path" do
|
94
|
+
expect { provider.checkexe('foo') }.to raise_error(ArgumentError, "Could not find command 'foo'")
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
it "should fail if no path is specified" do
|
99
|
+
expect { provider.checkexe('foo') }.to raise_error(ArgumentError, "Could not find command 'foo'")
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
describe "#validatecmd" do
|
105
|
+
it "should fail if the command isn't absolute and there is no path" do
|
106
|
+
expect { provider.validatecmd('foo') }.to raise_error(Puppet::Error, /'foo' is not qualified and no path was specified/)
|
107
|
+
end
|
108
|
+
|
109
|
+
it "should not fail if the command is absolute and there is no path" do
|
110
|
+
provider.validatecmd('C:\foo').should == nil
|
111
|
+
end
|
112
|
+
|
113
|
+
it "should not fail if the command is not absolute and there is a path" do
|
114
|
+
resource[:path] = 'C:\path;C:\another_path'
|
115
|
+
|
116
|
+
provider.validatecmd('foo').should == nil
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
describe Puppet::Type.type(:group).provider(:windows_adsi) do
|
6
|
+
let(:resource) do
|
7
|
+
Puppet::Type.type(:group).new(
|
8
|
+
:title => 'testers',
|
9
|
+
:provider => :windows_adsi
|
10
|
+
)
|
11
|
+
end
|
12
|
+
|
13
|
+
let(:provider) { resource.provider }
|
14
|
+
|
15
|
+
let(:connection) { stub 'connection' }
|
16
|
+
|
17
|
+
before :each do
|
18
|
+
Puppet::Util::ADSI.stubs(:computer_name).returns('testcomputername')
|
19
|
+
Puppet::Util::ADSI.stubs(:connect).returns connection
|
20
|
+
end
|
21
|
+
|
22
|
+
describe ".instances" do
|
23
|
+
it "should enumerate all groups" do
|
24
|
+
names = ['group1', 'group2', 'group3']
|
25
|
+
stub_groups = names.map{|n| stub(:name => n)}
|
26
|
+
|
27
|
+
connection.stubs(:execquery).with("select * from win32_group").returns stub_groups
|
28
|
+
|
29
|
+
described_class.instances.map(&:name).should =~ names
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe "when managing members" do
|
34
|
+
it "should be able to provide a list of members" do
|
35
|
+
provider.group.stubs(:members).returns ['user1', 'user2', 'user3']
|
36
|
+
|
37
|
+
provider.members.should =~ ['user1', 'user2', 'user3']
|
38
|
+
end
|
39
|
+
|
40
|
+
it "should be able to set group members" do
|
41
|
+
provider.group.stubs(:members).returns ['user1', 'user2']
|
42
|
+
|
43
|
+
provider.group.expects(:remove_members).with('user1')
|
44
|
+
provider.group.expects(:add_members).with('user3')
|
45
|
+
|
46
|
+
provider.members = ['user2', 'user3']
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should be able to create a group" do
|
51
|
+
resource[:members] = ['user1', 'user2']
|
52
|
+
|
53
|
+
group = stub 'group'
|
54
|
+
Puppet::Util::ADSI::Group.expects(:create).with('testers').returns group
|
55
|
+
|
56
|
+
group.expects(:set_members).with(['user1', 'user2'])
|
57
|
+
|
58
|
+
provider.create
|
59
|
+
end
|
60
|
+
|
61
|
+
it "should be able to test whether a group exists" do
|
62
|
+
Puppet::Util::ADSI.stubs(:connect).returns stub('connection')
|
63
|
+
provider.should be_exists
|
64
|
+
|
65
|
+
Puppet::Util::ADSI.stubs(:connect).returns nil
|
66
|
+
provider.should_not be_exists
|
67
|
+
end
|
68
|
+
|
69
|
+
it "should be able to delete a group" do
|
70
|
+
connection.expects(:Delete).with('group', 'testers')
|
71
|
+
|
72
|
+
provider.delete
|
73
|
+
end
|
74
|
+
|
75
|
+
it "should warn when trying to manage the gid property" do
|
76
|
+
provider.expects(:warning).with { |msg| msg =~ /No support for managing property gid/ }
|
77
|
+
provider.send(:gid=, 500)
|
78
|
+
end
|
79
|
+
end
|
@@ -106,6 +106,11 @@ describe provider_class do
|
|
106
106
|
end
|
107
107
|
|
108
108
|
it "should call the internal method set_right" do
|
109
|
+
@provider.expects(:execute).with { |cmds, args|
|
110
|
+
cmds.include?("read") and
|
111
|
+
cmds.include?(@authname) and
|
112
|
+
args[:combine] == false
|
113
|
+
}.once
|
109
114
|
@provider.expects(:set_right)
|
110
115
|
@provider.flush
|
111
116
|
end
|
@@ -1,14 +1,10 @@
|
|
1
1
|
#!/usr/bin/env rspec
|
2
|
-
#
|
3
|
-
# Created by Luke Kanies on 2007-9-12.
|
4
|
-
# Copyright (c) 2006. All rights reserved.
|
5
|
-
|
6
2
|
require 'spec_helper'
|
7
3
|
require 'shared_behaviours/all_parsedfile_providers'
|
8
4
|
|
9
5
|
provider_class = Puppet::Type.type(:mount).provider(:parsed)
|
10
6
|
|
11
|
-
describe provider_class do
|
7
|
+
describe provider_class, :fails_on_windows => true do
|
12
8
|
|
13
9
|
before :each do
|
14
10
|
@mount_class = Puppet::Type.type(:mount)
|