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
@@ -4,28 +4,31 @@ require 'spec_helper'
|
|
4
4
|
require 'puppet/util/backups'
|
5
5
|
|
6
6
|
describe Puppet::Util::Backups do
|
7
|
+
include PuppetSpec::Files
|
8
|
+
|
7
9
|
before do
|
8
10
|
FileTest.stubs(:exists?).returns true
|
11
|
+
@nosuchfile = make_absolute('/no/such/file')
|
9
12
|
end
|
10
13
|
|
11
14
|
describe "when backing up a file" do
|
12
15
|
it "should noop if the file does not exist" do
|
13
16
|
FileTest.expects(:exists?).returns false
|
14
|
-
file = Puppet::Type.type(:file).new(:name =>
|
17
|
+
file = Puppet::Type.type(:file).new(:name => @nosuchfile)
|
15
18
|
file.expects(:bucket).never
|
16
19
|
|
17
20
|
file.perform_backup
|
18
21
|
end
|
19
22
|
|
20
23
|
it "should succeed silently if self[:backup] is false" do
|
21
|
-
file = Puppet::Type.type(:file).new(:name =>
|
24
|
+
file = Puppet::Type.type(:file).new(:name => @nosuchfile, :backup => false)
|
22
25
|
file.expects(:bucket).never
|
23
26
|
FileTest.expects(:exists?).never
|
24
27
|
file.perform_backup
|
25
28
|
end
|
26
29
|
|
27
30
|
it "a bucket should be used when provided" do
|
28
|
-
path = '/my/file'
|
31
|
+
path = make_absolute('/my/file')
|
29
32
|
|
30
33
|
File.stubs(:stat).with(path).returns(mock('stat', :ftype => 'file'))
|
31
34
|
|
@@ -39,7 +42,7 @@ describe Puppet::Util::Backups do
|
|
39
42
|
end
|
40
43
|
|
41
44
|
it "should propagate any exceptions encountered when backing up to a filebucket" do
|
42
|
-
path = '/my/file'
|
45
|
+
path = make_absolute('/my/file')
|
43
46
|
|
44
47
|
File.stubs(:stat).with(path).returns(mock('stat', :ftype => 'file'))
|
45
48
|
|
@@ -54,7 +57,7 @@ describe Puppet::Util::Backups do
|
|
54
57
|
|
55
58
|
describe "and no filebucket is configured" do
|
56
59
|
it "should remove any local backup if one exists" do
|
57
|
-
path = '/my/file'
|
60
|
+
path = make_absolute('/my/file')
|
58
61
|
FileTest.stubs(:exists?).returns true
|
59
62
|
|
60
63
|
backup = path + ".foo"
|
@@ -69,7 +72,7 @@ describe Puppet::Util::Backups do
|
|
69
72
|
end
|
70
73
|
|
71
74
|
it "should fail when the old backup can't be removed" do
|
72
|
-
path = '/my/file'
|
75
|
+
path = make_absolute('/my/file')
|
73
76
|
FileTest.stubs(:exists?).returns true
|
74
77
|
|
75
78
|
backup = path + ".foo"
|
@@ -84,7 +87,7 @@ describe Puppet::Util::Backups do
|
|
84
87
|
end
|
85
88
|
|
86
89
|
it "should not try to remove backups that don't exist" do
|
87
|
-
path = '/my/file'
|
90
|
+
path = make_absolute('/my/file')
|
88
91
|
FileTest.stubs(:exists?).returns true
|
89
92
|
|
90
93
|
backup = path + ".foo"
|
@@ -99,7 +102,7 @@ describe Puppet::Util::Backups do
|
|
99
102
|
end
|
100
103
|
|
101
104
|
it "a copy should be created in the local directory" do
|
102
|
-
path = '/my/file'
|
105
|
+
path = make_absolute('/my/file')
|
103
106
|
FileTest.stubs(:exists?).with(path).returns true
|
104
107
|
|
105
108
|
FileUtils.expects(:cp_r).with(path, path + ".foo", :preserve => true)
|
@@ -109,7 +112,7 @@ describe Puppet::Util::Backups do
|
|
109
112
|
end
|
110
113
|
|
111
114
|
it "should propagate exceptions if no backup can be created" do
|
112
|
-
path = '/my/file'
|
115
|
+
path = make_absolute('/my/file')
|
113
116
|
FileTest.stubs(:exists?).with(path).returns true
|
114
117
|
|
115
118
|
FileUtils.expects(:cp_r).raises ArgumentError
|
@@ -122,13 +125,13 @@ describe Puppet::Util::Backups do
|
|
122
125
|
|
123
126
|
describe "when backing up a directory" do
|
124
127
|
it "a bucket should work when provided" do
|
125
|
-
path = '/my/dir'
|
128
|
+
path = make_absolute('/my/dir')
|
126
129
|
|
127
130
|
File.stubs(:file?).returns true
|
128
|
-
Find.expects(:find).with(path).yields("/my/dir/file")
|
131
|
+
Find.expects(:find).with(path).yields(make_absolute("/my/dir/file"))
|
129
132
|
|
130
133
|
bucket = stub('bucket', :name => "eh")
|
131
|
-
bucket.expects(:backup).with("/my/dir/file").returns true
|
134
|
+
bucket.expects(:backup).with(make_absolute("/my/dir/file")).returns true
|
132
135
|
|
133
136
|
file = Puppet::Type.type(:file).new(:name => path, :backup => 'foo')
|
134
137
|
file.stubs(:bucket).returns bucket
|
@@ -139,7 +142,7 @@ describe Puppet::Util::Backups do
|
|
139
142
|
end
|
140
143
|
|
141
144
|
it "should do nothing when recursing" do
|
142
|
-
path = '/my/dir'
|
145
|
+
path = make_absolute('/my/dir')
|
143
146
|
|
144
147
|
bucket = stub('bucket', :name => "eh")
|
145
148
|
bucket.expects(:backup).never
|
@@ -3,182 +3,105 @@ require 'spec_helper'
|
|
3
3
|
|
4
4
|
require 'puppet/util/cacher'
|
5
5
|
|
6
|
-
class ExpirerTest
|
7
|
-
include Puppet::Util::Cacher::Expirer
|
8
|
-
end
|
9
|
-
|
10
6
|
class CacheTest
|
11
|
-
@@
|
12
|
-
|
13
|
-
include Puppet::Util::Cacher
|
14
|
-
cached_attr(:instance_cache) { Time.now }
|
15
|
-
end
|
7
|
+
@@count = 0
|
16
8
|
|
17
|
-
|
18
|
-
|
19
|
-
@expirer = ExpirerTest.new
|
9
|
+
def self.count
|
10
|
+
@@count
|
20
11
|
end
|
21
12
|
|
22
|
-
|
23
|
-
@expirer.should respond_to(:dependent_data_expired?)
|
24
|
-
end
|
25
|
-
|
26
|
-
it "should be able to expire all values" do
|
27
|
-
@expirer.should respond_to(:expire)
|
28
|
-
end
|
29
|
-
|
30
|
-
it "should consider any value to be valid if it has never been expired" do
|
31
|
-
@expirer.should_not be_dependent_data_expired(Time.now)
|
32
|
-
end
|
13
|
+
include Puppet::Util::Cacher
|
33
14
|
|
34
|
-
|
35
|
-
|
36
|
-
|
15
|
+
cached_attr(:instance_cache, 10) do
|
16
|
+
@@count += 1
|
17
|
+
{:number => @@count}
|
37
18
|
end
|
38
19
|
end
|
39
20
|
|
40
21
|
describe Puppet::Util::Cacher do
|
41
|
-
|
42
|
-
|
22
|
+
before :each do
|
23
|
+
CacheTest.set_attr_ttl(:instance_cache, 10)
|
24
|
+
@object = CacheTest.new
|
43
25
|
end
|
44
26
|
|
45
|
-
it "should
|
46
|
-
|
27
|
+
it "should return a value calculated from the provided block" do
|
28
|
+
@object.instance_cache.should == {:number => CacheTest.count}
|
47
29
|
end
|
48
30
|
|
49
|
-
it "should
|
50
|
-
|
31
|
+
it "should return the cached value from the getter every time if the value is not expired" do
|
32
|
+
@object.instance_cache.should equal(@object.instance_cache)
|
51
33
|
end
|
52
34
|
|
53
|
-
|
54
|
-
|
55
|
-
@expirer = ExpirerTest.new
|
56
|
-
@object = CacheTest.new
|
35
|
+
it "should regenerate and return a new value using the provided block if the value has expired" do
|
36
|
+
initial = @object.instance_cache
|
57
37
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
it "should create a getter for the cached attribute" do
|
62
|
-
@object.should respond_to(:instance_cache)
|
63
|
-
end
|
64
|
-
|
65
|
-
it "should return a value calculated from the provided block" do
|
66
|
-
time = Time.now
|
67
|
-
Time.stubs(:now).returns time
|
68
|
-
@object.instance_cache.should equal(time)
|
69
|
-
end
|
38
|
+
# Ensure the value is expired immediately
|
39
|
+
CacheTest.set_attr_ttl(:instance_cache, -10)
|
40
|
+
@object.send(:set_expiration, :instance_cache)
|
70
41
|
|
71
|
-
|
72
|
-
|
73
|
-
end
|
74
|
-
|
75
|
-
it "should regenerate and return a new value using the provided block if the value has been expired" do
|
76
|
-
value = @object.instance_cache
|
77
|
-
@expirer.expire
|
78
|
-
@object.instance_cache.should_not equal(value)
|
79
|
-
end
|
42
|
+
@object.instance_cache.should_not equal(initial)
|
43
|
+
end
|
80
44
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
45
|
+
it "should be able to cache false values" do
|
46
|
+
@object.expects(:init_instance_cache).once.returns false
|
47
|
+
@object.instance_cache.should be_false
|
48
|
+
@object.instance_cache.should be_false
|
49
|
+
end
|
85
50
|
|
86
|
-
|
87
|
-
|
88
|
-
class << cacher
|
89
|
-
def expirer
|
90
|
-
nil
|
91
|
-
end
|
92
|
-
end
|
93
|
-
lambda { cacher.expire }.should_not raise_error
|
94
|
-
end
|
51
|
+
it "should cache values again after expiration" do
|
52
|
+
initial = @object.instance_cache
|
95
53
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
@object.instance_cache.should be_false
|
100
|
-
end
|
54
|
+
# Ensure the value is expired immediately
|
55
|
+
CacheTest.set_attr_ttl(:instance_cache, -10)
|
56
|
+
@object.send(:set_expiration, :instance_cache)
|
101
57
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
@object.instance_cache.should equal(@object.instance_cache)
|
106
|
-
end
|
58
|
+
# Reset ttl so this new value doesn't get expired
|
59
|
+
CacheTest.set_attr_ttl(:instance_cache, 10)
|
60
|
+
after_expiration = @object.instance_cache
|
107
61
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
end
|
62
|
+
after_expiration.should_not == initial
|
63
|
+
@object.instance_cache.should == after_expiration
|
64
|
+
end
|
112
65
|
|
113
|
-
|
114
|
-
|
115
|
-
end
|
66
|
+
it "should allow writing of the attribute" do
|
67
|
+
initial = @object.instance_cache
|
116
68
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
@object.instance_cache.should_not == "foo"
|
121
|
-
end
|
69
|
+
@object.instance_cache = "another value"
|
70
|
+
@object.instance_cache.should == "another value"
|
71
|
+
end
|
122
72
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
73
|
+
it "should update the expiration when the cached attribute is set manually" do
|
74
|
+
# Freeze time
|
75
|
+
now = Time.now
|
76
|
+
Time.stubs(:now).returns now
|
127
77
|
|
128
|
-
|
78
|
+
@object.instance_cache
|
129
79
|
|
130
|
-
|
131
|
-
|
80
|
+
# Set expiration to something far in the future
|
81
|
+
CacheTest.set_attr_ttl(:instance_cache, 60)
|
82
|
+
@object.send(:set_expiration, :instance_cache)
|
132
83
|
|
133
|
-
|
134
|
-
klass = Class.new do
|
135
|
-
include Puppet::Util::Cacher
|
136
|
-
end
|
84
|
+
CacheTest.set_attr_ttl(:instance_cache, 10)
|
137
85
|
|
138
|
-
|
86
|
+
@object.instance_cache = "foo"
|
87
|
+
@object.instance_variable_get(:@attr_expirations)[:instance_cache].should == now + 10
|
88
|
+
end
|
139
89
|
|
140
|
-
|
90
|
+
it "should allow specification of a ttl as a string" do
|
91
|
+
klass = Class.new do
|
92
|
+
include Puppet::Util::Cacher
|
141
93
|
end
|
142
94
|
|
143
|
-
|
144
|
-
klass = Class.new do
|
145
|
-
include Puppet::Util::Cacher
|
146
|
-
end
|
147
|
-
|
148
|
-
lambda { klass.cached_attr(:myattr, :ttl => "yep") { Time.now } }.should raise_error(ArgumentError)
|
149
|
-
end
|
95
|
+
klass.cached_attr(:myattr, "5") { 10 }
|
150
96
|
|
151
|
-
|
152
|
-
|
153
|
-
extend Puppet::Util::Cacher
|
154
|
-
end
|
97
|
+
klass.attr_ttl(:myattr).should == 5
|
98
|
+
end
|
155
99
|
|
156
|
-
|
157
|
-
|
100
|
+
it "should fail helpfully if the ttl cannot be converted to an integer" do
|
101
|
+
klass = Class.new do
|
102
|
+
include Puppet::Util::Cacher
|
158
103
|
end
|
159
104
|
|
160
|
-
|
161
|
-
klass = Class.new do
|
162
|
-
def self.to_s
|
163
|
-
"CacheTestClass"
|
164
|
-
end
|
165
|
-
include Puppet::Util::Cacher
|
166
|
-
attr_accessor :value
|
167
|
-
end
|
168
|
-
|
169
|
-
klass.cached_attr(:myattr, :ttl => 5) { self.value += 1; self.value }
|
170
|
-
|
171
|
-
now = Time.now
|
172
|
-
later = Time.now + 15
|
173
|
-
|
174
|
-
instance = klass.new
|
175
|
-
instance.value = 0
|
176
|
-
instance.myattr.should == 1
|
177
|
-
|
178
|
-
Time.expects(:now).returns later
|
179
|
-
|
180
|
-
# This call should get the new Time value, which should expire the old value
|
181
|
-
instance.myattr.should == 2
|
182
|
-
end
|
105
|
+
lambda { klass.cached_attr(:myattr, "yep") { 10 } }.should raise_error(ArgumentError)
|
183
106
|
end
|
184
107
|
end
|
@@ -16,7 +16,7 @@ describe Puppet::Util::ExecutionStub do
|
|
16
16
|
Puppet::Util::ExecutionStub.current_value.should == nil
|
17
17
|
end
|
18
18
|
|
19
|
-
it "should restore normal execution after 'reset' is called" do
|
19
|
+
it "should restore normal execution after 'reset' is called", :fails_on_windows => true do
|
20
20
|
true_command = Puppet::Util.which('true') # Note: "true" exists at different paths in different OSes
|
21
21
|
stub_call_count = 0
|
22
22
|
Puppet::Util::ExecutionStub.set do |command, options|
|
data/spec/unit/util/log_spec.rb
CHANGED
@@ -4,6 +4,8 @@ require 'spec_helper'
|
|
4
4
|
require 'puppet/util/log'
|
5
5
|
|
6
6
|
describe Puppet::Util::Log do
|
7
|
+
include PuppetSpec::Files
|
8
|
+
|
7
9
|
it "should write a given message to the specified destination" do
|
8
10
|
arraydest = []
|
9
11
|
Puppet::Util::Log.newdestination(Puppet::Test::LogCollector.new(arraydest))
|
@@ -167,7 +169,7 @@ describe Puppet::Util::Log do
|
|
167
169
|
|
168
170
|
describe "when setting the source as a RAL object" do
|
169
171
|
it "should tag itself with any tags the source has" do
|
170
|
-
source = Puppet::Type.type(:file).new :path => "/foo/bar"
|
172
|
+
source = Puppet::Type.type(:file).new :path => make_absolute("/foo/bar")
|
171
173
|
log = Puppet::Util::Log.new(:level => "notice", :message => :foo, :source => source)
|
172
174
|
source.tags.each do |tag|
|
173
175
|
log.tags.should be_include(tag)
|
@@ -188,7 +190,7 @@ describe Puppet::Util::Log do
|
|
188
190
|
end
|
189
191
|
|
190
192
|
it "should copy over any file and line information" do
|
191
|
-
source = Puppet::Type.type(:file).new :path => "/foo/bar"
|
193
|
+
source = Puppet::Type.type(:file).new :path => make_absolute("/foo/bar")
|
192
194
|
source.file = "/my/file"
|
193
195
|
source.line = 50
|
194
196
|
log = Puppet::Util::Log.new(:level => "notice", :message => :foo, :source => source)
|
@@ -46,7 +46,7 @@ describe Puppet::Util::Logging do
|
|
46
46
|
@logger.notice "foo"
|
47
47
|
end
|
48
48
|
|
49
|
-
it "should use the path of any provided resource type" do
|
49
|
+
it "should use the path of any provided resource type", :fails_on_windows => true do
|
50
50
|
resource = Puppet::Type.type(:mount).new :name => "foo"
|
51
51
|
|
52
52
|
resource.expects(:path).returns "/path/to/mount".to_sym
|
@@ -56,7 +56,7 @@ describe Puppet::Util::Logging do
|
|
56
56
|
resource.notice "foo"
|
57
57
|
end
|
58
58
|
|
59
|
-
it "should use the path of any provided resource parameter" do
|
59
|
+
it "should use the path of any provided resource parameter", :fails_on_windows => true do
|
60
60
|
resource = Puppet::Type.type(:mount).new :name => "foo"
|
61
61
|
|
62
62
|
param = resource.parameter(:name)
|
@@ -137,7 +137,8 @@ eos
|
|
137
137
|
"Fa 0/1" => "FastEthernet0/1",
|
138
138
|
"Fa0/1" => "FastEthernet0/1",
|
139
139
|
"FastEth 0/1" => "FastEthernet0/1",
|
140
|
-
"Gi1" => "
|
140
|
+
"Gi1" => "GigabitEthernet1",
|
141
|
+
"Te2" => "TenGigabitEthernet2",
|
141
142
|
"Di9" => "Dialer9",
|
142
143
|
"Ethernet 0/0/1" => "Ethernet0/0/1",
|
143
144
|
"E0" => "Ethernet0",
|
@@ -31,7 +31,9 @@ eos
|
|
31
31
|
"Switch uptime is 1 year, 12 weeks, 6 days, 22 hours, 32 minutes" => { :hostname => "Switch", :uptime => "1 year, 12 weeks, 6 days, 22 hours, 32 minutes", :uptime_seconds => 39393120, :uptime_days => 455 },
|
32
32
|
"c2950 uptime is 3 weeks, 1 day, 23 hours, 36 minutes" => { :hostname => "c2950", :uptime => "3 weeks, 1 day, 23 hours, 36 minutes", :uptime_days => 22, :uptime_seconds => 1985760},
|
33
33
|
"router uptime is 5 weeks, 1 day, 3 hours, 30 minutes" => { :hostname => "router", :uptime => "5 weeks, 1 day, 3 hours, 30 minutes", :uptime_days => 36, :uptime_seconds => 3123000 },
|
34
|
-
"c2950 uptime is 1 minute" => { :hostname => "c2950", :uptime => "1 minute", :uptime_days => 0, :uptime_seconds => 60 }
|
34
|
+
"c2950 uptime is 1 minute" => { :hostname => "c2950", :uptime => "1 minute", :uptime_days => 0, :uptime_seconds => 60 },
|
35
|
+
"c2950 uptime is 20 weeks, 6 minutes" => { :hostname => "c2950", :uptime=>"20 weeks, 6 minutes", :uptime_seconds=>12096360, :uptime_days=>140 },
|
36
|
+
"c2950 uptime is 2 years, 20 weeks, 6 minutes" => { :hostname => "c2950", :uptime=>"2 years, 20 weeks, 6 minutes", :uptime_seconds=>75168360, :uptime_days=>870 }
|
35
37
|
}.each do |ver, expected|
|
36
38
|
it "should parse show ver output for device uptime facts" do
|
37
39
|
@transport.stubs(:command).with("sh ver").returns(<<eos)
|
@@ -4,9 +4,11 @@ require 'spec_helper'
|
|
4
4
|
require 'puppet/util/network_device/config'
|
5
5
|
|
6
6
|
describe Puppet::Util::NetworkDevice::Config do
|
7
|
+
include PuppetSpec::Files
|
8
|
+
|
7
9
|
before(:each) do
|
8
|
-
Puppet[:deviceconfig] = "/dummy"
|
9
|
-
FileTest.stubs(:exists?).with("/dummy").returns(true)
|
10
|
+
Puppet[:deviceconfig] = make_absolute("/dummy")
|
11
|
+
FileTest.stubs(:exists?).with(make_absolute("/dummy")).returns(true)
|
10
12
|
end
|
11
13
|
|
12
14
|
describe "when initializing" do
|
@@ -15,7 +17,7 @@ describe Puppet::Util::NetworkDevice::Config do
|
|
15
17
|
end
|
16
18
|
|
17
19
|
it "should use the deviceconfig setting as pathname" do
|
18
|
-
Puppet.expects(:[]).with(:deviceconfig).returns("/dummy")
|
20
|
+
Puppet.expects(:[]).with(:deviceconfig).returns(make_absolute("/dummy"))
|
19
21
|
|
20
22
|
Puppet::Util::NetworkDevice::Config.new
|
21
23
|
end
|
@@ -8,6 +8,8 @@ require 'rdoc/options'
|
|
8
8
|
require 'rdoc/rdoc'
|
9
9
|
|
10
10
|
describe RDoc::Parser, :'fails_on_ruby_1.9.2' => true do
|
11
|
+
include PuppetSpec::Files
|
12
|
+
|
11
13
|
before :each do
|
12
14
|
File.stubs(:stat).with("init.pp")
|
13
15
|
@top_level = stub_everything 'toplevel', :file_relative_name => "init.pp"
|
@@ -21,7 +23,7 @@ describe RDoc::Parser, :'fails_on_ruby_1.9.2' => true do
|
|
21
23
|
Puppet::Parser::Parser.stubs(:new).returns(parser)
|
22
24
|
parser.expects(:parse).returns(Puppet::Parser::AST::Hostclass.new('')).at_least_once
|
23
25
|
parser.expects(:file=).with("module/manifests/init.pp")
|
24
|
-
parser.expects(:file=).with("/dev/null/manifests/site.pp")
|
26
|
+
parser.expects(:file=).with(make_absolute("/dev/null/manifests/site.pp"))
|
25
27
|
|
26
28
|
@parser.scan
|
27
29
|
end
|
@@ -147,6 +149,10 @@ describe RDoc::Parser, :'fails_on_ruby_1.9.2' => true do
|
|
147
149
|
File.stubs(:identical?).returns(false)
|
148
150
|
@parser.split_module("/path/to/manifests/init.pp").should == RDoc::Parser::SITE
|
149
151
|
end
|
152
|
+
|
153
|
+
it "should handle windows paths with drive letters", :if => Puppet.features.microsoft_windows? do
|
154
|
+
@parser.split_module("C:/temp/init.pp").should == RDoc::Parser::SITE
|
155
|
+
end
|
150
156
|
end
|
151
157
|
|
152
158
|
describe "when parsing AST elements" do
|
@@ -8,7 +8,9 @@ describe Puppet::Util::RunMode do
|
|
8
8
|
|
9
9
|
it "should have confdir /etc/puppet when run as root" do
|
10
10
|
Puppet.features.stubs(:root?).returns(true)
|
11
|
-
|
11
|
+
etcdir = Puppet.features.microsoft_windows? ? File.join(Dir::COMMON_APPDATA, "PuppetLabs", "puppet", "etc") : '/etc/puppet'
|
12
|
+
# REMIND: issue with windows backslashes
|
13
|
+
@run_mode.conf_dir.should == File.expand_path(etcdir)
|
12
14
|
end
|
13
15
|
|
14
16
|
it "should have confdir ~/.puppet when run as non-root" do
|
@@ -19,7 +21,9 @@ describe Puppet::Util::RunMode do
|
|
19
21
|
|
20
22
|
it "should have vardir /var/lib/puppet when run as root" do
|
21
23
|
Puppet.features.stubs(:root?).returns(true)
|
22
|
-
|
24
|
+
vardir = Puppet.features.microsoft_windows? ? File.join(Dir::COMMON_APPDATA, "PuppetLabs", "puppet", "var") : '/var/lib/puppet'
|
25
|
+
# REMIND: issue with windows backslashes
|
26
|
+
@run_mode.var_dir.should == File.expand_path(vardir)
|
23
27
|
end
|
24
28
|
|
25
29
|
it "should have vardir ~/.puppet/var when run as non-root" do
|
@@ -7,8 +7,10 @@ require 'puppet/util/settings/file_setting'
|
|
7
7
|
describe Puppet::Util::Settings::FileSetting do
|
8
8
|
FileSetting = Puppet::Util::Settings::FileSetting
|
9
9
|
|
10
|
+
include PuppetSpec::Files
|
11
|
+
|
10
12
|
before do
|
11
|
-
@basepath =
|
13
|
+
@basepath = make_absolute("/somepath")
|
12
14
|
end
|
13
15
|
|
14
16
|
describe "when determining whether the service user should be used" do
|
@@ -165,7 +167,10 @@ describe Puppet::Util::Settings::FileSetting do
|
|
165
167
|
|
166
168
|
it "should fully qualified returned files if necessary (#795)" do
|
167
169
|
@settings.stubs(:value).with(:mydir).returns "myfile"
|
168
|
-
|
170
|
+
path = File.join(Dir.getwd, "myfile")
|
171
|
+
# Dir.getwd can return windows paths with backslashes, so we normalize them using expand_path
|
172
|
+
path = File.expand_path(path) if Puppet.features.microsoft_windows?
|
173
|
+
@file.to_resource.title.should == path
|
169
174
|
end
|
170
175
|
|
171
176
|
it "should set the mode on the file if a mode is provided" do
|
@@ -184,6 +189,8 @@ describe Puppet::Util::Settings::FileSetting do
|
|
184
189
|
|
185
190
|
it "should set the owner if running as root and the owner is provided" do
|
186
191
|
Puppet.features.expects(:root?).returns true
|
192
|
+
Puppet.features.stubs(:microsoft_windows?).returns false
|
193
|
+
|
187
194
|
@file.stubs(:owner).returns "foo"
|
188
195
|
@file.to_resource[:owner].should == "foo"
|
189
196
|
end
|
@@ -198,6 +205,8 @@ describe Puppet::Util::Settings::FileSetting do
|
|
198
205
|
|
199
206
|
it "should set the group if running as root and the group is provided" do
|
200
207
|
Puppet.features.expects(:root?).returns true
|
208
|
+
Puppet.features.stubs(:microsoft_windows?).returns false
|
209
|
+
|
201
210
|
@file.stubs(:group).returns "foo"
|
202
211
|
@file.to_resource[:group].should == "foo"
|
203
212
|
end
|
@@ -213,16 +222,34 @@ describe Puppet::Util::Settings::FileSetting do
|
|
213
222
|
|
214
223
|
it "should not set owner if not running as root" do
|
215
224
|
Puppet.features.expects(:root?).returns false
|
225
|
+
Puppet.features.stubs(:microsoft_windows?).returns false
|
216
226
|
@file.stubs(:owner).returns "foo"
|
217
227
|
@file.to_resource[:owner].should be_nil
|
218
228
|
end
|
219
229
|
|
220
230
|
it "should not set group if not running as root" do
|
221
231
|
Puppet.features.expects(:root?).returns false
|
232
|
+
Puppet.features.stubs(:microsoft_windows?).returns false
|
222
233
|
@file.stubs(:group).returns "foo"
|
223
234
|
@file.to_resource[:group].should be_nil
|
224
235
|
end
|
225
236
|
|
237
|
+
describe "on Microsoft Windows systems" do
|
238
|
+
before :each do
|
239
|
+
Puppet.features.stubs(:microsoft_windows?).returns true
|
240
|
+
end
|
241
|
+
|
242
|
+
it "should not set owner" do
|
243
|
+
@file.stubs(:owner).returns "foo"
|
244
|
+
@file.to_resource[:owner].should be_nil
|
245
|
+
end
|
246
|
+
|
247
|
+
it "should not set group" do
|
248
|
+
@file.stubs(:group).returns "foo"
|
249
|
+
@file.to_resource[:group].should be_nil
|
250
|
+
end
|
251
|
+
end
|
252
|
+
|
226
253
|
it "should set :ensure to the file type" do
|
227
254
|
@file.expects(:type).returns :directory
|
228
255
|
@file.to_resource[:ensure].should == :directory
|