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
@@ -254,6 +254,7 @@ describe content do
|
|
254
254
|
@content.should = "{md5}foo"
|
255
255
|
@content.resource.bucket.class.any_instance.stubs(:getfile).returns "foo"
|
256
256
|
@content.write(@fh)
|
257
|
+
@fh.close
|
257
258
|
end
|
258
259
|
|
259
260
|
describe "from actual content" do
|
@@ -298,7 +299,7 @@ describe content do
|
|
298
299
|
end
|
299
300
|
end
|
300
301
|
|
301
|
-
describe "from local source" do
|
302
|
+
describe "from local source", :fails_on_windows => true do
|
302
303
|
before(:each) do
|
303
304
|
@resource = Puppet::Type.type(:file).new :path => @filename, :backup => false
|
304
305
|
@sourcename = tmpfile('source')
|
@@ -1,12 +1,14 @@
|
|
1
1
|
#!/usr/bin/env rspec
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
|
-
|
5
4
|
[:seluser, :selrole, :seltype, :selrange].each do |param|
|
6
5
|
property = Puppet::Type.type(:file).attrclass(param)
|
7
6
|
describe property do
|
7
|
+
include PuppetSpec::Files
|
8
|
+
|
8
9
|
before do
|
9
|
-
@
|
10
|
+
@path = make_absolute("/my/file")
|
11
|
+
@resource = Puppet::Type.type(:file).new :path => @path
|
10
12
|
@sel = property.new :resource => @resource
|
11
13
|
end
|
12
14
|
|
@@ -18,14 +20,14 @@ require 'spec_helper'
|
|
18
20
|
it "should retrieve nil for #{param} if there is no SELinux support" do
|
19
21
|
stat = stub 'stat', :ftype => "foo"
|
20
22
|
@resource.expects(:stat).returns stat
|
21
|
-
@sel.expects(:get_selinux_current_context).with(
|
23
|
+
@sel.expects(:get_selinux_current_context).with(@path).returns nil
|
22
24
|
@sel.retrieve.should be_nil
|
23
25
|
end
|
24
26
|
|
25
27
|
it "should retrieve #{param} if a SELinux context is found with a range" do
|
26
28
|
stat = stub 'stat', :ftype => "foo"
|
27
29
|
@resource.expects(:stat).returns stat
|
28
|
-
@sel.expects(:get_selinux_current_context).with(
|
30
|
+
@sel.expects(:get_selinux_current_context).with(@path).returns "user_u:role_r:type_t:s0"
|
29
31
|
expectedresult = case param
|
30
32
|
when :seluser; "user_u"
|
31
33
|
when :selrole; "role_r"
|
@@ -38,7 +40,7 @@ require 'spec_helper'
|
|
38
40
|
it "should retrieve #{param} if a SELinux context is found without a range" do
|
39
41
|
stat = stub 'stat', :ftype => "foo"
|
40
42
|
@resource.expects(:stat).returns stat
|
41
|
-
@sel.expects(:get_selinux_current_context).with(
|
43
|
+
@sel.expects(:get_selinux_current_context).with(@path).returns "user_u:role_r:type_t"
|
42
44
|
expectedresult = case param
|
43
45
|
when :seluser; "user_u"
|
44
46
|
when :selrole; "role_r"
|
@@ -49,13 +51,13 @@ require 'spec_helper'
|
|
49
51
|
end
|
50
52
|
|
51
53
|
it "should handle no default gracefully" do
|
52
|
-
@sel.expects(:get_selinux_default_context).with(
|
54
|
+
@sel.expects(:get_selinux_default_context).with(@path).returns nil
|
53
55
|
@sel.default.must be_nil
|
54
56
|
end
|
55
57
|
|
56
58
|
it "should be able to detect matchpathcon defaults" do
|
57
59
|
@sel.stubs(:debug)
|
58
|
-
@sel.expects(:get_selinux_default_context).with(
|
60
|
+
@sel.expects(:get_selinux_default_context).with(@path).returns "user_u:role_r:type_t:s0"
|
59
61
|
expectedresult = case param
|
60
62
|
when :seluser; "user_u"
|
61
63
|
when :selrole; "role_r"
|
@@ -73,7 +75,7 @@ require 'spec_helper'
|
|
73
75
|
it "should be able to set a new context" do
|
74
76
|
stat = stub 'stat', :ftype => "foo"
|
75
77
|
@sel.should = %w{newone}
|
76
|
-
@sel.expects(:set_selinux_context).with(
|
78
|
+
@sel.expects(:set_selinux_context).with(@path, ["newone"], param)
|
77
79
|
@sel.sync
|
78
80
|
end
|
79
81
|
|
@@ -3,9 +3,13 @@ require 'spec_helper'
|
|
3
3
|
|
4
4
|
source = Puppet::Type.type(:file).attrclass(:source)
|
5
5
|
describe Puppet::Type.type(:file).attrclass(:source) do
|
6
|
+
include PuppetSpec::Files
|
7
|
+
|
6
8
|
before do
|
7
9
|
# Wow that's a messy interface to the resource.
|
8
10
|
@resource = stub 'resource', :[]= => nil, :property => nil, :catalog => stub("catalog", :dependent_data_expired? => false), :line => 0, :file => ''
|
11
|
+
@foobar = make_absolute("/foo/bar")
|
12
|
+
@feebooz = make_absolute("/fee/booz")
|
9
13
|
end
|
10
14
|
|
11
15
|
it "should be a subclass of Parameter" do
|
@@ -27,15 +31,7 @@ describe Puppet::Type.type(:file).attrclass(:source) do
|
|
27
31
|
end
|
28
32
|
end
|
29
33
|
|
30
|
-
|
31
|
-
source.new(:resource => @resource).must respond_to(:metadata)
|
32
|
-
end
|
33
|
-
|
34
|
-
it "should have a method for setting its metadata" do
|
35
|
-
source.new(:resource => @resource).must respond_to(:metadata=)
|
36
|
-
end
|
37
|
-
|
38
|
-
describe "when returning the metadata" do
|
34
|
+
describe "when returning the metadata", :fails_on_windows => true do
|
39
35
|
before do
|
40
36
|
@metadata = stub 'metadata', :source= => nil
|
41
37
|
end
|
@@ -52,58 +48,44 @@ describe Puppet::Type.type(:file).attrclass(:source) do
|
|
52
48
|
end
|
53
49
|
|
54
50
|
it "should collect its metadata using the Metadata class if it is not already set" do
|
55
|
-
@source = source.new(:resource => @resource, :value =>
|
56
|
-
Puppet::FileServing::Metadata.indirection.expects(:find).with(
|
51
|
+
@source = source.new(:resource => @resource, :value => @foobar)
|
52
|
+
Puppet::FileServing::Metadata.indirection.expects(:find).with(@foobar).returns @metadata
|
57
53
|
@source.metadata
|
58
54
|
end
|
59
55
|
|
60
56
|
it "should use the metadata from the first found source" do
|
61
57
|
metadata = stub 'metadata', :source= => nil
|
62
|
-
@source = source.new(:resource => @resource, :value => [
|
63
|
-
Puppet::FileServing::Metadata.indirection.expects(:find).with(
|
64
|
-
Puppet::FileServing::Metadata.indirection.expects(:find).with(
|
58
|
+
@source = source.new(:resource => @resource, :value => [@foobar, @feebooz])
|
59
|
+
Puppet::FileServing::Metadata.indirection.expects(:find).with(@foobar).returns nil
|
60
|
+
Puppet::FileServing::Metadata.indirection.expects(:find).with(@feebooz).returns metadata
|
65
61
|
@source.metadata.should equal(metadata)
|
66
62
|
end
|
67
63
|
|
68
64
|
it "should store the found source as the metadata's source" do
|
69
65
|
metadata = mock 'metadata'
|
70
|
-
@source = source.new(:resource => @resource, :value =>
|
71
|
-
Puppet::FileServing::Metadata.indirection.expects(:find).with(
|
66
|
+
@source = source.new(:resource => @resource, :value => @foobar)
|
67
|
+
Puppet::FileServing::Metadata.indirection.expects(:find).with(@foobar).returns metadata
|
72
68
|
|
73
|
-
metadata.expects(:source=).with(
|
69
|
+
metadata.expects(:source=).with(@foobar)
|
74
70
|
@source.metadata
|
75
71
|
end
|
76
72
|
|
77
73
|
it "should fail intelligently if an exception is encountered while querying for metadata" do
|
78
|
-
@source = source.new(:resource => @resource, :value =>
|
79
|
-
Puppet::FileServing::Metadata.indirection.expects(:find).with(
|
74
|
+
@source = source.new(:resource => @resource, :value => @foobar)
|
75
|
+
Puppet::FileServing::Metadata.indirection.expects(:find).with(@foobar).raises RuntimeError
|
80
76
|
|
81
77
|
@source.expects(:fail).raises ArgumentError
|
82
78
|
lambda { @source.metadata }.should raise_error(ArgumentError)
|
83
79
|
end
|
84
80
|
|
85
81
|
it "should fail if no specified sources can be found" do
|
86
|
-
@source = source.new(:resource => @resource, :value =>
|
87
|
-
Puppet::FileServing::Metadata.indirection.expects(:find).with(
|
82
|
+
@source = source.new(:resource => @resource, :value => @foobar)
|
83
|
+
Puppet::FileServing::Metadata.indirection.expects(:find).with(@foobar).returns nil
|
88
84
|
|
89
85
|
@source.expects(:fail).raises RuntimeError
|
90
86
|
|
91
87
|
lambda { @source.metadata }.should raise_error(RuntimeError)
|
92
88
|
end
|
93
|
-
|
94
|
-
it "should expire the metadata appropriately" do
|
95
|
-
expirer = stub 'expired', :dependent_data_expired? => true
|
96
|
-
|
97
|
-
metadata = stub 'metadata', :source= => nil
|
98
|
-
Puppet::FileServing::Metadata.indirection.expects(:find).with("/fee/booz").returns metadata
|
99
|
-
|
100
|
-
@source = source.new(:resource => @resource, :value => ["/fee/booz"])
|
101
|
-
@source.metadata = "foo"
|
102
|
-
|
103
|
-
@source.stubs(:expirer).returns expirer
|
104
|
-
|
105
|
-
@source.metadata.should_not == "foo"
|
106
|
-
end
|
107
89
|
end
|
108
90
|
|
109
91
|
it "should have a method for setting the desired values on the resource" do
|
@@ -113,7 +95,7 @@ describe Puppet::Type.type(:file).attrclass(:source) do
|
|
113
95
|
describe "when copying the source values" do
|
114
96
|
before do
|
115
97
|
|
116
|
-
@resource = Puppet::Type.type(:file).new :path =>
|
98
|
+
@resource = Puppet::Type.type(:file).new :path => @foobar
|
117
99
|
|
118
100
|
@source = source.new(:resource => @resource)
|
119
101
|
@metadata = stub 'metadata', :owner => 100, :group => 200, :mode => 123, :checksum => "{md5}asdfasdf", :ftype => "file"
|
data/spec/unit/type/file_spec.rb
CHANGED
@@ -37,7 +37,6 @@ describe Puppet::Type.type(:file) do
|
|
37
37
|
end
|
38
38
|
|
39
39
|
describe "#write" do
|
40
|
-
|
41
40
|
it "should propagate failures encountered when renaming the temporary file" do
|
42
41
|
File.stubs(:open)
|
43
42
|
|
@@ -92,7 +91,6 @@ describe Puppet::Type.type(:file) do
|
|
92
91
|
|
93
92
|
lambda { @file.write :NOTUSED }.should_not raise_error(Puppet::Error)
|
94
93
|
end
|
95
|
-
|
96
94
|
end
|
97
95
|
end
|
98
96
|
|
@@ -152,255 +150,204 @@ describe Puppet::Type.type(:file) do
|
|
152
150
|
end
|
153
151
|
|
154
152
|
describe "when using POSIX filenames" do
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
@catalog.add_resource file
|
165
|
-
@catalog.add_resource dir
|
166
|
-
reqs = file.autorequire
|
167
|
-
reqs[0].source.must == dir
|
168
|
-
reqs[0].target.must == file
|
169
|
-
end
|
170
|
-
|
171
|
-
it "should autorequire its nearest ancestor directory" do
|
172
|
-
file = Puppet::Type::File.new(:path => "/foo/bar/baz")
|
173
|
-
dir = Puppet::Type::File.new(:path => "/foo")
|
174
|
-
root = Puppet::Type::File.new(:path => "/")
|
175
|
-
@catalog.add_resource file
|
176
|
-
@catalog.add_resource dir
|
177
|
-
@catalog.add_resource root
|
178
|
-
reqs = file.autorequire
|
179
|
-
reqs.length.must == 1
|
180
|
-
reqs[0].source.must == dir
|
181
|
-
reqs[0].target.must == file
|
182
|
-
end
|
183
|
-
|
184
|
-
it "should not autorequire anything when there is no nearest ancestor directory" do
|
185
|
-
file = Puppet::Type::File.new(:path => "/foo/bar/baz")
|
186
|
-
@catalog.add_resource file
|
187
|
-
file.autorequire.should be_empty
|
188
|
-
end
|
189
|
-
|
190
|
-
it "should not autorequire its parent dir if its parent dir is itself" do
|
191
|
-
file = Puppet::Type::File.new(:path => "/")
|
192
|
-
@catalog.add_resource file
|
193
|
-
file.autorequire.should be_empty
|
194
|
-
end
|
195
|
-
|
196
|
-
it "should remove trailing slashes" do
|
197
|
-
file = Puppet::Type::File.new(:path => "/foo/bar/baz/")
|
198
|
-
file[:path].should == "/foo/bar/baz"
|
199
|
-
end
|
200
|
-
|
201
|
-
it "should remove double slashes" do
|
202
|
-
file = Puppet::Type::File.new(:path => "/foo/bar//baz")
|
203
|
-
file[:path].should == "/foo/bar/baz"
|
204
|
-
end
|
153
|
+
it "should autorequire its parent directory" do
|
154
|
+
file = Puppet::Type::File.new(:path => "/foo/bar")
|
155
|
+
dir = Puppet::Type::File.new(:path => "/foo")
|
156
|
+
@catalog.add_resource file
|
157
|
+
@catalog.add_resource dir
|
158
|
+
reqs = file.autorequire
|
159
|
+
reqs[0].source.must == dir
|
160
|
+
reqs[0].target.must == file
|
161
|
+
end
|
205
162
|
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
163
|
+
it "should autorequire its nearest ancestor directory" do
|
164
|
+
file = Puppet::Type::File.new(:path => "/foo/bar/baz")
|
165
|
+
dir = Puppet::Type::File.new(:path => "/foo")
|
166
|
+
root = Puppet::Type::File.new(:path => "/")
|
167
|
+
@catalog.add_resource file
|
168
|
+
@catalog.add_resource dir
|
169
|
+
@catalog.add_resource root
|
170
|
+
reqs = file.autorequire
|
171
|
+
reqs.length.must == 1
|
172
|
+
reqs[0].source.must == dir
|
173
|
+
reqs[0].target.must == file
|
174
|
+
end
|
210
175
|
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
176
|
+
it "should not autorequire anything when there is no nearest ancestor directory" do
|
177
|
+
file = Puppet::Type::File.new(:path => "/foo/bar/baz")
|
178
|
+
@catalog.add_resource file
|
179
|
+
file.autorequire.should be_empty
|
180
|
+
end
|
215
181
|
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
file[:path].should == '/tmp/xxx'
|
222
|
-
}.should_not raise_error
|
223
|
-
end
|
182
|
+
it "should not autorequire its parent dir if its parent dir is itself" do
|
183
|
+
file = Puppet::Type::File.new(:path => "/")
|
184
|
+
@catalog.add_resource file
|
185
|
+
file.autorequire.should be_empty
|
186
|
+
end
|
224
187
|
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
#
|
229
|
-
# See sections 3.2 and 4.11, which allow DomainOS to be all special like
|
230
|
-
# and still have the POSIX branding and all. --daniel 2011-01-31
|
231
|
-
it "should preserve the double-slash at the start of the path"
|
188
|
+
it "should remove trailing slashes" do
|
189
|
+
file = Puppet::Type::File.new(:path => "/foo/bar/baz/")
|
190
|
+
file[:path].should == "/foo/bar/baz"
|
232
191
|
end
|
233
192
|
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
end
|
193
|
+
it "should remove double slashes" do
|
194
|
+
file = Puppet::Type::File.new(:path => "/foo/bar//baz")
|
195
|
+
file[:path].should == "/foo/bar/baz"
|
196
|
+
end
|
239
197
|
|
240
|
-
|
241
|
-
|
242
|
-
|
198
|
+
it "should remove trailing double slashes" do
|
199
|
+
file = Puppet::Type::File.new(:path => "/foo/bar/baz//")
|
200
|
+
file[:path].should == "/foo/bar/baz"
|
243
201
|
end
|
244
|
-
end
|
245
202
|
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
Puppet.features.stubs(:microsoft_windows?).returns(true)
|
251
|
-
end
|
203
|
+
it "should leave a single slash alone" do
|
204
|
+
file = Puppet::Type::File.new(:path => "/")
|
205
|
+
file[:path].should == "/"
|
206
|
+
end
|
252
207
|
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
end
|
208
|
+
it "should accept a double-slash at the start of the path" do
|
209
|
+
expect {
|
210
|
+
file = Puppet::Type::File.new(:path => "//tmp/xxx")
|
211
|
+
# REVISIT: This should be wrong, later. See the next test.
|
212
|
+
# --daniel 2011-01-31
|
213
|
+
file[:path].should == '/tmp/xxx'
|
214
|
+
}.should_not raise_error
|
215
|
+
end
|
262
216
|
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
reqs.length.must == 1
|
272
|
-
reqs[0].source.must == dir
|
273
|
-
reqs[0].target.must == file
|
274
|
-
end
|
217
|
+
# REVISIT: This is pending, because I don't want to try and audit the
|
218
|
+
# entire codebase to make sure we get this right. POSIX treats two (and
|
219
|
+
# exactly two) '/' characters at the start of the path specially.
|
220
|
+
#
|
221
|
+
# See sections 3.2 and 4.11, which allow DomainOS to be all special like
|
222
|
+
# and still have the POSIX branding and all. --daniel 2011-01-31
|
223
|
+
it "should preserve the double-slash at the start of the path"
|
224
|
+
end
|
275
225
|
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
226
|
+
describe "when using Microsoft Windows filenames" do
|
227
|
+
it "should autorequire its parent directory" do
|
228
|
+
file = Puppet::Type::File.new(:path => "X:/foo/bar")
|
229
|
+
dir = Puppet::Type::File.new(:path => "X:/foo")
|
230
|
+
@catalog.add_resource file
|
231
|
+
@catalog.add_resource dir
|
232
|
+
reqs = file.autorequire
|
233
|
+
reqs[0].source.must == dir
|
234
|
+
reqs[0].target.must == file
|
235
|
+
end
|
281
236
|
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
237
|
+
it "should autorequire its nearest ancestor directory" do
|
238
|
+
file = Puppet::Type::File.new(:path => "X:/foo/bar/baz")
|
239
|
+
dir = Puppet::Type::File.new(:path => "X:/foo")
|
240
|
+
root = Puppet::Type::File.new(:path => "X:/")
|
241
|
+
@catalog.add_resource file
|
242
|
+
@catalog.add_resource dir
|
243
|
+
@catalog.add_resource root
|
244
|
+
reqs = file.autorequire
|
245
|
+
reqs.length.must == 1
|
246
|
+
reqs[0].source.must == dir
|
247
|
+
reqs[0].target.must == file
|
248
|
+
end
|
287
249
|
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
250
|
+
it "should not autorequire anything when there is no nearest ancestor directory" do
|
251
|
+
file = Puppet::Type::File.new(:path => "X:/foo/bar/baz")
|
252
|
+
@catalog.add_resource file
|
253
|
+
file.autorequire.should be_empty
|
254
|
+
end
|
292
255
|
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
256
|
+
it "should not autorequire its parent dir if its parent dir is itself" do
|
257
|
+
file = Puppet::Type::File.new(:path => "X:/")
|
258
|
+
@catalog.add_resource file
|
259
|
+
file.autorequire.should be_empty
|
260
|
+
end
|
297
261
|
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
262
|
+
it "should remove trailing slashes" do
|
263
|
+
file = Puppet::Type::File.new(:path => "X:/foo/bar/baz/")
|
264
|
+
file[:path].should == "X:/foo/bar/baz"
|
265
|
+
end
|
302
266
|
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
267
|
+
it "should remove double slashes" do
|
268
|
+
file = Puppet::Type::File.new(:path => "X:/foo/bar//baz")
|
269
|
+
file[:path].should == "X:/foo/bar/baz"
|
270
|
+
end
|
307
271
|
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
end
|
272
|
+
it "should remove trailing double slashes" do
|
273
|
+
file = Puppet::Type::File.new(:path => "X:/foo/bar/baz//")
|
274
|
+
file[:path].should == "X:/foo/bar/baz"
|
312
275
|
end
|
313
276
|
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
end
|
277
|
+
it "should leave a drive letter with a slash alone", :'fails_on_ruby_1.9.2' => true do
|
278
|
+
file = Puppet::Type::File.new(:path => "X:/")
|
279
|
+
file[:path].should == "X:/"
|
280
|
+
end
|
319
281
|
|
320
|
-
|
321
|
-
|
322
|
-
end
|
282
|
+
it "should not accept a drive letter without a slash", :'fails_on_ruby_1.9.2' => true do
|
283
|
+
lambda { Puppet::Type::File.new(:path => "X:") }.should raise_error(/File paths must be fully qualified/)
|
323
284
|
end
|
324
285
|
end
|
325
286
|
|
326
|
-
describe "when using UNC filenames" do
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
Puppet.features.stubs(:microsoft_windows?).returns(true)
|
331
|
-
end
|
332
|
-
|
333
|
-
it "should autorequire its parent directory" do
|
334
|
-
file = Puppet::Type::File.new(:path => "//server/foo/bar")
|
335
|
-
dir = Puppet::Type::File.new(:path => "//server/foo")
|
336
|
-
@catalog.add_resource file
|
337
|
-
@catalog.add_resource dir
|
338
|
-
reqs = file.autorequire
|
339
|
-
reqs[0].source.must == dir
|
340
|
-
reqs[0].target.must == file
|
341
|
-
end
|
342
|
-
|
343
|
-
it "should autorequire its nearest ancestor directory" do
|
344
|
-
file = Puppet::Type::File.new(:path => "//server/foo/bar/baz/qux")
|
345
|
-
dir = Puppet::Type::File.new(:path => "//server/foo/bar")
|
346
|
-
root = Puppet::Type::File.new(:path => "//server/foo")
|
347
|
-
@catalog.add_resource file
|
348
|
-
@catalog.add_resource dir
|
349
|
-
@catalog.add_resource root
|
350
|
-
reqs = file.autorequire
|
351
|
-
reqs.length.must == 1
|
352
|
-
reqs[0].source.must == dir
|
353
|
-
reqs[0].target.must == file
|
354
|
-
end
|
287
|
+
describe "when using UNC filenames", :'fails_on_ruby_1.9.2' => true do
|
288
|
+
before :each do
|
289
|
+
pending("UNC file paths not yet supported")
|
290
|
+
end
|
355
291
|
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
292
|
+
it "should autorequire its parent directory" do
|
293
|
+
file = Puppet::Type::File.new(:path => "//server/foo/bar")
|
294
|
+
dir = Puppet::Type::File.new(:path => "//server/foo")
|
295
|
+
@catalog.add_resource file
|
296
|
+
@catalog.add_resource dir
|
297
|
+
reqs = file.autorequire
|
298
|
+
reqs[0].source.must == dir
|
299
|
+
reqs[0].target.must == file
|
300
|
+
end
|
361
301
|
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
302
|
+
it "should autorequire its nearest ancestor directory" do
|
303
|
+
file = Puppet::Type::File.new(:path => "//server/foo/bar/baz/qux")
|
304
|
+
dir = Puppet::Type::File.new(:path => "//server/foo/bar")
|
305
|
+
root = Puppet::Type::File.new(:path => "//server/foo")
|
306
|
+
@catalog.add_resource file
|
307
|
+
@catalog.add_resource dir
|
308
|
+
@catalog.add_resource root
|
309
|
+
reqs = file.autorequire
|
310
|
+
reqs.length.must == 1
|
311
|
+
reqs[0].source.must == dir
|
312
|
+
reqs[0].target.must == file
|
313
|
+
end
|
368
314
|
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
315
|
+
it "should not autorequire anything when there is no nearest ancestor directory" do
|
316
|
+
file = Puppet::Type::File.new(:path => "//server/foo/bar/baz/qux")
|
317
|
+
@catalog.add_resource file
|
318
|
+
file.autorequire.should be_empty
|
319
|
+
end
|
373
320
|
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
321
|
+
it "should not autorequire its parent dir if its parent dir is itself" do
|
322
|
+
file = Puppet::Type::File.new(:path => "//server/foo")
|
323
|
+
@catalog.add_resource file
|
324
|
+
puts file.autorequire
|
325
|
+
file.autorequire.should be_empty
|
326
|
+
end
|
378
327
|
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
328
|
+
it "should remove trailing slashes" do
|
329
|
+
file = Puppet::Type::File.new(:path => "//server/foo/bar/baz/")
|
330
|
+
file[:path].should == "//server/foo/bar/baz"
|
331
|
+
end
|
383
332
|
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
333
|
+
it "should remove double slashes" do
|
334
|
+
file = Puppet::Type::File.new(:path => "//server/foo/bar//baz")
|
335
|
+
file[:path].should == "//server/foo/bar/baz"
|
336
|
+
end
|
388
337
|
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
end
|
338
|
+
it "should remove trailing double slashes" do
|
339
|
+
file = Puppet::Type::File.new(:path => "//server/foo/bar/baz//")
|
340
|
+
file[:path].should == "//server/foo/bar/baz"
|
393
341
|
end
|
394
342
|
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
end
|
343
|
+
it "should remove a trailing slash from a sharename" do
|
344
|
+
file = Puppet::Type::File.new(:path => "//server/foo/")
|
345
|
+
file[:path].should == "//server/foo"
|
346
|
+
end
|
400
347
|
|
401
|
-
|
402
|
-
|
403
|
-
|
348
|
+
it "should not modify a sharename" do
|
349
|
+
file = Puppet::Type::File.new(:path => "//server/foo")
|
350
|
+
file[:path].should == "//server/foo"
|
404
351
|
end
|
405
352
|
end
|
406
353
|
|
@@ -1238,4 +1185,10 @@ describe Puppet::Type.type(:file) do
|
|
1238
1185
|
@file[:checksum].should be :md5lite
|
1239
1186
|
end
|
1240
1187
|
end
|
1188
|
+
|
1189
|
+
describe ".instances" do
|
1190
|
+
it 'should return an empty array' do
|
1191
|
+
Puppet::Type::File.instances.should == []
|
1192
|
+
end
|
1193
|
+
end
|
1241
1194
|
end
|