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,14 +4,16 @@ require 'spec_helper'
|
|
4
4
|
require 'puppet/resource/status'
|
5
5
|
|
6
6
|
describe Puppet::Resource::Status do
|
7
|
+
include PuppetSpec::Files
|
8
|
+
|
7
9
|
before do
|
8
|
-
@resource = Puppet::Type.type(:file).new :path => "/my/file"
|
10
|
+
@resource = Puppet::Type.type(:file).new :path => make_absolute("/my/file")
|
9
11
|
@status = Puppet::Resource::Status.new(@resource)
|
10
12
|
end
|
11
13
|
|
12
14
|
it "should compute type and title correctly" do
|
13
15
|
@status.resource_type.should == "File"
|
14
|
-
@status.title.should == "/my/file"
|
16
|
+
@status.title.should == make_absolute("/my/file")
|
15
17
|
end
|
16
18
|
|
17
19
|
[:node, :file, :line, :current_values, :status, :evaluation_time].each do |attr|
|
data/spec/unit/resource_spec.rb
CHANGED
@@ -3,9 +3,10 @@ require 'spec_helper'
|
|
3
3
|
require 'puppet/resource'
|
4
4
|
|
5
5
|
describe Puppet::Resource do
|
6
|
+
include PuppetSpec::Files
|
6
7
|
|
7
8
|
before do
|
8
|
-
@basepath =
|
9
|
+
@basepath = make_absolute("/somepath")
|
9
10
|
end
|
10
11
|
|
11
12
|
[:catalog, :file, :line].each do |attr|
|
@@ -106,9 +107,8 @@ describe Puppet::Resource do
|
|
106
107
|
end
|
107
108
|
|
108
109
|
it "should fail if the title is a hash and the type is not a valid resource reference string" do
|
109
|
-
|
110
|
-
|
111
|
-
)
|
110
|
+
expect { Puppet::Resource.new({:type => "foo", :title => "bar"}) }.
|
111
|
+
to raise_error ArgumentError, /Puppet::Resource.new does not take a hash/
|
112
112
|
end
|
113
113
|
|
114
114
|
it "should be able to produce a backward-compatible reference array" do
|
@@ -778,7 +778,7 @@ type: File
|
|
778
778
|
end
|
779
779
|
|
780
780
|
it "should have a default terminus" do
|
781
|
-
Puppet::Resource.indirection.terminus_class.should
|
781
|
+
Puppet::Resource.indirection.terminus_class.should be
|
782
782
|
end
|
783
783
|
|
784
784
|
it "should have a name" do
|
@@ -5,7 +5,7 @@ require 'puppet/ssl/certificate_authority'
|
|
5
5
|
|
6
6
|
describe Puppet::SSL::CertificateAuthority do
|
7
7
|
after do
|
8
|
-
Puppet::
|
8
|
+
Puppet::SSL::CertificateAuthority.instance_variable_set(:@singleton_instance, nil)
|
9
9
|
Puppet.settings.clearused
|
10
10
|
end
|
11
11
|
|
@@ -25,7 +25,7 @@ describe Puppet::SSL::CertificateAuthority do
|
|
25
25
|
describe "when finding an existing instance" do
|
26
26
|
describe "and the host is a CA host and the run_mode is master" do
|
27
27
|
before do
|
28
|
-
Puppet
|
28
|
+
Puppet[:ca] = true
|
29
29
|
Puppet.run_mode.stubs(:master?).returns true
|
30
30
|
|
31
31
|
@ca = mock('ca')
|
data/spec/unit/ssl/host_spec.rb
CHANGED
@@ -5,15 +5,24 @@ require 'puppet/ssl/host'
|
|
5
5
|
require 'puppet/sslcertificates'
|
6
6
|
require 'puppet/sslcertificates/ca'
|
7
7
|
|
8
|
-
|
8
|
+
# REMIND: Fails on windows because there is no user provider yet
|
9
|
+
describe Puppet::SSL::Host, :fails_on_windows => true do
|
10
|
+
include PuppetSpec::Files
|
11
|
+
|
9
12
|
before do
|
10
13
|
Puppet::SSL::Host.indirection.terminus_class = :file
|
14
|
+
|
15
|
+
# Get a safe temporary file
|
16
|
+
dir = tmpdir("ssl_host_testing")
|
17
|
+
Puppet.settings[:confdir] = dir
|
18
|
+
Puppet.settings[:vardir] = dir
|
19
|
+
|
11
20
|
@host = Puppet::SSL::Host.new("myname")
|
12
21
|
end
|
13
22
|
|
14
23
|
after do
|
15
24
|
# Cleaned out any cached localhost instance.
|
16
|
-
Puppet::
|
25
|
+
Puppet::SSL::Host.instance_variable_set(:@localhost, nil)
|
17
26
|
Puppet::SSL::Host.ca_location = :none
|
18
27
|
end
|
19
28
|
|
@@ -82,16 +91,6 @@ describe Puppet::SSL::Host do
|
|
82
91
|
Puppet::SSL::Host.localhost.should == Puppet::SSL::Host.localhost
|
83
92
|
end
|
84
93
|
|
85
|
-
it "should be able to expire the cached instance" do
|
86
|
-
one = stub 'host1', :certificate => "eh", :key => 'foo'
|
87
|
-
two = stub 'host2', :certificate => "eh", :key => 'foo'
|
88
|
-
Puppet::SSL::Host.expects(:new).times(2).returns(one).then.returns(two)
|
89
|
-
|
90
|
-
Puppet::SSL::Host.localhost.should equal(one)
|
91
|
-
Puppet::Util::Cacher.expire
|
92
|
-
Puppet::SSL::Host.localhost.should equal(two)
|
93
|
-
end
|
94
|
-
|
95
94
|
it "should be able to verify its certificate matches its key" do
|
96
95
|
Puppet::SSL::Host.new("foo").should respond_to(:certificate_matches_key?)
|
97
96
|
end
|
@@ -711,7 +710,7 @@ describe Puppet::SSL::Host do
|
|
711
710
|
end
|
712
711
|
end
|
713
712
|
|
714
|
-
describe "when handling PSON" do
|
713
|
+
describe "when handling PSON", :unless => Puppet.features.microsoft_windows? do
|
715
714
|
include PuppetSpec::Files
|
716
715
|
|
717
716
|
before do
|
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
|
4
4
|
require 'puppet/ssl/inventory'
|
5
5
|
|
6
|
-
describe Puppet::SSL::Inventory do
|
6
|
+
describe Puppet::SSL::Inventory, :unless => Puppet.features.microsoft_windows? do
|
7
7
|
before do
|
8
8
|
@class = Puppet::SSL::Inventory
|
9
9
|
end
|
@@ -118,7 +118,7 @@ describe Puppet::SSL::Inventory do
|
|
118
118
|
end
|
119
119
|
end
|
120
120
|
|
121
|
-
describe "and formatting a certificate" do
|
121
|
+
describe "and formatting a certificate", :fails_on_windows => true do
|
122
122
|
before do
|
123
123
|
@cert = stub 'cert', :not_before => Time.now, :not_after => Time.now, :subject => "mycert", :serial => 15
|
124
124
|
end
|
@@ -5,27 +5,23 @@ require 'puppet'
|
|
5
5
|
require 'puppet/sslcertificates'
|
6
6
|
require 'puppet/sslcertificates/ca'
|
7
7
|
|
8
|
-
describe Puppet::SSLCertificates::CA do
|
8
|
+
describe Puppet::SSLCertificates::CA, :unless => Puppet.features.microsoft_windows? do
|
9
|
+
include PuppetSpec::Files
|
10
|
+
|
9
11
|
before :all do
|
10
12
|
@hosts = %w{host.domain.com Other.Testing.Com}
|
11
13
|
end
|
12
14
|
|
13
15
|
before :each do
|
14
16
|
Puppet::Util::SUIDManager.stubs(:asuser).yields
|
15
|
-
|
16
|
-
@dir = file.path
|
17
|
-
file.delete
|
17
|
+
dir = tmpdir("ca_testing")
|
18
18
|
|
19
|
-
Puppet.settings[:confdir] =
|
20
|
-
Puppet.settings[:vardir] =
|
19
|
+
Puppet.settings[:confdir] = dir
|
20
|
+
Puppet.settings[:vardir] = dir
|
21
21
|
|
22
22
|
@ca = Puppet::SSLCertificates::CA.new
|
23
23
|
end
|
24
24
|
|
25
|
-
after :each do
|
26
|
-
system("rm -rf #{@dir}")
|
27
|
-
end
|
28
|
-
|
29
25
|
describe 'when cleaning' do
|
30
26
|
it 'should remove associated files' do
|
31
27
|
dirs = [:csrdir, :signeddir, :publickeydir, :privatekeydir, :certdir]
|
@@ -4,6 +4,8 @@ require 'spec_helper'
|
|
4
4
|
require 'puppet/transaction/event_manager'
|
5
5
|
|
6
6
|
describe Puppet::Transaction::EventManager do
|
7
|
+
include PuppetSpec::Files
|
8
|
+
|
7
9
|
describe "at initialization" do
|
8
10
|
it "should require a transaction" do
|
9
11
|
Puppet::Transaction::EventManager.new("trans").transaction.should == "trans"
|
@@ -23,7 +25,7 @@ describe Puppet::Transaction::EventManager do
|
|
23
25
|
before do
|
24
26
|
@manager = Puppet::Transaction::EventManager.new(@transaction)
|
25
27
|
|
26
|
-
@resource = Puppet::Type.type(:file).new :path => "/my/file"
|
28
|
+
@resource = Puppet::Type.type(:file).new :path => make_absolute("/my/file")
|
27
29
|
|
28
30
|
@graph = stub 'graph', :matching_edges => [], :resource => @resource
|
29
31
|
@manager.stubs(:relationship_graph).returns @graph
|
@@ -139,7 +141,7 @@ describe Puppet::Transaction::EventManager do
|
|
139
141
|
@manager = Puppet::Transaction::EventManager.new(@transaction)
|
140
142
|
@manager.stubs(:queue_events)
|
141
143
|
|
142
|
-
@resource = Puppet::Type.type(:file).new :path => "/my/file"
|
144
|
+
@resource = Puppet::Type.type(:file).new :path => make_absolute("/my/file")
|
143
145
|
@event = Puppet::Transaction::Event.new(:name => :event, :resource => @resource)
|
144
146
|
end
|
145
147
|
|
@@ -4,6 +4,8 @@ require 'spec_helper'
|
|
4
4
|
require 'puppet/transaction/event'
|
5
5
|
|
6
6
|
describe Puppet::Transaction::Event do
|
7
|
+
include PuppetSpec::Files
|
8
|
+
|
7
9
|
[:previous_value, :desired_value, :property, :resource, :name, :message, :file, :line, :tags, :audited].each do |attr|
|
8
10
|
it "should support #{attr}", :'fails_on_ruby_1.9.2' => true do
|
9
11
|
event = Puppet::Transaction::Event.new
|
@@ -113,7 +115,7 @@ describe Puppet::Transaction::Event do
|
|
113
115
|
|
114
116
|
describe "When converting to YAML" do
|
115
117
|
it "should include only documented attributes" do
|
116
|
-
resource = Puppet::Type.type(:file).new(:title => "/tmp/foo")
|
118
|
+
resource = Puppet::Type.type(:file).new(:title => make_absolute("/tmp/foo"))
|
117
119
|
event = Puppet::Transaction::Event.new(:source_description => "/my/param", :resource => resource,
|
118
120
|
:file => "/foo.rb", :line => 27, :tags => %w{one two},
|
119
121
|
:desired_value => 7, :historical_value => 'Brazil',
|
@@ -103,10 +103,6 @@ describe Puppet::Transaction::Report do
|
|
103
103
|
report.expects(:host).returns "me"
|
104
104
|
report.name.should == "me"
|
105
105
|
end
|
106
|
-
|
107
|
-
after do
|
108
|
-
Puppet::Util::Cacher.expire
|
109
|
-
end
|
110
106
|
end
|
111
107
|
|
112
108
|
describe "when computing exit status" do
|
@@ -154,7 +150,7 @@ describe Puppet::Transaction::Report do
|
|
154
150
|
|
155
151
|
def add_statuses(count, type = :file)
|
156
152
|
count.times do |i|
|
157
|
-
status = Puppet::Resource::Status.new(Puppet::Type.type(type).new(:title => "/my/path#{i}"))
|
153
|
+
status = Puppet::Resource::Status.new(Puppet::Type.type(type).new(:title => make_absolute("/my/path#{i}")))
|
158
154
|
yield status if block_given?
|
159
155
|
@report.add_resource_status status
|
160
156
|
end
|
@@ -208,7 +204,7 @@ describe Puppet::Transaction::Report do
|
|
208
204
|
end
|
209
205
|
|
210
206
|
describe "for times" do
|
211
|
-
it "should provide the total amount of time for each resource type" do
|
207
|
+
it "should provide the total amount of time for each resource type", :fails_on_windows => true do
|
212
208
|
add_statuses(3, :file) do |status|
|
213
209
|
status.evaluation_time = 1
|
214
210
|
end
|
@@ -7,10 +7,14 @@ describe Puppet::Transaction::ResourceHarness do
|
|
7
7
|
include PuppetSpec::Files
|
8
8
|
|
9
9
|
before do
|
10
|
+
@mode_750 = Puppet.features.microsoft_windows? ? '644' : '750'
|
11
|
+
@mode_755 = Puppet.features.microsoft_windows? ? '644' : '755'
|
12
|
+
path = make_absolute("/my/file")
|
13
|
+
|
10
14
|
@transaction = Puppet::Transaction.new(Puppet::Resource::Catalog.new)
|
11
|
-
@resource = Puppet::Type.type(:file).new :path =>
|
15
|
+
@resource = Puppet::Type.type(:file).new :path => path
|
12
16
|
@harness = Puppet::Transaction::ResourceHarness.new(@transaction)
|
13
|
-
@current_state = Puppet::Resource.new(:file,
|
17
|
+
@current_state = Puppet::Resource.new(:file, path)
|
14
18
|
@resource.stubs(:retrieve).returns @current_state
|
15
19
|
@status = Puppet::Resource::Status.new(@resource)
|
16
20
|
Puppet::Resource::Status.stubs(:new).returns @status
|
@@ -148,8 +152,8 @@ describe Puppet::Transaction::ResourceHarness do
|
|
148
152
|
|
149
153
|
describe "when applying changes" do
|
150
154
|
[false, true].each do |noop_mode|; describe (noop_mode ? "in noop mode" : "in normal mode") do
|
151
|
-
[nil,
|
152
|
-
[nil,
|
155
|
+
[nil, @mode_750].each do |machine_state|; describe (machine_state ? "with a file initially present" : "with no file initially present") do
|
156
|
+
[nil, @mode_750, @mode_755].each do |yaml_mode|
|
153
157
|
[nil, :file, :absent].each do |yaml_ensure|; describe "with mode=#{yaml_mode.inspect} and ensure=#{yaml_ensure.inspect} stored in state.yml" do
|
154
158
|
[false, true].each do |auditing_ensure|
|
155
159
|
[false, true].each do |auditing_mode|
|
@@ -157,7 +161,7 @@ describe Puppet::Transaction::ResourceHarness do
|
|
157
161
|
auditing.push(:mode) if auditing_mode
|
158
162
|
auditing.push(:ensure) if auditing_ensure
|
159
163
|
[nil, :file, :absent].each do |ensure_property| # what we set "ensure" to in the manifest
|
160
|
-
[nil,
|
164
|
+
[nil, @mode_750, @mode_755].each do |mode_property| # what we set "mode" to in the manifest
|
161
165
|
manifest_settings = {}
|
162
166
|
manifest_settings[:audit] = auditing if !auditing.empty?
|
163
167
|
manifest_settings[:ensure] = ensure_property if ensure_property
|
@@ -11,8 +11,10 @@ def without_warnings
|
|
11
11
|
end
|
12
12
|
|
13
13
|
describe Puppet::Transaction do
|
14
|
+
include PuppetSpec::Files
|
15
|
+
|
14
16
|
before do
|
15
|
-
@basepath =
|
17
|
+
@basepath = make_absolute("/what/ever")
|
16
18
|
@transaction = Puppet::Transaction.new(Puppet::Resource::Catalog.new)
|
17
19
|
end
|
18
20
|
|
data/spec/unit/type/cron_spec.rb
CHANGED
data/spec/unit/type/exec_spec.rb
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
4
|
describe Puppet::Type.type(:exec) do
|
5
|
+
include PuppetSpec::Files
|
6
|
+
|
5
7
|
def exec_tester(command, exitstatus = 0, rest = {})
|
6
|
-
@user_name = 'some_user_name'
|
7
|
-
@group_name = 'some_group_name'
|
8
8
|
Puppet.features.stubs(:root?).returns(true)
|
9
9
|
|
10
10
|
output = rest.delete(:output) || ''
|
@@ -13,8 +13,6 @@ describe Puppet::Type.type(:exec) do
|
|
13
13
|
args = {
|
14
14
|
:name => command,
|
15
15
|
:path => @example_path,
|
16
|
-
:user => @user_name,
|
17
|
-
:group => @group_name,
|
18
16
|
:logoutput => false,
|
19
17
|
:loglevel => :err,
|
20
18
|
:returns => 0
|
@@ -24,24 +22,30 @@ describe Puppet::Type.type(:exec) do
|
|
24
22
|
|
25
23
|
status = stub "process", :exitstatus => exitstatus
|
26
24
|
Puppet::Util::SUIDManager.expects(:run_and_capture).times(tries).
|
27
|
-
with(
|
25
|
+
with(command, nil, nil).returns([output, status])
|
28
26
|
|
29
27
|
return exec
|
30
28
|
end
|
31
29
|
|
32
30
|
before do
|
33
|
-
@command =
|
31
|
+
@command = make_absolute('/bin/true whatever')
|
32
|
+
@executable = make_absolute('/bin/true')
|
33
|
+
@bogus_cmd = make_absolute('/bogus/cmd')
|
34
34
|
end
|
35
35
|
|
36
36
|
describe "when not stubbing the provider" do
|
37
37
|
before do
|
38
|
-
|
39
|
-
File.
|
40
|
-
File.
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
38
|
+
path = tmpdir('path')
|
39
|
+
true_cmd = File.join(path, 'true')
|
40
|
+
false_cmd = File.join(path, 'false')
|
41
|
+
|
42
|
+
FileUtils.touch(true_cmd)
|
43
|
+
FileUtils.touch(false_cmd)
|
44
|
+
|
45
|
+
File.chmod(0755, true_cmd)
|
46
|
+
File.chmod(0755, false_cmd)
|
47
|
+
|
48
|
+
@example_path = [path]
|
45
49
|
end
|
46
50
|
|
47
51
|
it "should return :executed_command as its event" do
|
@@ -140,10 +144,11 @@ describe Puppet::Type.type(:exec) do
|
|
140
144
|
end
|
141
145
|
|
142
146
|
it "should be able to autorequire files mentioned in the command" do
|
147
|
+
foo = make_absolute('/bin/foo')
|
143
148
|
catalog = Puppet::Resource::Catalog.new
|
144
|
-
tmp = Puppet::Type.type(:file).new(:name =>
|
149
|
+
tmp = Puppet::Type.type(:file).new(:name => foo)
|
145
150
|
catalog.add_resource tmp
|
146
|
-
execer = Puppet::Type.type(:exec).new(:name =>
|
151
|
+
execer = Puppet::Type.type(:exec).new(:name => foo)
|
147
152
|
catalog.add_resource execer
|
148
153
|
|
149
154
|
catalog.relationship_graph.dependencies(execer).should == [tmp]
|
@@ -151,21 +156,37 @@ describe Puppet::Type.type(:exec) do
|
|
151
156
|
|
152
157
|
describe "when handling the path parameter" do
|
153
158
|
expect = %w{one two three four}
|
154
|
-
{ "an array"
|
155
|
-
"a
|
156
|
-
"
|
157
|
-
"both array and colon lists" => ["one", "two:three", "four"],
|
158
|
-
"both array and semi-colon lists" => ["one", "two;three", "four"],
|
159
|
-
"colon and semi-colon lists" => ["one:two", "three;four"]
|
159
|
+
{ "an array" => expect,
|
160
|
+
"a path-separator delimited list" => expect.join(File::PATH_SEPARATOR),
|
161
|
+
"both array and path-separator delimited lists" => ["one", "two#{File::PATH_SEPARATOR}three", "four"],
|
160
162
|
}.each do |test, input|
|
161
163
|
it "should accept #{test}" do
|
162
164
|
type = Puppet::Type.type(:exec).new(:name => @command, :path => input)
|
163
165
|
type[:path].should == expect
|
164
166
|
end
|
165
167
|
end
|
168
|
+
|
169
|
+
describe "on platforms where path separator is not :" do
|
170
|
+
before :each do
|
171
|
+
@old_verbosity = $VERBOSE
|
172
|
+
$VERBOSE = nil
|
173
|
+
@old_separator = File::PATH_SEPARATOR
|
174
|
+
File::PATH_SEPARATOR = 'q'
|
175
|
+
end
|
176
|
+
|
177
|
+
after :each do
|
178
|
+
File::PATH_SEPARATOR = @old_separator
|
179
|
+
$VERBOSE = @old_verbosity
|
180
|
+
end
|
181
|
+
|
182
|
+
it "should use the path separator of the current platform" do
|
183
|
+
type = Puppet::Type.type(:exec).new(:name => @command, :path => "fooqbarqbaz")
|
184
|
+
type[:path].should == %w[foo bar baz]
|
185
|
+
end
|
186
|
+
end
|
166
187
|
end
|
167
188
|
|
168
|
-
describe "when setting user" do
|
189
|
+
describe "when setting user", :fails_on_windows => true do
|
169
190
|
it "should fail if we are not root" do
|
170
191
|
Puppet.features.stubs(:root?).returns(false)
|
171
192
|
expect { Puppet::Type.type(:exec).new(:name => @command, :user => 'input') }.
|
@@ -184,7 +205,7 @@ describe Puppet::Type.type(:exec) do
|
|
184
205
|
describe "when setting group" do
|
185
206
|
shared_examples_for "exec[:group]" do
|
186
207
|
['one', 2, 'wheel', 4294967295, 4294967296].each do |value|
|
187
|
-
it "should accept '#{value}' without error or judgement" do
|
208
|
+
it "should accept '#{value}' without error or judgement", :fails_on_windows => true do
|
188
209
|
type = Puppet::Type.type(:exec).new(:name => @command, :group => value)
|
189
210
|
type[:group].should == value
|
190
211
|
end
|
@@ -205,7 +226,8 @@ describe Puppet::Type.type(:exec) do
|
|
205
226
|
describe "when setting cwd" do
|
206
227
|
it_should_behave_like "all path parameters", :cwd, :array => false do
|
207
228
|
def instance(path)
|
208
|
-
|
229
|
+
# Specify shell provider so we don't have to care about command validation
|
230
|
+
Puppet::Type.type(:exec).new(:name => @executable, :cwd => path, :provider => :shell)
|
209
231
|
end
|
210
232
|
end
|
211
233
|
end
|
@@ -221,7 +243,7 @@ describe Puppet::Type.type(:exec) do
|
|
221
243
|
if @param == :name then
|
222
244
|
instance = Puppet::Type.type(:exec).new()
|
223
245
|
else
|
224
|
-
instance = Puppet::Type.type(:exec).new(:name =>
|
246
|
+
instance = Puppet::Type.type(:exec).new(:name => @executable)
|
225
247
|
end
|
226
248
|
if valid then
|
227
249
|
instance.provider.expects(:validatecmd).returns(true)
|
@@ -246,7 +268,7 @@ describe Puppet::Type.type(:exec) do
|
|
246
268
|
shared_examples_for "all exec command parameters that take arrays" do |param|
|
247
269
|
describe "when given an array of inputs" do
|
248
270
|
before :each do
|
249
|
-
@test = Puppet::Type.type(:exec).new(:name =>
|
271
|
+
@test = Puppet::Type.type(:exec).new(:name => @executable)
|
250
272
|
end
|
251
273
|
|
252
274
|
it "should accept the array when all commands return valid" do
|
@@ -281,7 +303,7 @@ describe Puppet::Type.type(:exec) do
|
|
281
303
|
|
282
304
|
describe "for simple parameters" do
|
283
305
|
before :each do
|
284
|
-
@exec = Puppet::Type.type(:exec).new(:name =>
|
306
|
+
@exec = Puppet::Type.type(:exec).new(:name => @executable)
|
285
307
|
end
|
286
308
|
|
287
309
|
describe "when setting environment" do
|
@@ -330,21 +352,30 @@ describe Puppet::Type.type(:exec) do
|
|
330
352
|
end
|
331
353
|
end
|
332
354
|
|
333
|
-
it "should fail if timeout is exceeded" do
|
334
|
-
|
335
|
-
|
355
|
+
it "should fail if timeout is exceeded", :fails_on_windows => true do
|
356
|
+
Puppet::Util.stubs(:execute).with do |cmd,args|
|
357
|
+
sleep 1
|
358
|
+
true
|
359
|
+
end
|
360
|
+
FileTest.stubs(:file?).returns(false)
|
361
|
+
FileTest.stubs(:file?).with('/bin/sleep').returns(true)
|
362
|
+
FileTest.stubs(:executable?).returns(false)
|
363
|
+
FileTest.stubs(:executable?).with('/bin/sleep').returns(true)
|
336
364
|
sleep_exec = Puppet::Type.type(:exec).new(:name => 'sleep 1', :path => ['/bin'], :timeout => '0.2')
|
365
|
+
|
337
366
|
lambda { sleep_exec.refresh }.should raise_error Puppet::Error, "Command exceeded timeout"
|
338
367
|
end
|
339
368
|
|
340
369
|
it "should convert timeout to a float" do
|
341
|
-
|
370
|
+
command = make_absolute('/bin/false')
|
371
|
+
resource = Puppet::Type.type(:exec).new :command => command, :timeout => "12"
|
342
372
|
resource[:timeout].should be_a(Float)
|
343
373
|
resource[:timeout].should == 12.0
|
344
374
|
end
|
345
375
|
|
346
376
|
it "should munge negative timeouts to 0.0" do
|
347
|
-
|
377
|
+
command = make_absolute('/bin/false')
|
378
|
+
resource = Puppet::Type.type(:exec).new :command => command, :timeout => "-12.0"
|
348
379
|
resource.parameter(:timeout).value.should be_a(Float)
|
349
380
|
resource.parameter(:timeout).value.should == 0.0
|
350
381
|
end
|
@@ -442,7 +473,8 @@ describe Puppet::Type.type(:exec) do
|
|
442
473
|
describe "when setting creates" do
|
443
474
|
it_should_behave_like "all path parameters", :creates, :array => true do
|
444
475
|
def instance(path)
|
445
|
-
|
476
|
+
# Specify shell provider so we don't have to care about command validation
|
477
|
+
Puppet::Type.type(:exec).new(:name => @executable, :creates => path, :provider => :shell)
|
446
478
|
end
|
447
479
|
end
|
448
480
|
end
|
@@ -460,7 +492,7 @@ describe Puppet::Type.type(:exec) do
|
|
460
492
|
|
461
493
|
describe "#check" do
|
462
494
|
before :each do
|
463
|
-
@test = Puppet::Type.type(:exec).new(:name =>
|
495
|
+
@test = Puppet::Type.type(:exec).new(:name => @executable)
|
464
496
|
end
|
465
497
|
|
466
498
|
describe ":refreshonly" do
|
@@ -473,10 +505,10 @@ describe Puppet::Type.type(:exec) do
|
|
473
505
|
end
|
474
506
|
|
475
507
|
describe ":creates" do
|
476
|
-
before :
|
477
|
-
@exist =
|
478
|
-
@
|
479
|
-
|
508
|
+
before :each do
|
509
|
+
@exist = tmpfile('exist')
|
510
|
+
FileUtils.touch(@exist)
|
511
|
+
@unexist = tmpfile('unexist')
|
480
512
|
end
|
481
513
|
|
482
514
|
context "with a single item" do
|
@@ -525,8 +557,8 @@ describe Puppet::Type.type(:exec) do
|
|
525
557
|
}.each do |param, sense|
|
526
558
|
describe ":#{param}" do
|
527
559
|
before :each do
|
528
|
-
@pass = "/magic/pass"
|
529
|
-
@fail = "/magic/fail"
|
560
|
+
@pass = make_absolute("/magic/pass")
|
561
|
+
@fail = make_absolute("/magic/fail")
|
530
562
|
|
531
563
|
@pass_status = stub('status', :exitstatus => sense[:pass] ? 0 : 1)
|
532
564
|
@fail_status = stub('status', :exitstatus => sense[:fail] ? 0 : 1)
|
@@ -584,9 +616,9 @@ describe Puppet::Type.type(:exec) do
|
|
584
616
|
end
|
585
617
|
end
|
586
618
|
|
587
|
-
describe "#retrieve" do
|
619
|
+
describe "#retrieve", :fails_on_windows => true do
|
588
620
|
before :each do
|
589
|
-
@exec_resource = Puppet::Type.type(:exec).new(:name =>
|
621
|
+
@exec_resource = Puppet::Type.type(:exec).new(:name => @bogus_cmd)
|
590
622
|
end
|
591
623
|
|
592
624
|
it "should return :notrun when check_all_attributes returns true" do
|
@@ -608,7 +640,7 @@ describe Puppet::Type.type(:exec) do
|
|
608
640
|
|
609
641
|
describe "#output" do
|
610
642
|
before :each do
|
611
|
-
@exec_resource = Puppet::Type.type(:exec).new(:name =>
|
643
|
+
@exec_resource = Puppet::Type.type(:exec).new(:name => @bogus_cmd)
|
612
644
|
end
|
613
645
|
|
614
646
|
it "should return the provider's run output" do
|
@@ -625,14 +657,15 @@ describe Puppet::Type.type(:exec) do
|
|
625
657
|
|
626
658
|
describe "#refresh" do
|
627
659
|
before :each do
|
628
|
-
@exec_resource = Puppet::Type.type(:exec).new(:name =>
|
660
|
+
@exec_resource = Puppet::Type.type(:exec).new(:name => @bogus_cmd)
|
629
661
|
end
|
630
662
|
|
631
663
|
it "should call provider run with the refresh parameter if it is set" do
|
664
|
+
myother_bogus_cmd = make_absolute('/myother/bogus/cmd')
|
632
665
|
provider = stub 'provider'
|
633
666
|
@exec_resource.stubs(:provider).returns(provider)
|
634
|
-
@exec_resource.stubs(:[]).with(:refresh).returns(
|
635
|
-
provider.expects(:run).with(
|
667
|
+
@exec_resource.stubs(:[]).with(:refresh).returns(myother_bogus_cmd)
|
668
|
+
provider.expects(:run).with(myother_bogus_cmd)
|
636
669
|
|
637
670
|
@exec_resource.refresh
|
638
671
|
end
|
@@ -641,7 +674,7 @@ describe Puppet::Type.type(:exec) do
|
|
641
674
|
provider = stub 'provider'
|
642
675
|
status = stubs "process_status"
|
643
676
|
status.stubs(:exitstatus).returns("0")
|
644
|
-
provider.expects(:run).with(
|
677
|
+
provider.expects(:run).with(@bogus_cmd).returns(["silly output", status])
|
645
678
|
@exec_resource.stubs(:provider).returns(provider)
|
646
679
|
|
647
680
|
@exec_resource.refresh
|
@@ -4,7 +4,8 @@ require 'spec_helper'
|
|
4
4
|
checksum = Puppet::Type.type(:file).attrclass(:checksum)
|
5
5
|
describe checksum do
|
6
6
|
before do
|
7
|
-
@
|
7
|
+
@path = Puppet.features.microsoft_windows? ? "c:/foo/bar" : "/foo/bar"
|
8
|
+
@resource = Puppet::Type.type(:file).new :path => @path
|
8
9
|
@checksum = @resource.parameter(:checksum)
|
9
10
|
end
|
10
11
|
|
@@ -35,25 +36,25 @@ describe checksum do
|
|
35
36
|
|
36
37
|
it "should use its current value when asked to sum a file's content" do
|
37
38
|
@checksum.value = :md5lite
|
38
|
-
@checksum.expects(:md5lite_file).with(
|
39
|
-
@checksum.sum_file(
|
39
|
+
@checksum.expects(:md5lite_file).with(@path).returns "yay"
|
40
|
+
@checksum.sum_file(@path)
|
40
41
|
end
|
41
42
|
|
42
43
|
it "should use :md5 to sum a file when no value is set" do
|
43
|
-
@checksum.expects(:md5_file).with(
|
44
|
-
@checksum.sum_file(
|
44
|
+
@checksum.expects(:md5_file).with(@path).returns "yay"
|
45
|
+
@checksum.sum_file(@path)
|
45
46
|
end
|
46
47
|
|
47
48
|
it "should convert all sums to strings when summing files" do
|
48
49
|
@checksum.value = :mtime
|
49
|
-
@checksum.expects(:mtime_file).with(
|
50
|
-
lambda { @checksum.sum_file(
|
50
|
+
@checksum.expects(:mtime_file).with(@path).returns Time.now
|
51
|
+
lambda { @checksum.sum_file(@path) }.should_not raise_error
|
51
52
|
end
|
52
53
|
|
53
54
|
it "should return the summed contents of a file with a checksum label" do
|
54
55
|
@resource[:checksum] = :md5
|
55
56
|
@checksum.expects(:md5_file).returns "mysum"
|
56
|
-
@checksum.sum_file(
|
57
|
+
@checksum.sum_file(@path).should == "{md5}mysum"
|
57
58
|
end
|
58
59
|
|
59
60
|
it "should return the summed contents of a stream with a checksum label" do
|