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
@@ -20,23 +20,26 @@
|
|
20
20
|
|
21
21
|
shared_examples_for "all pathname parameters with arrays" do |win32|
|
22
22
|
path_types = {
|
23
|
-
"unix absolute"
|
24
|
-
"unix relative"
|
25
|
-
"win32 absolute" => %q{\foo\bar},
|
26
|
-
"win32 relative" => %q{foo\bar},
|
27
|
-
"drive absolute"
|
28
|
-
"drive relative"
|
23
|
+
"unix absolute" => %q{/foo/bar},
|
24
|
+
"unix relative" => %q{foo/bar},
|
25
|
+
"win32 non-drive absolute" => %q{\foo\bar},
|
26
|
+
"win32 non-drive relative" => %q{foo\bar},
|
27
|
+
"win32 drive absolute" => %q{c:\foo\bar},
|
28
|
+
"win32 drive relative" => %q{c:foo\bar}
|
29
29
|
}
|
30
30
|
|
31
31
|
describe "when given an array of paths" do
|
32
32
|
(1..path_types.length).each do |n|
|
33
33
|
path_types.keys.combination(n) do |set|
|
34
34
|
data = path_types.collect { |k, v| set.member?(k) ? v : nil } .compact
|
35
|
-
reject = true
|
36
|
-
only_absolute = set.find { |k| k =~ /relative/ } .nil?
|
37
|
-
only_unix = set.reject { |k| k =~ /unix/ } .length == 0
|
38
35
|
|
39
|
-
|
36
|
+
has_relative = set.find { |k| k =~ /relative/ or k =~ /non-drive/ }
|
37
|
+
has_windows = set.find { |k| k =~ /win32/ }
|
38
|
+
has_unix = set.find { |k| k =~ /unix/ }
|
39
|
+
|
40
|
+
if has_relative or (has_windows and !win32) or (has_unix and win32)
|
41
|
+
reject = true
|
42
|
+
else
|
40
43
|
reject = false
|
41
44
|
end
|
42
45
|
|
@@ -144,10 +147,9 @@ shared_examples_for "all path parameters" do |param, options|
|
|
144
147
|
it_should_behave_like "all pathname parameters with arrays", true
|
145
148
|
end
|
146
149
|
|
147
|
-
it "should
|
148
|
-
path =
|
149
|
-
|
150
|
-
instance[@param].should == path
|
150
|
+
it "should reject a fully qualified unix path" do
|
151
|
+
path = '/foo'
|
152
|
+
expect { instance(path) }.to raise_error(Puppet::Error, /fully qualified/)
|
151
153
|
end
|
152
154
|
|
153
155
|
it "should give a useful error when the path is not absolute" do
|
@@ -157,7 +159,7 @@ shared_examples_for "all path parameters" do |param, options|
|
|
157
159
|
end
|
158
160
|
|
159
161
|
it "also accepts Unix style path separators" do
|
160
|
-
path = '
|
162
|
+
path = 'C:/Program Files'
|
161
163
|
instance = instance(path)
|
162
164
|
instance[@param].should == path
|
163
165
|
end
|
@@ -172,9 +174,9 @@ shared_examples_for "all path parameters" do |param, options|
|
|
172
174
|
end
|
173
175
|
end
|
174
176
|
|
175
|
-
{ "UNC paths" => %q{
|
176
|
-
"unparsed local paths" => %q{
|
177
|
-
"unparsed UNC paths" => %q{
|
177
|
+
{ "UNC paths" => %q{\\\\foo\bar},
|
178
|
+
"unparsed local paths" => %q{\\\\?\c:\foo},
|
179
|
+
"unparsed UNC paths" => %q{\\\\?\foo\bar}
|
178
180
|
}.each do |name, path|
|
179
181
|
it "should accept #{name} as absolute" do
|
180
182
|
instance = instance(path)
|
@@ -0,0 +1,21 @@
|
|
1
|
+
shared_examples_for "a StoreConfigs terminus" do
|
2
|
+
before :each do
|
3
|
+
Puppet[:storeconfigs] = true
|
4
|
+
Puppet[:storeconfigs_backend] = "store_configs_testing"
|
5
|
+
end
|
6
|
+
|
7
|
+
api = [:find, :search, :save, :destroy, :head]
|
8
|
+
|
9
|
+
api.each do |name|
|
10
|
+
it { should respond_to name }
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should fail if an invalid backend is configured" do
|
14
|
+
Puppet[:storeconfigs_backend] = "synergy"
|
15
|
+
expect { subject }.to raise_error ArgumentError, /could not find terminus synergy/i
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should wrap the declared backend" do
|
19
|
+
subject.target.class.name.should == :store_configs_testing
|
20
|
+
end
|
21
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -36,6 +36,28 @@ RSpec.configure do |config|
|
|
36
36
|
config.before :each do
|
37
37
|
GC.disable
|
38
38
|
|
39
|
+
# We need to preserve the current state of all our indirection cache and
|
40
|
+
# terminus classes. This is pretty important, because changes to these
|
41
|
+
# are global and lead to order dependencies in our testing.
|
42
|
+
#
|
43
|
+
# We go direct to the implementation because there is no safe, sane public
|
44
|
+
# API to manage restoration of these to their default values. This
|
45
|
+
# should, once the value is proved, be moved to a standard API on the
|
46
|
+
# indirector.
|
47
|
+
#
|
48
|
+
# To make things worse, a number of the tests stub parts of the
|
49
|
+
# indirector. These stubs have very specific expectations that what
|
50
|
+
# little of the public API we could use is, well, likely to explode
|
51
|
+
# randomly in some tests. So, direct access. --daniel 2011-08-30
|
52
|
+
$saved_indirection_state = {}
|
53
|
+
indirections = Puppet::Indirector::Indirection.send(:class_variable_get, :@@indirections)
|
54
|
+
indirections.each do |indirector|
|
55
|
+
$saved_indirection_state[indirector.name] = {
|
56
|
+
:@terminus_class => indirector.instance_variable_get(:@terminus_class),
|
57
|
+
:@cache_class => indirector.instance_variable_get(:@cache_class)
|
58
|
+
}
|
59
|
+
end
|
60
|
+
|
39
61
|
# these globals are set by Application
|
40
62
|
$puppet_application_mode = nil
|
41
63
|
$puppet_application_name = nil
|
@@ -71,6 +93,15 @@ RSpec.configure do |config|
|
|
71
93
|
Puppet::Util::Log.close_all
|
72
94
|
Puppet::Util::Log.level = @log_level
|
73
95
|
|
96
|
+
# Restore the indirector configuration. See before hook.
|
97
|
+
indirections = Puppet::Indirector::Indirection.send(:class_variable_get, :@@indirections)
|
98
|
+
indirections.each do |indirector|
|
99
|
+
$saved_indirection_state.fetch(indirector.name, {}).each do |variable, value|
|
100
|
+
indirector.instance_variable_set(variable, value)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
$saved_indirection_state = nil
|
104
|
+
|
74
105
|
GC.enable
|
75
106
|
end
|
76
107
|
end
|
data/spec/unit/agent_spec.rb
CHANGED
@@ -12,6 +12,14 @@ describe Puppet::Application::Apply do
|
|
12
12
|
Puppet::Util::Log.stubs(:newdestination)
|
13
13
|
end
|
14
14
|
|
15
|
+
after :each do
|
16
|
+
Puppet::Node::Facts.indirection.reset_terminus_class
|
17
|
+
Puppet::Node::Facts.indirection.cache_class = nil
|
18
|
+
|
19
|
+
Puppet::Node.indirection.reset_terminus_class
|
20
|
+
Puppet::Node.indirection.cache_class = nil
|
21
|
+
end
|
22
|
+
|
15
23
|
[:debug,:loadclasses,:verbose,:use_nodes,:detailed_exitcodes].each do |option|
|
16
24
|
it "should declare handle_#{option} method" do
|
17
25
|
@apply.should respond_to("handle_#{option}".to_sym)
|
@@ -48,7 +56,6 @@ describe Puppet::Application::Apply do
|
|
48
56
|
end
|
49
57
|
|
50
58
|
describe "during setup" do
|
51
|
-
|
52
59
|
before :each do
|
53
60
|
Puppet::Log.stubs(:newdestination)
|
54
61
|
Puppet.stubs(:parse_config)
|
@@ -111,7 +118,6 @@ describe Puppet::Application::Apply do
|
|
111
118
|
end
|
112
119
|
|
113
120
|
describe "when executing" do
|
114
|
-
|
115
121
|
it "should dispatch to 'apply' if it was called with 'apply'" do
|
116
122
|
@apply.options[:catalog] = "foo"
|
117
123
|
|
@@ -7,6 +7,8 @@ require 'ostruct'
|
|
7
7
|
require 'puppet/configurer'
|
8
8
|
|
9
9
|
describe Puppet::Application::Device do
|
10
|
+
include PuppetSpec::Files
|
11
|
+
|
10
12
|
before :each do
|
11
13
|
@device = Puppet::Application[:device]
|
12
14
|
@device.preinit
|
@@ -264,8 +266,8 @@ describe Puppet::Application::Device do
|
|
264
266
|
|
265
267
|
describe "for each device" do
|
266
268
|
before(:each) do
|
267
|
-
Puppet[:vardir] = "/dummy"
|
268
|
-
Puppet[:confdir] = "/dummy"
|
269
|
+
Puppet[:vardir] = make_absolute("/dummy")
|
270
|
+
Puppet[:confdir] = make_absolute("/dummy")
|
269
271
|
Puppet[:certname] = "certname"
|
270
272
|
@device_hash = {
|
271
273
|
"device1" => OpenStruct.new(:name => "device1", :url => "url", :provider => "cisco"),
|
@@ -281,12 +283,12 @@ describe Puppet::Application::Device do
|
|
281
283
|
end
|
282
284
|
|
283
285
|
it "should set vardir to the device vardir" do
|
284
|
-
Puppet.settings.expects(:set_value).with(:vardir, "/dummy/devices/device1", :cli)
|
286
|
+
Puppet.settings.expects(:set_value).with(:vardir, make_absolute("/dummy/devices/device1"), :cli)
|
285
287
|
@device.main
|
286
288
|
end
|
287
289
|
|
288
290
|
it "should set confdir to the device confdir" do
|
289
|
-
Puppet.settings.expects(:set_value).with(:confdir, "/dummy/devices/device1", :cli)
|
291
|
+
Puppet.settings.expects(:set_value).with(:confdir, make_absolute("/dummy/devices/device1"), :cli)
|
290
292
|
@device.main
|
291
293
|
end
|
292
294
|
|
@@ -319,9 +321,9 @@ describe Puppet::Application::Device do
|
|
319
321
|
[:vardir, :confdir].each do |setting|
|
320
322
|
it "should cleanup the #{setting} setting after the run" do
|
321
323
|
configurer = states('configurer').starts_as('notrun')
|
322
|
-
Puppet.settings.expects(:set_value).with(setting, "/dummy/devices/device1", :cli).when(configurer.is('notrun'))
|
324
|
+
Puppet.settings.expects(:set_value).with(setting, make_absolute("/dummy/devices/device1"), :cli).when(configurer.is('notrun'))
|
323
325
|
@configurer.expects(:run).twice.then(configurer.is('run'))
|
324
|
-
Puppet.settings.expects(:set_value).with(setting, "/dummy", :cli).when(configurer.is('run'))
|
326
|
+
Puppet.settings.expects(:set_value).with(setting, make_absolute("/dummy"), :cli).when(configurer.is('run'))
|
325
327
|
|
326
328
|
@device.main
|
327
329
|
end
|
@@ -103,6 +103,7 @@ describe Puppet::Application::Inspect do
|
|
103
103
|
catalog = Puppet::Resource::Catalog.new
|
104
104
|
file = Tempfile.new("foo")
|
105
105
|
resource = Puppet::Resource.new(:file, file.path, :parameters => {:audit => "all"})
|
106
|
+
file.close
|
106
107
|
file.delete
|
107
108
|
catalog.add_resource(resource)
|
108
109
|
Puppet::Resource::Catalog::Yaml.any_instance.stubs(:find).returns(catalog)
|
@@ -147,7 +148,7 @@ describe Puppet::Application::Inspect do
|
|
147
148
|
@inspect.run_command
|
148
149
|
end
|
149
150
|
|
150
|
-
it "should not send unreadable files" do
|
151
|
+
it "should not send unreadable files", :unless => Puppet.features.microsoft_windows? do
|
151
152
|
File.open(@file, 'w') { |f| f.write('stuff') }
|
152
153
|
File.chmod(0, @file)
|
153
154
|
Puppet::FileBucketFile::Rest.any_instance.expects(:head).never
|
@@ -5,7 +5,7 @@ require 'puppet/application/master'
|
|
5
5
|
require 'puppet/daemon'
|
6
6
|
require 'puppet/network/server'
|
7
7
|
|
8
|
-
describe Puppet::Application::Master do
|
8
|
+
describe Puppet::Application::Master, :unless => Puppet.features.microsoft_windows? do
|
9
9
|
before :each do
|
10
10
|
@master = Puppet::Application[:master]
|
11
11
|
@daemon = stub_everything 'daemon'
|
@@ -106,7 +106,6 @@ describe Puppet::Application::Master do
|
|
106
106
|
end
|
107
107
|
|
108
108
|
describe "during setup" do
|
109
|
-
|
110
109
|
before :each do
|
111
110
|
Puppet::Log.stubs(:newdestination)
|
112
111
|
Puppet.stubs(:settraps)
|
@@ -117,6 +116,12 @@ describe Puppet::Application::Master do
|
|
117
116
|
@master.options.stubs(:[]).with(any_parameters)
|
118
117
|
end
|
119
118
|
|
119
|
+
it "should abort stating that the master is not supported on Windows" do
|
120
|
+
Puppet.features.stubs(:microsoft_windows?).returns(true)
|
121
|
+
|
122
|
+
expect { @master.setup }.to raise_error(Puppet::Error, /Puppet master is not supported on Microsoft Windows/)
|
123
|
+
end
|
124
|
+
|
120
125
|
it "should set log level to debug if --debug was passed" do
|
121
126
|
@master.options.stubs(:[]).with(:debug).returns(true)
|
122
127
|
@master.setup
|
@@ -4,7 +4,7 @@ require 'spec_helper'
|
|
4
4
|
require 'puppet/application/queue'
|
5
5
|
require 'puppet/indirector/catalog/queue'
|
6
6
|
|
7
|
-
describe Puppet::Application::Queue do
|
7
|
+
describe Puppet::Application::Queue, :unless => Puppet.features.microsoft_windows? do
|
8
8
|
before :each do
|
9
9
|
@queue = Puppet::Application[:queue]
|
10
10
|
@queue.stubs(:puts)
|
@@ -129,9 +129,8 @@ describe Puppet::Application::Queue do
|
|
129
129
|
end
|
130
130
|
end
|
131
131
|
|
132
|
-
it "should configure the Catalog class to use
|
133
|
-
Puppet::Resource::Catalog.indirection.expects(:terminus_class=).with(:
|
134
|
-
|
132
|
+
it "should configure the Catalog class to use StoreConfigs" do
|
133
|
+
Puppet::Resource::Catalog.indirection.expects(:terminus_class=).with(:store_configs)
|
135
134
|
@queue.setup
|
136
135
|
end
|
137
136
|
|
@@ -221,4 +221,30 @@ describe Puppet::Application::Resource do
|
|
221
221
|
|
222
222
|
end
|
223
223
|
end
|
224
|
+
|
225
|
+
describe "when handling file type" do
|
226
|
+
before :each do
|
227
|
+
Facter.stubs(:loadfacts)
|
228
|
+
@resource.preinit
|
229
|
+
end
|
230
|
+
|
231
|
+
it "should raise an exception if no file specified" do
|
232
|
+
@resource.command_line.stubs(:args).returns(['file'])
|
233
|
+
|
234
|
+
lambda { @resource.main }.should raise_error(RuntimeError, /Listing all file instances is not supported/)
|
235
|
+
end
|
236
|
+
|
237
|
+
it "should output a file resource when given a file path" do
|
238
|
+
path = File.expand_path('/etc')
|
239
|
+
res = Puppet::Type.type(:file).new(:path => path).to_resource
|
240
|
+
Puppet::Resource.indirection.expects(:find).returns(res)
|
241
|
+
|
242
|
+
@resource.command_line.stubs(:args).returns(['file', path])
|
243
|
+
@resource.expects(:puts).with do |args|
|
244
|
+
args.should =~ /file \{ '#{Regexp.escape(path)}'/m
|
245
|
+
end
|
246
|
+
|
247
|
+
@resource.main
|
248
|
+
end
|
249
|
+
end
|
224
250
|
end
|
@@ -6,10 +6,12 @@ require 'puppet/indirector/report/rest'
|
|
6
6
|
require 'tempfile'
|
7
7
|
|
8
8
|
describe "Puppet::Application::Secret_agent" do
|
9
|
+
include PuppetSpec::Files
|
10
|
+
|
9
11
|
it "should retrieve and apply a catalog and submit a report" do
|
10
12
|
pending "REVISIT: 2.7 changes broke this, and we want the merge published"
|
11
13
|
|
12
|
-
dirname =
|
14
|
+
dirname = tmpdir("puppetdir")
|
13
15
|
Puppet[:vardir] = dirname
|
14
16
|
Puppet[:confdir] = dirname
|
15
17
|
Puppet[:certname] = "foo"
|
@@ -31,6 +31,10 @@ describe Puppet::Application do
|
|
31
31
|
end
|
32
32
|
|
33
33
|
it "should exit if it can't find a class" do
|
34
|
+
reg = "Unable to find application 'ThisShallNeverEverEverExist'. "
|
35
|
+
reg += "no such file to load -- puppet/application/thisshallneverevereverexist"
|
36
|
+
@klass.expects(:puts).with(reg)
|
37
|
+
|
34
38
|
expect { @klass.find("ThisShallNeverEverEverExist") }.to exit_with 1
|
35
39
|
end
|
36
40
|
end
|
@@ -97,14 +97,15 @@ describe Puppet::Configurer::Downloader do
|
|
97
97
|
|
98
98
|
describe "when creating the catalog to do the downloading" do
|
99
99
|
before do
|
100
|
-
@
|
100
|
+
@path = make_absolute("/download/path")
|
101
|
+
@dler = Puppet::Configurer::Downloader.new("foo", @path, "source")
|
101
102
|
end
|
102
103
|
|
103
104
|
it "should create a catalog and add the file to it" do
|
104
105
|
catalog = @dler.catalog
|
105
106
|
catalog.resources.size.should == 1
|
106
107
|
catalog.resources.first.class.should == Puppet::Type::File
|
107
|
-
catalog.resources.first.name.should ==
|
108
|
+
catalog.resources.first.name.should == @path
|
108
109
|
end
|
109
110
|
|
110
111
|
it "should specify that it is not managing a host catalog" do
|
@@ -121,7 +122,7 @@ describe Puppet::Configurer::Downloader do
|
|
121
122
|
@dler = Puppet::Configurer::Downloader.new("foo", @dl_name, source_name)
|
122
123
|
end
|
123
124
|
|
124
|
-
it "should not skip downloaded resources when filtering on tags" do
|
125
|
+
it "should not skip downloaded resources when filtering on tags", :fails_on_windows => true do
|
125
126
|
Puppet[:tags] = 'maytag'
|
126
127
|
@dler.evaluate
|
127
128
|
|
@@ -1,8 +1,4 @@
|
|
1
1
|
#!/usr/bin/env rspec
|
2
|
-
#
|
3
|
-
# Created by Luke Kanies on 2007-11-12.
|
4
|
-
# Copyright (c) 2007. All rights reserved.
|
5
|
-
|
6
2
|
require 'spec_helper'
|
7
3
|
require 'puppet/configurer'
|
8
4
|
|
@@ -93,6 +89,11 @@ describe Puppet::Configurer do
|
|
93
89
|
Puppet::Util::Log.stubs(:close_all)
|
94
90
|
end
|
95
91
|
|
92
|
+
after :all do
|
93
|
+
Puppet::Node::Facts.indirection.reset_terminus_class
|
94
|
+
Puppet::Resource::Catalog.indirection.reset_terminus_class
|
95
|
+
end
|
96
|
+
|
96
97
|
it "should prepare for the run" do
|
97
98
|
@agent.expects(:prepare)
|
98
99
|
|
@@ -573,6 +574,12 @@ describe Puppet::Configurer do
|
|
573
574
|
|
574
575
|
@agent.convert_catalog(@oldcatalog, 10)
|
575
576
|
end
|
577
|
+
|
578
|
+
it "should write the RAL catalog's resource file" do
|
579
|
+
@catalog.expects(:write_resource_file)
|
580
|
+
|
581
|
+
@agent.convert_catalog(@oldcatalog, 10)
|
582
|
+
end
|
576
583
|
end
|
577
584
|
|
578
585
|
describe "when preparing for a run" do
|
data/spec/unit/daemon_spec.rb
CHANGED
@@ -28,7 +28,9 @@ describe Puppet::Daemon do
|
|
28
28
|
end
|
29
29
|
|
30
30
|
describe "when setting signal traps" do
|
31
|
-
{:INT => :stop, :TERM => :stop
|
31
|
+
signals = {:INT => :stop, :TERM => :stop }
|
32
|
+
signals.update({:HUP => :restart, :USR1 => :reload, :USR2 => :reopen_logs}) unless Puppet.features.microsoft_windows?
|
33
|
+
signals.each do |signal, method|
|
32
34
|
it "should log and call #{method} when it receives #{signal}" do
|
33
35
|
Signal.expects(:trap).with(signal).yields
|
34
36
|
|
data/spec/unit/face/ca_spec.rb
CHANGED
data/spec/unit/face/node_spec.rb
CHANGED
@@ -3,6 +3,10 @@ require 'spec_helper'
|
|
3
3
|
require 'puppet/face'
|
4
4
|
|
5
5
|
describe Puppet::Face[:node, '0.0.1'] do
|
6
|
+
after :all do
|
7
|
+
Puppet::SSL::Host.ca_location = :none
|
8
|
+
end
|
9
|
+
|
6
10
|
describe '#cleanup' do
|
7
11
|
it "should clean everything" do
|
8
12
|
{
|
@@ -141,7 +145,7 @@ describe Puppet::Face[:node, '0.0.1'] do
|
|
141
145
|
|
142
146
|
describe "when cleaning cached node" do
|
143
147
|
it "should destroy the cached node" do
|
144
|
-
Puppet::Node
|
148
|
+
Puppet::Node.indirection.expects(:destroy).with(@host)
|
145
149
|
subject.clean_cached_node(@host)
|
146
150
|
end
|
147
151
|
end
|
@@ -5,10 +5,12 @@ require 'puppet/indirector/catalog/rest'
|
|
5
5
|
require 'tempfile'
|
6
6
|
|
7
7
|
describe Puppet::Face[:secret_agent, '0.0.1'] do
|
8
|
+
include PuppetSpec::Files
|
9
|
+
|
8
10
|
describe "#synchronize" do
|
9
11
|
it "should retrieve and apply a catalog and return a report" do
|
10
12
|
pending "This test doesn't work, but the code actually does - tested by LAK"
|
11
|
-
dirname =
|
13
|
+
dirname = tmpdir("puppetdir")
|
12
14
|
Puppet[:vardir] = dirname
|
13
15
|
Puppet[:confdir] = dirname
|
14
16
|
@catalog = Puppet::Resource::Catalog.new
|
@@ -16,7 +16,7 @@ describe Puppet::FileBucket::Dipper do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
it "should fail in an informative way when there are failures checking for the file on the server" do
|
19
|
-
@dipper = Puppet::FileBucket::Dipper.new(:Path => "/my/bucket")
|
19
|
+
@dipper = Puppet::FileBucket::Dipper.new(:Path => make_absolute("/my/bucket"))
|
20
20
|
|
21
21
|
file = make_tmp_file('contents')
|
22
22
|
Puppet::FileBucket::File.indirection.expects(:head).raises ArgumentError
|
@@ -25,7 +25,7 @@ describe Puppet::FileBucket::Dipper do
|
|
25
25
|
end
|
26
26
|
|
27
27
|
it "should fail in an informative way when there are failures backing up to the server" do
|
28
|
-
@dipper = Puppet::FileBucket::Dipper.new(:Path => "/my/bucket")
|
28
|
+
@dipper = Puppet::FileBucket::Dipper.new(:Path => make_absolute("/my/bucket"))
|
29
29
|
|
30
30
|
file = make_tmp_file('contents')
|
31
31
|
Puppet::FileBucket::File.indirection.expects(:head).returns false
|
@@ -34,7 +34,7 @@ describe Puppet::FileBucket::Dipper do
|
|
34
34
|
lambda { @dipper.backup(file) }.should raise_error(Puppet::Error)
|
35
35
|
end
|
36
36
|
|
37
|
-
it "should backup files to a local bucket" do
|
37
|
+
it "should backup files to a local bucket", :fails_on_windows => true do
|
38
38
|
Puppet[:bucketdir] = "/non/existent/directory"
|
39
39
|
file_bucket = tmpdir("bucket")
|
40
40
|
|
@@ -91,7 +91,7 @@ describe Puppet::FileBucket::Dipper do
|
|
91
91
|
[request1, request2].each do |r|
|
92
92
|
r.server.should == 'puppetmaster'
|
93
93
|
r.port.should == 31337
|
94
|
-
r.key.should == "md5/#{checksum}
|
94
|
+
r.key.should == "md5/#{checksum}/#{real_path}"
|
95
95
|
end
|
96
96
|
end
|
97
97
|
|
@@ -26,11 +26,17 @@ describe Puppet::FileBucket::File do
|
|
26
26
|
|
27
27
|
it "should raise an error if changing content" do
|
28
28
|
x = Puppet::FileBucket::File.new("first")
|
29
|
-
|
29
|
+
expect { x.contents = "new" }.to raise_error(NoMethodError, /undefined method .contents=/)
|
30
30
|
end
|
31
31
|
|
32
32
|
it "should require contents to be a string" do
|
33
|
-
|
33
|
+
expect { Puppet::FileBucket::File.new(5) }.to raise_error(ArgumentError, /contents must be a String, got a Fixnum$/)
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should complain about options other than :bucket_path" do
|
37
|
+
expect {
|
38
|
+
Puppet::FileBucket::File.new('5', :crazy_option => 'should not be passed')
|
39
|
+
}.to raise_error(ArgumentError, /Unknown option\(s\): crazy_option/)
|
34
40
|
end
|
35
41
|
|
36
42
|
it "should set the contents appropriately" do
|
@@ -61,7 +67,7 @@ describe Puppet::FileBucket::File do
|
|
61
67
|
|
62
68
|
it "should reject a url-ish name with an invalid checksum" do
|
63
69
|
bucket = Puppet::FileBucket::File.new(@contents)
|
64
|
-
|
70
|
+
expect { bucket.name = "sha1/4a8ec4fa5f01b4ab1a0ab8cbccb709f0/new/path" }.to raise_error(NoMethodError, /undefined method .name=/)
|
65
71
|
end
|
66
72
|
|
67
73
|
it "should convert the contents to PSON" do
|