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,42 +4,31 @@ require 'spec_helper'
|
|
4
4
|
require 'puppet/file_serving/configuration'
|
5
5
|
|
6
6
|
describe Puppet::FileServing::Configuration do
|
7
|
-
|
8
|
-
proc { Puppet::FileServing::Configuration.new }.should raise_error
|
9
|
-
end
|
10
|
-
|
11
|
-
it "should return the same configuration each time :create is called" do
|
12
|
-
Puppet::FileServing::Configuration.create.should equal(Puppet::FileServing::Configuration.create)
|
13
|
-
end
|
14
|
-
|
15
|
-
it "should have a method for removing the current configuration instance" do
|
16
|
-
old = Puppet::FileServing::Configuration.create
|
17
|
-
Puppet::Util::Cacher.expire
|
18
|
-
Puppet::FileServing::Configuration.create.should_not equal(old)
|
19
|
-
end
|
20
|
-
|
21
|
-
after do
|
22
|
-
Puppet::Util::Cacher.expire
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
describe Puppet::FileServing::Configuration do
|
7
|
+
include PuppetSpec::Files
|
27
8
|
|
28
9
|
before :each do
|
29
|
-
@path = "/path/to/configuration/file.conf"
|
10
|
+
@path = make_absolute("/path/to/configuration/file.conf")
|
30
11
|
Puppet.settings.stubs(:value).with(:trace).returns(false)
|
31
12
|
Puppet.settings.stubs(:value).with(:fileserverconfig).returns(@path)
|
32
13
|
end
|
33
14
|
|
34
15
|
after :each do
|
35
|
-
Puppet::
|
16
|
+
Puppet::FileServing::Configuration.instance_variable_set(:@configuration, nil)
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should make :new a private method" do
|
20
|
+
proc { Puppet::FileServing::Configuration.new }.should raise_error
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should return the same configuration each time 'configuration' is called" do
|
24
|
+
Puppet::FileServing::Configuration.configuration.should equal(Puppet::FileServing::Configuration.configuration)
|
36
25
|
end
|
37
26
|
|
38
27
|
describe "when initializing" do
|
39
28
|
|
40
29
|
it "should work without a configuration file" do
|
41
30
|
FileTest.stubs(:exists?).with(@path).returns(false)
|
42
|
-
proc { Puppet::FileServing::Configuration.
|
31
|
+
proc { Puppet::FileServing::Configuration.configuration }.should_not raise_error
|
43
32
|
end
|
44
33
|
|
45
34
|
it "should parse the configuration file if present" do
|
@@ -47,11 +36,11 @@ describe Puppet::FileServing::Configuration do
|
|
47
36
|
@parser = mock 'parser'
|
48
37
|
@parser.expects(:parse).returns({})
|
49
38
|
Puppet::FileServing::Configuration::Parser.stubs(:new).returns(@parser)
|
50
|
-
Puppet::FileServing::Configuration.
|
39
|
+
Puppet::FileServing::Configuration.configuration
|
51
40
|
end
|
52
41
|
|
53
42
|
it "should determine the path to the configuration file from the Puppet settings" do
|
54
|
-
Puppet::FileServing::Configuration.
|
43
|
+
Puppet::FileServing::Configuration.configuration
|
55
44
|
end
|
56
45
|
end
|
57
46
|
|
@@ -65,18 +54,18 @@ describe Puppet::FileServing::Configuration do
|
|
65
54
|
|
66
55
|
it "should set the mount list to the results of parsing" do
|
67
56
|
@parser.expects(:parse).returns("one" => mock("mount"))
|
68
|
-
config = Puppet::FileServing::Configuration.
|
57
|
+
config = Puppet::FileServing::Configuration.configuration
|
69
58
|
config.mounted?("one").should be_true
|
70
59
|
end
|
71
60
|
|
72
61
|
it "should not raise exceptions" do
|
73
62
|
@parser.expects(:parse).raises(ArgumentError)
|
74
|
-
proc { Puppet::FileServing::Configuration.
|
63
|
+
proc { Puppet::FileServing::Configuration.configuration }.should_not raise_error
|
75
64
|
end
|
76
65
|
|
77
66
|
it "should replace the existing mount list with the results of reparsing" do
|
78
67
|
@parser.expects(:parse).returns("one" => mock("mount"))
|
79
|
-
config = Puppet::FileServing::Configuration.
|
68
|
+
config = Puppet::FileServing::Configuration.configuration
|
80
69
|
config.mounted?("one").should be_true
|
81
70
|
# Now parse again
|
82
71
|
@parser.expects(:parse).returns("two" => mock('other'))
|
@@ -88,7 +77,7 @@ describe Puppet::FileServing::Configuration do
|
|
88
77
|
it "should not replace the mount list until the file is entirely parsed successfully" do
|
89
78
|
@parser.expects(:parse).returns("one" => mock("mount"))
|
90
79
|
@parser.expects(:parse).raises(ArgumentError)
|
91
|
-
config = Puppet::FileServing::Configuration.
|
80
|
+
config = Puppet::FileServing::Configuration.configuration
|
92
81
|
# Now parse again, so the exception gets thrown
|
93
82
|
config.send(:readconfig, false)
|
94
83
|
config.mounted?("one").should be_true
|
@@ -96,7 +85,7 @@ describe Puppet::FileServing::Configuration do
|
|
96
85
|
|
97
86
|
it "should add modules and plugins mounts even if the file does not exist" do
|
98
87
|
FileTest.expects(:exists?).returns false # the file doesn't exist
|
99
|
-
config = Puppet::FileServing::Configuration.
|
88
|
+
config = Puppet::FileServing::Configuration.configuration
|
100
89
|
config.mounted?("modules").should be_true
|
101
90
|
config.mounted?("plugins").should be_true
|
102
91
|
end
|
@@ -111,7 +100,7 @@ describe Puppet::FileServing::Configuration do
|
|
111
100
|
Puppet::FileServing::Mount::Plugins.stubs(:new).returns(plugins)
|
112
101
|
plugins.expects(:allow).with('*')
|
113
102
|
|
114
|
-
Puppet::FileServing::Configuration.
|
103
|
+
Puppet::FileServing::Configuration.configuration
|
115
104
|
end
|
116
105
|
|
117
106
|
it "should not allow access from all to modules and plugins if the fileserver.conf provided some rules" do
|
@@ -125,13 +114,13 @@ describe Puppet::FileServing::Configuration do
|
|
125
114
|
Puppet::FileServing::Mount::Plugins.stubs(:new).returns(plugins)
|
126
115
|
plugins.expects(:allow).with('*').never
|
127
116
|
|
128
|
-
Puppet::FileServing::Configuration.
|
117
|
+
Puppet::FileServing::Configuration.configuration
|
129
118
|
end
|
130
119
|
|
131
120
|
it "should add modules and plugins mounts even if they are not returned by the parser" do
|
132
121
|
@parser.expects(:parse).returns("one" => mock("mount"))
|
133
122
|
FileTest.expects(:exists?).returns true # the file doesn't exist
|
134
|
-
config = Puppet::FileServing::Configuration.
|
123
|
+
config = Puppet::FileServing::Configuration.configuration
|
135
124
|
config.mounted?("modules").should be_true
|
136
125
|
config.mounted?("plugins").should be_true
|
137
126
|
end
|
@@ -139,13 +128,13 @@ describe Puppet::FileServing::Configuration do
|
|
139
128
|
|
140
129
|
describe "when finding the specified mount" do
|
141
130
|
it "should choose the named mount if one exists" do
|
142
|
-
config = Puppet::FileServing::Configuration.
|
131
|
+
config = Puppet::FileServing::Configuration.configuration
|
143
132
|
config.expects(:mounts).returns("one" => "foo")
|
144
133
|
config.find_mount("one", mock('env')).should == "foo"
|
145
134
|
end
|
146
135
|
|
147
136
|
it "should use the provided environment to find a matching module if the named module cannot be found" do
|
148
|
-
config = Puppet::FileServing::Configuration.
|
137
|
+
config = Puppet::FileServing::Configuration.configuration
|
149
138
|
|
150
139
|
mod = mock 'module'
|
151
140
|
env = mock 'environment'
|
@@ -158,7 +147,7 @@ describe Puppet::FileServing::Configuration do
|
|
158
147
|
end
|
159
148
|
|
160
149
|
it "should return nil if there is no such named mount and no module with the same name exists" do
|
161
|
-
config = Puppet::FileServing::Configuration.
|
150
|
+
config = Puppet::FileServing::Configuration.configuration
|
162
151
|
|
163
152
|
env = mock 'environment'
|
164
153
|
env.expects(:module).with("foo").returns nil
|
@@ -171,7 +160,7 @@ describe Puppet::FileServing::Configuration do
|
|
171
160
|
|
172
161
|
describe "when finding the mount name and relative path in a request key" do
|
173
162
|
before do
|
174
|
-
@config = Puppet::FileServing::Configuration.
|
163
|
+
@config = Puppet::FileServing::Configuration.configuration
|
175
164
|
@config.stubs(:find_mount)
|
176
165
|
|
177
166
|
@request = stub 'request', :key => "foo/bar/baz", :options => {}, :node => nil, :environment => mock("env")
|
@@ -4,6 +4,12 @@ require 'spec_helper'
|
|
4
4
|
require 'puppet/file_serving/fileset'
|
5
5
|
|
6
6
|
describe Puppet::FileServing::Fileset, " when initializing" do
|
7
|
+
include PuppetSpec::Files
|
8
|
+
|
9
|
+
before :each do
|
10
|
+
@somefile = make_absolute("/some/file")
|
11
|
+
end
|
12
|
+
|
7
13
|
it "should require a path" do
|
8
14
|
proc { Puppet::FileServing::Fileset.new }.should raise_error(ArgumentError)
|
9
15
|
end
|
@@ -13,83 +19,82 @@ describe Puppet::FileServing::Fileset, " when initializing" do
|
|
13
19
|
end
|
14
20
|
|
15
21
|
it "should not fail if the path is fully qualified, with a trailing separator" do
|
16
|
-
|
17
|
-
|
18
|
-
File.stubs(:lstat).with(path).returns stub('stat')
|
22
|
+
path_with_separator = "#{@somefile}#{File::SEPARATOR}"
|
23
|
+
File.stubs(:lstat).with(@somefile).returns stub('stat')
|
19
24
|
fileset = Puppet::FileServing::Fileset.new(path_with_separator)
|
20
|
-
fileset.path.should ==
|
25
|
+
fileset.path.should == @somefile
|
21
26
|
end
|
22
27
|
|
23
28
|
it "should not fail if the path is just the file separator" do
|
24
|
-
path = File::SEPARATOR
|
29
|
+
path = make_absolute(File::SEPARATOR)
|
25
30
|
File.stubs(:lstat).with(path).returns stub('stat')
|
26
31
|
fileset = Puppet::FileServing::Fileset.new(path)
|
27
32
|
fileset.path.should == path
|
28
33
|
end
|
29
34
|
|
30
35
|
it "should fail if its path does not exist" do
|
31
|
-
File.expects(:lstat).with(
|
32
|
-
proc { Puppet::FileServing::Fileset.new(
|
36
|
+
File.expects(:lstat).with(@somefile).returns nil
|
37
|
+
proc { Puppet::FileServing::Fileset.new(@somefile) }.should raise_error(ArgumentError)
|
33
38
|
end
|
34
39
|
|
35
40
|
it "should accept a 'recurse' option" do
|
36
|
-
File.expects(:lstat).with(
|
37
|
-
set = Puppet::FileServing::Fileset.new(
|
41
|
+
File.expects(:lstat).with(@somefile).returns stub("stat")
|
42
|
+
set = Puppet::FileServing::Fileset.new(@somefile, :recurse => true)
|
38
43
|
set.recurse.should be_true
|
39
44
|
end
|
40
45
|
|
41
46
|
it "should accept a 'recurselimit' option" do
|
42
|
-
File.expects(:lstat).with(
|
43
|
-
set = Puppet::FileServing::Fileset.new(
|
47
|
+
File.expects(:lstat).with(@somefile).returns stub("stat")
|
48
|
+
set = Puppet::FileServing::Fileset.new(@somefile, :recurselimit => 3)
|
44
49
|
set.recurselimit.should == 3
|
45
50
|
end
|
46
51
|
|
47
52
|
it "should accept an 'ignore' option" do
|
48
|
-
File.expects(:lstat).with(
|
49
|
-
set = Puppet::FileServing::Fileset.new(
|
53
|
+
File.expects(:lstat).with(@somefile).returns stub("stat")
|
54
|
+
set = Puppet::FileServing::Fileset.new(@somefile, :ignore => ".svn")
|
50
55
|
set.ignore.should == [".svn"]
|
51
56
|
end
|
52
57
|
|
53
58
|
it "should accept a 'links' option" do
|
54
|
-
File.expects(:lstat).with(
|
55
|
-
set = Puppet::FileServing::Fileset.new(
|
59
|
+
File.expects(:lstat).with(@somefile).returns stub("stat")
|
60
|
+
set = Puppet::FileServing::Fileset.new(@somefile, :links => :manage)
|
56
61
|
set.links.should == :manage
|
57
62
|
end
|
58
63
|
|
59
64
|
it "should accept a 'checksum_type' option" do
|
60
|
-
File.expects(:lstat).with(
|
61
|
-
set = Puppet::FileServing::Fileset.new(
|
65
|
+
File.expects(:lstat).with(@somefile).returns stub("stat")
|
66
|
+
set = Puppet::FileServing::Fileset.new(@somefile, :checksum_type => :test)
|
62
67
|
set.checksum_type.should == :test
|
63
68
|
end
|
64
69
|
|
65
70
|
it "should fail if 'links' is set to anything other than :manage or :follow" do
|
66
|
-
proc { Puppet::FileServing::Fileset.new(
|
71
|
+
proc { Puppet::FileServing::Fileset.new(@somefile, :links => :whatever) }.should raise_error(ArgumentError)
|
67
72
|
end
|
68
73
|
|
69
74
|
it "should default to 'false' for recurse" do
|
70
|
-
File.expects(:lstat).with(
|
71
|
-
Puppet::FileServing::Fileset.new(
|
75
|
+
File.expects(:lstat).with(@somefile).returns stub("stat")
|
76
|
+
Puppet::FileServing::Fileset.new(@somefile).recurse.should == false
|
72
77
|
end
|
73
78
|
|
74
79
|
it "should default to :infinite for recurselimit" do
|
75
|
-
File.expects(:lstat).with(
|
76
|
-
Puppet::FileServing::Fileset.new(
|
80
|
+
File.expects(:lstat).with(@somefile).returns stub("stat")
|
81
|
+
Puppet::FileServing::Fileset.new(@somefile).recurselimit.should == :infinite
|
77
82
|
end
|
78
83
|
|
79
84
|
it "should default to an empty ignore list" do
|
80
|
-
File.expects(:lstat).with(
|
81
|
-
Puppet::FileServing::Fileset.new(
|
85
|
+
File.expects(:lstat).with(@somefile).returns stub("stat")
|
86
|
+
Puppet::FileServing::Fileset.new(@somefile).ignore.should == []
|
82
87
|
end
|
83
88
|
|
84
89
|
it "should default to :manage for links" do
|
85
|
-
File.expects(:lstat).with(
|
86
|
-
Puppet::FileServing::Fileset.new(
|
90
|
+
File.expects(:lstat).with(@somefile).returns stub("stat")
|
91
|
+
Puppet::FileServing::Fileset.new(@somefile).links.should == :manage
|
87
92
|
end
|
88
93
|
|
89
94
|
it "should support using an Indirector Request for its options" do
|
90
|
-
File.expects(:lstat).with(
|
95
|
+
File.expects(:lstat).with(@somefile).returns stub("stat")
|
91
96
|
request = Puppet::Indirector::Request.new(:file_serving, :find, "foo")
|
92
|
-
lambda { Puppet::FileServing::Fileset.new(
|
97
|
+
lambda { Puppet::FileServing::Fileset.new(@somefile, request) }.should_not raise_error
|
93
98
|
end
|
94
99
|
|
95
100
|
describe "using an indirector request" do
|
@@ -97,40 +102,43 @@ describe Puppet::FileServing::Fileset, " when initializing" do
|
|
97
102
|
File.stubs(:lstat).returns stub("stat")
|
98
103
|
@values = {:links => :manage, :ignore => %w{a b}, :recurse => true, :recurselimit => 1234}
|
99
104
|
@request = Puppet::Indirector::Request.new(:file_serving, :find, "foo")
|
105
|
+
@myfile = make_absolute("/my/file")
|
100
106
|
end
|
101
107
|
|
102
108
|
[:recurse, :recurselimit, :ignore, :links].each do |option|
|
103
109
|
it "should pass :recurse, :recurselimit, :ignore, and :links settings on to the fileset if present" do
|
104
110
|
@request.stubs(:options).returns(option => @values[option])
|
105
|
-
Puppet::FileServing::Fileset.new(
|
111
|
+
Puppet::FileServing::Fileset.new(@myfile, @request).send(option).should == @values[option]
|
106
112
|
end
|
107
113
|
|
108
114
|
it "should pass :recurse, :recurselimit, :ignore, and :links settings on to the fileset if present with the keys stored as strings" do
|
109
115
|
@request.stubs(:options).returns(option.to_s => @values[option])
|
110
|
-
Puppet::FileServing::Fileset.new(
|
116
|
+
Puppet::FileServing::Fileset.new(@myfile, @request).send(option).should == @values[option]
|
111
117
|
end
|
112
118
|
end
|
113
119
|
|
114
120
|
it "should convert the integer as a string to their integer counterpart when setting options" do
|
115
121
|
@request.stubs(:options).returns(:recurselimit => "1234")
|
116
|
-
Puppet::FileServing::Fileset.new(
|
122
|
+
Puppet::FileServing::Fileset.new(@myfile, @request).recurselimit.should == 1234
|
117
123
|
end
|
118
124
|
|
119
125
|
it "should convert the string 'true' to the boolean true when setting options" do
|
120
126
|
@request.stubs(:options).returns(:recurse => "true")
|
121
|
-
Puppet::FileServing::Fileset.new(
|
127
|
+
Puppet::FileServing::Fileset.new(@myfile, @request).recurse.should == true
|
122
128
|
end
|
123
129
|
|
124
130
|
it "should convert the string 'false' to the boolean false when setting options" do
|
125
131
|
@request.stubs(:options).returns(:recurse => "false")
|
126
|
-
Puppet::FileServing::Fileset.new(
|
132
|
+
Puppet::FileServing::Fileset.new(@myfile, @request).recurse.should == false
|
127
133
|
end
|
128
134
|
end
|
129
135
|
end
|
130
136
|
|
131
137
|
describe Puppet::FileServing::Fileset, " when determining whether to recurse" do
|
138
|
+
include PuppetSpec::Files
|
139
|
+
|
132
140
|
before do
|
133
|
-
@path = "/my/path"
|
141
|
+
@path = make_absolute("/my/path")
|
134
142
|
File.expects(:lstat).with(@path).returns stub("stat")
|
135
143
|
@fileset = Puppet::FileServing::Fileset.new(@path)
|
136
144
|
end
|
@@ -166,8 +174,10 @@ describe Puppet::FileServing::Fileset, " when determining whether to recurse" do
|
|
166
174
|
end
|
167
175
|
|
168
176
|
describe Puppet::FileServing::Fileset, " when recursing" do
|
177
|
+
include PuppetSpec::Files
|
178
|
+
|
169
179
|
before do
|
170
|
-
@path = "/my/path"
|
180
|
+
@path = make_absolute("/my/path")
|
171
181
|
File.expects(:lstat).with(@path).returns stub("stat", :directory? => true)
|
172
182
|
@fileset = Puppet::FileServing::Fileset.new(@path)
|
173
183
|
|
@@ -257,7 +267,7 @@ describe Puppet::FileServing::Fileset, " when recursing" do
|
|
257
267
|
end
|
258
268
|
|
259
269
|
it "should succeed when paths have regexp significant characters" do
|
260
|
-
@path = "/my/path/rV1x2DafFr0R6tGG+1bbk++++TM"
|
270
|
+
@path = make_absolute("/my/path/rV1x2DafFr0R6tGG+1bbk++++TM")
|
261
271
|
File.expects(:lstat).with(@path).returns stub("stat", :directory? => true)
|
262
272
|
@fileset = Puppet::FileServing::Fileset.new(@path)
|
263
273
|
mock_dir_structure(@path)
|
@@ -267,8 +277,10 @@ describe Puppet::FileServing::Fileset, " when recursing" do
|
|
267
277
|
end
|
268
278
|
|
269
279
|
describe Puppet::FileServing::Fileset, " when following links that point to missing files" do
|
280
|
+
include PuppetSpec::Files
|
281
|
+
|
270
282
|
before do
|
271
|
-
@path = "/my/path"
|
283
|
+
@path = make_absolute("/my/path")
|
272
284
|
File.expects(:lstat).with(@path).returns stub("stat", :directory? => true)
|
273
285
|
@fileset = Puppet::FileServing::Fileset.new(@path)
|
274
286
|
@fileset.links = :follow
|
@@ -291,8 +303,10 @@ describe Puppet::FileServing::Fileset, " when following links that point to miss
|
|
291
303
|
end
|
292
304
|
|
293
305
|
describe Puppet::FileServing::Fileset, " when ignoring" do
|
306
|
+
include PuppetSpec::Files
|
307
|
+
|
294
308
|
before do
|
295
|
-
@path = "/my/path"
|
309
|
+
@path = make_absolute("/my/path")
|
296
310
|
File.expects(:lstat).with(@path).returns stub("stat", :directory? => true)
|
297
311
|
@fileset = Puppet::FileServing::Fileset.new(@path)
|
298
312
|
end
|
@@ -318,8 +332,10 @@ describe Puppet::FileServing::Fileset, " when ignoring" do
|
|
318
332
|
end
|
319
333
|
|
320
334
|
describe Puppet::FileServing::Fileset, "when merging other filesets" do
|
335
|
+
include PuppetSpec::Files
|
336
|
+
|
321
337
|
before do
|
322
|
-
@paths =
|
338
|
+
@paths = [make_absolute("/first/path"), make_absolute("/second/path"), make_absolute("/third/path")]
|
323
339
|
File.stubs(:lstat).returns stub("stat", :directory? => false)
|
324
340
|
|
325
341
|
@filesets = @paths.collect do |path|
|
@@ -331,32 +347,32 @@ describe Puppet::FileServing::Fileset, "when merging other filesets" do
|
|
331
347
|
end
|
332
348
|
|
333
349
|
it "should return a hash of all files in each fileset with the value being the base path" do
|
334
|
-
Dir.expects(:entries).with("/first/path").returns(%w{one uno})
|
335
|
-
Dir.expects(:entries).with("/second/path").returns(%w{two dos})
|
336
|
-
Dir.expects(:entries).with("/third/path").returns(%w{three tres})
|
350
|
+
Dir.expects(:entries).with(make_absolute("/first/path")).returns(%w{one uno})
|
351
|
+
Dir.expects(:entries).with(make_absolute("/second/path")).returns(%w{two dos})
|
352
|
+
Dir.expects(:entries).with(make_absolute("/third/path")).returns(%w{three tres})
|
337
353
|
|
338
354
|
Puppet::FileServing::Fileset.merge(*@filesets).should == {
|
339
|
-
"." => "/first/path",
|
340
|
-
"one" => "/first/path",
|
341
|
-
"uno" => "/first/path",
|
342
|
-
"two" => "/second/path",
|
343
|
-
"dos" => "/second/path",
|
344
|
-
"three" => "/third/path",
|
345
|
-
"tres" => "/third/path",
|
355
|
+
"." => make_absolute("/first/path"),
|
356
|
+
"one" => make_absolute("/first/path"),
|
357
|
+
"uno" => make_absolute("/first/path"),
|
358
|
+
"two" => make_absolute("/second/path"),
|
359
|
+
"dos" => make_absolute("/second/path"),
|
360
|
+
"three" => make_absolute("/third/path"),
|
361
|
+
"tres" => make_absolute("/third/path"),
|
346
362
|
}
|
347
363
|
end
|
348
364
|
|
349
365
|
it "should include the base directory from the first fileset" do
|
350
|
-
Dir.expects(:entries).with("/first/path").returns(%w{one})
|
351
|
-
Dir.expects(:entries).with("/second/path").returns(%w{two})
|
366
|
+
Dir.expects(:entries).with(make_absolute("/first/path")).returns(%w{one})
|
367
|
+
Dir.expects(:entries).with(make_absolute("/second/path")).returns(%w{two})
|
352
368
|
|
353
|
-
Puppet::FileServing::Fileset.merge(*@filesets)["."].should == "/first/path"
|
369
|
+
Puppet::FileServing::Fileset.merge(*@filesets)["."].should == make_absolute("/first/path")
|
354
370
|
end
|
355
371
|
|
356
372
|
it "should use the base path of the first found file when relative file paths conflict" do
|
357
|
-
Dir.expects(:entries).with("/first/path").returns(%w{one})
|
358
|
-
Dir.expects(:entries).with("/second/path").returns(%w{one})
|
373
|
+
Dir.expects(:entries).with(make_absolute("/first/path")).returns(%w{one})
|
374
|
+
Dir.expects(:entries).with(make_absolute("/second/path")).returns(%w{one})
|
359
375
|
|
360
|
-
Puppet::FileServing::Fileset.merge(*@filesets)["one"].should == "/first/path"
|
376
|
+
Puppet::FileServing::Fileset.merge(*@filesets)["one"].should == make_absolute("/first/path")
|
361
377
|
end
|
362
378
|
end
|