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
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env rspec
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
|
-
describe Puppet::Type.type(:group) do
|
4
|
+
describe Puppet::Type.type(:group), :fails_on_windows => true do
|
5
5
|
before do
|
6
6
|
ENV["PATH"] += File::PATH_SEPARATOR + "/usr/sbin" unless ENV["PATH"].split(File::PATH_SEPARATOR).include?("/usr/sbin")
|
7
7
|
@class = Puppet::Type.type(:group)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env rspec
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
|
-
describe Puppet::Type.type(:mount) do
|
4
|
+
describe Puppet::Type.type(:mount), :fails_on_windows => true do
|
5
5
|
it "should have a :refreshable feature that requires the :remount method" do
|
6
6
|
Puppet::Type.type(:mount).provider_feature(:refreshable).methods.should == [:remount]
|
7
7
|
end
|
@@ -16,7 +16,7 @@ describe Puppet::Type.type(:mount) do
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
describe Puppet::Type.type(:mount), "when validating attributes" do
|
19
|
+
describe Puppet::Type.type(:mount), "when validating attributes", :fails_on_windows => true do
|
20
20
|
[:name, :remounts, :provider].each do |param|
|
21
21
|
it "should have a #{param} parameter" do
|
22
22
|
Puppet::Type.type(:mount).attrtype(param).should == :param
|
@@ -30,7 +30,7 @@ describe Puppet::Type.type(:mount), "when validating attributes" do
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
-
describe Puppet::Type.type(:mount)::Ensure, "when validating values" do
|
33
|
+
describe Puppet::Type.type(:mount)::Ensure, "when validating values", :fails_on_windows => true do
|
34
34
|
before do
|
35
35
|
@provider = stub 'provider', :class => Puppet::Type.type(:mount).defaultprovider, :clear => nil
|
36
36
|
Puppet::Type.type(:mount).defaultprovider.expects(:new).returns(@provider)
|
@@ -62,7 +62,7 @@ describe Puppet::Type.type(:mount)::Ensure, "when validating values" do
|
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
|
-
describe Puppet::Type.type(:mount)::Ensure do
|
65
|
+
describe Puppet::Type.type(:mount)::Ensure, :fails_on_windows => true do
|
66
66
|
before :each do
|
67
67
|
provider_properties = {}
|
68
68
|
@provider = stub 'provider', :class => Puppet::Type.type(:mount).defaultprovider, :clear => nil, :satisfies? => true, :name => :mock, :property_hash => provider_properties
|
@@ -279,7 +279,7 @@ describe Puppet::Type.type(:mount)::Ensure do
|
|
279
279
|
end
|
280
280
|
end
|
281
281
|
|
282
|
-
describe Puppet::Type.type(:mount), "when modifying an existing mount entry" do
|
282
|
+
describe Puppet::Type.type(:mount), "when modifying an existing mount entry", :fails_on_windows => true do
|
283
283
|
before do
|
284
284
|
@provider = stub 'provider', :class => Puppet::Type.type(:mount).defaultprovider, :clear => nil, :satisfies? => true, :name => :mock, :remount => nil
|
285
285
|
Puppet::Type.type(:mount).defaultprovider.stubs(:new).returns(@provider)
|
@@ -4,9 +4,11 @@ require 'spec_helper'
|
|
4
4
|
require 'puppet/type'
|
5
5
|
|
6
6
|
describe Puppet::Type.type(:file).attrclass(:noop) do
|
7
|
+
include PuppetSpec::Files
|
8
|
+
|
7
9
|
before do
|
8
10
|
Puppet.settings.stubs(:use)
|
9
|
-
@file = Puppet::Type.newfile :path => "/what/ever"
|
11
|
+
@file = Puppet::Type.newfile :path => make_absolute("/what/ever")
|
10
12
|
end
|
11
13
|
|
12
14
|
it "should accept true as a value" do
|
@@ -27,7 +27,7 @@ describe Puppet::Type.type(:package) do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
it "should default to being installed" do
|
30
|
-
pkg = Puppet::Type.type(:package).new(:name => "yay")
|
30
|
+
pkg = Puppet::Type.type(:package).new(:name => "yay", :provider => :apt)
|
31
31
|
pkg.should(:ensure).should == :present
|
32
32
|
end
|
33
33
|
|
@@ -45,7 +45,12 @@ describe Puppet::Type.type(:package) do
|
|
45
45
|
|
46
46
|
describe "when validating attribute values" do
|
47
47
|
before do
|
48
|
-
@provider = stub
|
48
|
+
@provider = stub(
|
49
|
+
'provider',
|
50
|
+
:class => Puppet::Type.type(:package).defaultprovider,
|
51
|
+
:clear => nil,
|
52
|
+
:validate_source => nil
|
53
|
+
)
|
49
54
|
Puppet::Type.type(:package).defaultprovider.expects(:new).returns(@provider)
|
50
55
|
end
|
51
56
|
|
@@ -105,7 +110,14 @@ describe Puppet::Type.type(:package) do
|
|
105
110
|
|
106
111
|
describe Puppet::Type.type(:package) do
|
107
112
|
before :each do
|
108
|
-
@provider = stub
|
113
|
+
@provider = stub(
|
114
|
+
'provider',
|
115
|
+
:class => Puppet::Type.type(:package).defaultprovider,
|
116
|
+
:clear => nil,
|
117
|
+
:satisfies? => true,
|
118
|
+
:name => :mock,
|
119
|
+
:validate_source => nil
|
120
|
+
)
|
109
121
|
Puppet::Type.type(:package).defaultprovider.stubs(:new).returns(@provider)
|
110
122
|
Puppet::Type.type(:package).defaultprovider.stubs(:instances).returns([])
|
111
123
|
@package = Puppet::Type.type(:package).new(:name => "yay")
|
@@ -51,7 +51,7 @@ describe resources do
|
|
51
51
|
@resources.generate.collect { |r| r.ref }.should_not include(@host1.ref)
|
52
52
|
end
|
53
53
|
|
54
|
-
it "should not include the skipped users", :'fails_on_ruby_1.9.2' => true do
|
54
|
+
it "should not include the skipped users", :'fails_on_ruby_1.9.2' => true, :fails_on_windows => true do
|
55
55
|
res = Puppet::Type.type(:resources).new :name => :user, :purge => true
|
56
56
|
res.catalog = Puppet::Resource::Catalog.new
|
57
57
|
|
@@ -72,7 +72,7 @@ describe resources do
|
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
|
-
describe "when the instance's do not have an ensure property" do
|
75
|
+
describe "when the instance's do not have an ensure property", :fails_on_windows => true do
|
76
76
|
it "should not be included in the generated resources" do
|
77
77
|
@no_ensure_resource = Puppet::Type.type(:exec).new(:name => '/usr/bin/env echo')
|
78
78
|
Puppet::Type.type(:host).stubs(:instances).returns [@no_ensure_resource]
|
@@ -57,6 +57,21 @@ describe Puppet::Type.type(:service), "when validating attribute values" do
|
|
57
57
|
Puppet::Type.type(:service).new(:name => "yay", :enable => :false)
|
58
58
|
end
|
59
59
|
|
60
|
+
it "should support :manual as a value to :enable on Windows" do
|
61
|
+
Puppet.features.stubs(:microsoft_windows?).returns true
|
62
|
+
|
63
|
+
Puppet::Type.type(:service).new(:name => "yay", :enable => :manual)
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should not support :manual as a value to :enable when not on Windows" do
|
67
|
+
Puppet.features.stubs(:microsoft_windows?).returns false
|
68
|
+
|
69
|
+
expect { Puppet::Type.type(:service).new(:name => "yay", :enable => :manual) }.to raise_error(
|
70
|
+
Puppet::Error,
|
71
|
+
/Setting enable to manual is only supported on Microsoft Windows\./
|
72
|
+
)
|
73
|
+
end
|
74
|
+
|
60
75
|
it "should support :true as a value to :hasstatus" do
|
61
76
|
Puppet::Type.type(:service).new(:name => "yay", :hasstatus => :true)
|
62
77
|
end
|
@@ -91,17 +106,17 @@ describe Puppet::Type.type(:service), "when validating attribute values" do
|
|
91
106
|
svc.should(:enable).should be_nil
|
92
107
|
end
|
93
108
|
|
94
|
-
it "should split paths on '
|
109
|
+
it "should split paths on '#{File::PATH_SEPARATOR}'" do
|
95
110
|
FileTest.stubs(:exist?).returns(true)
|
96
111
|
FileTest.stubs(:directory?).returns(true)
|
97
|
-
svc = Puppet::Type.type(:service).new(:name => "yay", :path => "/one/two
|
112
|
+
svc = Puppet::Type.type(:service).new(:name => "yay", :path => "/one/two#{File::PATH_SEPARATOR}/three/four")
|
98
113
|
svc[:path].should == %w{/one/two /three/four}
|
99
114
|
end
|
100
115
|
|
101
|
-
it "should accept arrays of paths joined by '
|
116
|
+
it "should accept arrays of paths joined by '#{File::PATH_SEPARATOR}'" do
|
102
117
|
FileTest.stubs(:exist?).returns(true)
|
103
118
|
FileTest.stubs(:directory?).returns(true)
|
104
|
-
svc = Puppet::Type.type(:service).new(:name => "yay", :path => ["/one
|
119
|
+
svc = Puppet::Type.type(:service).new(:name => "yay", :path => ["/one#{File::PATH_SEPARATOR}/two", "/three#{File::PATH_SEPARATOR}/four"])
|
105
120
|
svc[:path].should == %w{/one /two /three /four}
|
106
121
|
end
|
107
122
|
end
|
@@ -3,7 +3,9 @@ require 'spec_helper'
|
|
3
3
|
|
4
4
|
ssh_authorized_key = Puppet::Type.type(:ssh_authorized_key)
|
5
5
|
|
6
|
-
describe ssh_authorized_key do
|
6
|
+
describe ssh_authorized_key, :unless => Puppet.features.microsoft_windows? do
|
7
|
+
include PuppetSpec::Files
|
8
|
+
|
7
9
|
before do
|
8
10
|
@class = Puppet::Type.type(:ssh_authorized_key)
|
9
11
|
|
@@ -11,7 +13,7 @@ describe ssh_authorized_key do
|
|
11
13
|
@class.stubs(:defaultprovider).returns(@provider_class)
|
12
14
|
@class.stubs(:provider).returns(@provider_class)
|
13
15
|
|
14
|
-
@provider = stub 'provider', :class => @provider_class, :file_path => "/tmp/whatever", :clear => nil
|
16
|
+
@provider = stub 'provider', :class => @provider_class, :file_path => make_absolute("/tmp/whatever"), :clear => nil
|
15
17
|
@provider_class.stubs(:new).returns(@provider)
|
16
18
|
@catalog = Puppet::Resource::Catalog.new
|
17
19
|
end
|
@@ -134,6 +136,10 @@ describe ssh_authorized_key do
|
|
134
136
|
proc { @class.new(:name => "whev", :type => :rsa, :user => "nobody", :options => 'command="command"')}.should_not raise_error
|
135
137
|
end
|
136
138
|
|
139
|
+
it "should support key-value pairs where value consist of multiple items" do
|
140
|
+
proc { @class.new(:name => "whev", :type => :rsa, :user => "nobody", :options => 'from="*.domain1,host1.domain2"')}.should_not raise_error
|
141
|
+
end
|
142
|
+
|
137
143
|
it "should support environments as options" do
|
138
144
|
proc { @class.new(:name => "whev", :type => :rsa, :user => "nobody", :options => 'environment="NAME=value"')}.should_not raise_error
|
139
145
|
end
|
@@ -142,7 +148,7 @@ describe ssh_authorized_key do
|
|
142
148
|
proc { @class.new(:name => "whev", :type => :rsa, :user => "nobody", :options => ['cert-authority','environment="NAME=value"'])}.should_not raise_error
|
143
149
|
end
|
144
150
|
|
145
|
-
it "should not support a comma separated
|
151
|
+
it "should not support a comma separated list" do
|
146
152
|
proc { @class.new(:name => "whev", :type => :rsa, :user => "nobody", :options => 'cert-authority,no-port-forwarding')}.should raise_error(Puppet::Error, /must be provided as an array/)
|
147
153
|
end
|
148
154
|
|
@@ -155,7 +161,7 @@ describe ssh_authorized_key do
|
|
155
161
|
resource.property(:options).is_to_s(["a","b","c"]).should == "a,b,c"
|
156
162
|
end
|
157
163
|
|
158
|
-
it "property should return well formed string of arrays from
|
164
|
+
it "property should return well formed string of arrays from should_to_s" do
|
159
165
|
resource = @class.new(:name => "whev", :type => :rsa, :user => "nobody", :options => ["a","b","c"])
|
160
166
|
resource.property(:options).should_to_s(["a","b","c"]).should == "a,b,c"
|
161
167
|
end
|
data/spec/unit/type/tidy_spec.rb
CHANGED
@@ -5,8 +5,10 @@ require 'puppet/file_bucket/dipper'
|
|
5
5
|
tidy = Puppet::Type.type(:tidy)
|
6
6
|
|
7
7
|
describe tidy do
|
8
|
+
include PuppetSpec::Files
|
9
|
+
|
8
10
|
before do
|
9
|
-
@basepath =
|
11
|
+
@basepath = make_absolute("/what/ever")
|
10
12
|
Puppet.settings.stubs(:use)
|
11
13
|
|
12
14
|
# for an unknown reason some of these specs fails when run individually
|
data/spec/unit/type/user_spec.rb
CHANGED
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
|
4
4
|
user = Puppet::Type.type(:user)
|
5
5
|
|
6
|
-
describe user do
|
6
|
+
describe user, :fails_on_windows => true do
|
7
7
|
before do
|
8
8
|
ENV["PATH"] += File::PATH_SEPARATOR + "/usr/sbin" unless ENV["PATH"].split(File::PATH_SEPARATOR).include?("/usr/sbin")
|
9
9
|
@provider = stub 'provider'
|
data/spec/unit/type_spec.rb
CHANGED
@@ -1,10 +1,8 @@
|
|
1
1
|
#!/usr/bin/env rspec
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
|
-
describe Puppet::Type do
|
5
|
-
|
6
|
-
Puppet::Type.ancestors.should be_include(Puppet::Util::Cacher)
|
7
|
-
end
|
4
|
+
describe Puppet::Type, :fails_on_windows => true do
|
5
|
+
include PuppetSpec::Files
|
8
6
|
|
9
7
|
it "should consider a parameter to be valid if it is a valid parameter" do
|
10
8
|
Puppet::Type.type(:mount).should be_valid_parameter(:path)
|
@@ -18,18 +16,6 @@ describe Puppet::Type do
|
|
18
16
|
Puppet::Type.type(:mount).should be_valid_parameter(:noop)
|
19
17
|
end
|
20
18
|
|
21
|
-
it "should use its catalog as its expirer" do
|
22
|
-
catalog = Puppet::Resource::Catalog.new
|
23
|
-
resource = Puppet::Type.type(:mount).new(:name => "foo", :fstype => "bar", :pass => 1, :ensure => :present)
|
24
|
-
resource.catalog = catalog
|
25
|
-
resource.expirer.should equal(catalog)
|
26
|
-
end
|
27
|
-
|
28
|
-
it "should do nothing when asked to expire when it has no catalog" do
|
29
|
-
resource = Puppet::Type.type(:mount).new(:name => "foo", :fstype => "bar", :pass => 1, :ensure => :present)
|
30
|
-
lambda { resource.expire }.should_not raise_error
|
31
|
-
end
|
32
|
-
|
33
19
|
it "should be able to retrieve a property by name" do
|
34
20
|
resource = Puppet::Type.type(:mount).new(:name => "foo", :fstype => "bar", :pass => 1, :ensure => :present)
|
35
21
|
resource.property(:fstype).must be_instance_of(Puppet::Type.type(:mount).attrclass(:fstype))
|
@@ -309,7 +295,8 @@ describe Puppet::Type do
|
|
309
295
|
end
|
310
296
|
|
311
297
|
it "should use the Resource Type's namevar to determine how to find the name in the hash" do
|
312
|
-
|
298
|
+
yay = make_absolute('/yay')
|
299
|
+
Puppet::Type.type(:file).new(:path => yay).title.should == yay
|
313
300
|
end
|
314
301
|
|
315
302
|
[:catalog].each do |param|
|
@@ -373,11 +360,11 @@ describe Puppet::Type do
|
|
373
360
|
end
|
374
361
|
|
375
362
|
# This one is really hard to test :/
|
376
|
-
it "should each default immediately if no value is provided" do
|
363
|
+
it "should set each default immediately if no value is provided" do
|
377
364
|
defaults = []
|
378
|
-
Puppet::Type.type(:
|
365
|
+
Puppet::Type.type(:service).any_instance.stubs(:set_default).with { |value| defaults << value; true }
|
379
366
|
|
380
|
-
Puppet::Type.type(:
|
367
|
+
Puppet::Type.type(:service).new :name => "whatever"
|
381
368
|
|
382
369
|
defaults[0].should == :provider
|
383
370
|
end
|
@@ -387,7 +374,7 @@ describe Puppet::Type do
|
|
387
374
|
end
|
388
375
|
|
389
376
|
it "should delete the name via the namevar from the originally provided parameters" do
|
390
|
-
Puppet::Type.type(:file).new(:name =>
|
377
|
+
Puppet::Type.type(:file).new(:name => make_absolute('/foo')).original_parameters[:path].should be_nil
|
391
378
|
end
|
392
379
|
end
|
393
380
|
|
@@ -471,7 +458,7 @@ describe Puppet::Type do
|
|
471
458
|
end
|
472
459
|
|
473
460
|
it "should provide a value for 'ensure' even if no desired value is provided" do
|
474
|
-
@resource = Puppet::Type.type(:file).new(:path => "/my/file/that/can't/exist")
|
461
|
+
@resource = Puppet::Type.type(:file).new(:path => make_absolute("/my/file/that/can't/exist"))
|
475
462
|
end
|
476
463
|
|
477
464
|
it "should not call retrieve on non-ensure properties if the resource is absent and should consider the property absent" do
|
@@ -513,8 +500,8 @@ describe Puppet::Type do
|
|
513
500
|
before do
|
514
501
|
@catalog = Puppet::Resource::Catalog.new
|
515
502
|
@container = Puppet::Type.type(:component).new(:name => "container")
|
516
|
-
@one = Puppet::Type.type(:file).new(:path => "/file/one")
|
517
|
-
@two = Puppet::Type.type(:file).new(:path => "/file/two")
|
503
|
+
@one = Puppet::Type.type(:file).new(:path => make_absolute("/file/one"))
|
504
|
+
@two = Puppet::Type.type(:file).new(:path => make_absolute("/file/two"))
|
518
505
|
|
519
506
|
@catalog.add_resource @container
|
520
507
|
@catalog.add_resource @one
|
@@ -541,7 +528,9 @@ describe Puppet::Type do
|
|
541
528
|
end
|
542
529
|
end
|
543
530
|
|
544
|
-
describe Puppet::Type::RelationshipMetaparam do
|
531
|
+
describe Puppet::Type::RelationshipMetaparam, :fails_on_windows => true do
|
532
|
+
include PuppetSpec::Files
|
533
|
+
|
545
534
|
it "should be a subclass of Puppet::Parameter" do
|
546
535
|
Puppet::Type::RelationshipMetaparam.superclass.should equal(Puppet::Parameter)
|
547
536
|
end
|
@@ -550,14 +539,15 @@ describe Puppet::Type::RelationshipMetaparam do
|
|
550
539
|
Puppet::Type::RelationshipMetaparam.should respond_to(:subclasses)
|
551
540
|
end
|
552
541
|
|
553
|
-
describe "when munging relationships" do
|
542
|
+
describe "when munging relationships", :'fails_on_windows' => true do
|
554
543
|
before do
|
555
|
-
@
|
544
|
+
@path = make_absolute('/foo')
|
545
|
+
@resource = Puppet::Type.type(:mount).new :name => @path
|
556
546
|
@metaparam = Puppet::Type.metaparamclass(:require).new :resource => @resource
|
557
547
|
end
|
558
548
|
|
559
549
|
it "should accept Puppet::Resource instances" do
|
560
|
-
ref = Puppet::Resource.new(:file,
|
550
|
+
ref = Puppet::Resource.new(:file, @path)
|
561
551
|
@metaparam.munge(ref)[0].should equal(ref)
|
562
552
|
end
|
563
553
|
|
@@ -585,18 +575,22 @@ describe Puppet::Type::RelationshipMetaparam do
|
|
585
575
|
end
|
586
576
|
end
|
587
577
|
|
588
|
-
describe Puppet::Type.metaparamclass(:check) do
|
578
|
+
describe Puppet::Type.metaparamclass(:check), :fails_on_windows => true do
|
579
|
+
include PuppetSpec::Files
|
580
|
+
|
589
581
|
it "should warn and create an instance of ':audit'" do
|
590
|
-
file = Puppet::Type.type(:file).new :path =>
|
582
|
+
file = Puppet::Type.type(:file).new :path => make_absolute('/foo')
|
591
583
|
file.expects(:warning)
|
592
584
|
file[:check] = :mode
|
593
585
|
file[:audit].should == [:mode]
|
594
586
|
end
|
595
587
|
end
|
596
588
|
|
597
|
-
describe Puppet::Type.metaparamclass(:audit) do
|
589
|
+
describe Puppet::Type.metaparamclass(:audit), :fails_on_windows => true do
|
590
|
+
include PuppetSpec::Files
|
591
|
+
|
598
592
|
before do
|
599
|
-
@resource = Puppet::Type.type(:file).new :path =>
|
593
|
+
@resource = Puppet::Type.type(:file).new :path => make_absolute('/foo')
|
600
594
|
end
|
601
595
|
|
602
596
|
it "should default to being nil" do
|
@@ -642,8 +636,9 @@ describe Puppet::Type.metaparamclass(:audit) do
|
|
642
636
|
Puppet::Type.type(:file).stubs(:title_patterns).returns(
|
643
637
|
[ [ /(.*)/, [ [:path, lambda{|x| x} ] ] ] ]
|
644
638
|
)
|
645
|
-
|
646
|
-
res.
|
639
|
+
myfile = make_absolute('/my/file')
|
640
|
+
res = Puppet::Type.type(:file).new( :title => myfile, :path => myfile, :owner => 'root', :content => 'hello' )
|
641
|
+
res.uniqueness_key.should == [ nil, 'root', myfile]
|
647
642
|
end
|
648
643
|
end
|
649
644
|
end
|
@@ -0,0 +1,202 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
require 'puppet/util/adsi'
|
6
|
+
|
7
|
+
describe Puppet::Util::ADSI do
|
8
|
+
let(:connection) { stub 'connection' }
|
9
|
+
|
10
|
+
before(:each) do
|
11
|
+
Puppet::Util::ADSI.instance_variable_set(:@computer_name, 'testcomputername')
|
12
|
+
Puppet::Util::ADSI.stubs(:connect).returns connection
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should generate the correct URI for a resource" do
|
16
|
+
Puppet::Util::ADSI.uri('test', 'user').should == "WinNT://testcomputername/test,user"
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should be able to get the name of the computer" do
|
20
|
+
Puppet::Util::ADSI.computer_name.should == 'testcomputername'
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should be able to provide the correct WinNT base URI for the computer" do
|
24
|
+
Puppet::Util::ADSI.computer_uri.should == "WinNT://testcomputername"
|
25
|
+
end
|
26
|
+
|
27
|
+
describe Puppet::Util::ADSI::User do
|
28
|
+
let(:username) { 'testuser' }
|
29
|
+
|
30
|
+
it "should generate the correct URI" do
|
31
|
+
Puppet::Util::ADSI::User.uri(username).should == "WinNT://testcomputername/#{username},user"
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should be able to create a user" do
|
35
|
+
adsi_user = stub('adsi')
|
36
|
+
|
37
|
+
connection.expects(:Create).with('user', username).returns(adsi_user)
|
38
|
+
|
39
|
+
user = Puppet::Util::ADSI::User.create(username)
|
40
|
+
|
41
|
+
user.should be_a(Puppet::Util::ADSI::User)
|
42
|
+
user.native_user.should == adsi_user
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should be able to check the existence of a user" do
|
46
|
+
Puppet::Util::ADSI.expects(:connect).with("WinNT://testcomputername/#{username},user").returns connection
|
47
|
+
Puppet::Util::ADSI::User.exists?(username).should be_true
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should be able to delete a user" do
|
51
|
+
connection.expects(:Delete).with('user', username)
|
52
|
+
|
53
|
+
Puppet::Util::ADSI::User.delete(username)
|
54
|
+
end
|
55
|
+
|
56
|
+
describe "an instance" do
|
57
|
+
let(:adsi_user) { stub 'user' }
|
58
|
+
let(:user) { Puppet::Util::ADSI::User.new(username, adsi_user) }
|
59
|
+
|
60
|
+
it "should provide its groups as a list of names" do
|
61
|
+
names = ["group1", "group2"]
|
62
|
+
|
63
|
+
groups = names.map { |name| mock('group', :Name => name) }
|
64
|
+
|
65
|
+
adsi_user.expects(:Groups).returns(groups)
|
66
|
+
|
67
|
+
user.groups.should =~ names
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should be able to test whether a given password is correct" do
|
71
|
+
Puppet::Util::ADSI::User.expects(:logon).with(username, 'pwdwrong').returns(false)
|
72
|
+
Puppet::Util::ADSI::User.expects(:logon).with(username, 'pwdright').returns(true)
|
73
|
+
|
74
|
+
user.password_is?('pwdwrong').should be_false
|
75
|
+
user.password_is?('pwdright').should be_true
|
76
|
+
end
|
77
|
+
|
78
|
+
it "should be able to set a password" do
|
79
|
+
adsi_user.expects(:SetPassword).with('pwd')
|
80
|
+
adsi_user.expects(:SetInfo).at_least_once
|
81
|
+
|
82
|
+
flagname = "UserFlags"
|
83
|
+
fADS_UF_DONT_EXPIRE_PASSWD = 0x10000
|
84
|
+
|
85
|
+
adsi_user.expects(:Get).with(flagname).returns(0)
|
86
|
+
adsi_user.expects(:Put).with(flagname, fADS_UF_DONT_EXPIRE_PASSWD)
|
87
|
+
|
88
|
+
user.password = 'pwd'
|
89
|
+
end
|
90
|
+
|
91
|
+
it "should generate the correct URI" do
|
92
|
+
user.uri.should == "WinNT://testcomputername/#{username},user"
|
93
|
+
end
|
94
|
+
|
95
|
+
describe "when given a set of groups to which to add the user" do
|
96
|
+
let(:groups_to_set) { 'group1,group2' }
|
97
|
+
|
98
|
+
before(:each) do
|
99
|
+
user.expects(:groups).returns ['group2', 'group3']
|
100
|
+
end
|
101
|
+
|
102
|
+
describe "if membership is specified as inclusive" do
|
103
|
+
it "should add the user to those groups, and remove it from groups not in the list" do
|
104
|
+
group1 = stub 'group1'
|
105
|
+
group1.expects(:Add).with("WinNT://testcomputername/#{username},user")
|
106
|
+
|
107
|
+
group3 = stub 'group1'
|
108
|
+
group3.expects(:Remove).with("WinNT://testcomputername/#{username},user")
|
109
|
+
|
110
|
+
Puppet::Util::ADSI.expects(:connect).with('WinNT://testcomputername/group1,group').returns group1
|
111
|
+
Puppet::Util::ADSI.expects(:connect).with('WinNT://testcomputername/group3,group').returns group3
|
112
|
+
|
113
|
+
user.set_groups(groups_to_set, false)
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
describe "if membership is specified as minimum" do
|
118
|
+
it "should add the user to the specified groups without affecting its other memberships" do
|
119
|
+
group1 = stub 'group1'
|
120
|
+
group1.expects(:Add).with("WinNT://testcomputername/#{username},user")
|
121
|
+
|
122
|
+
Puppet::Util::ADSI.expects(:connect).with('WinNT://testcomputername/group1,group').returns group1
|
123
|
+
|
124
|
+
user.set_groups(groups_to_set, true)
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
describe Puppet::Util::ADSI::Group do
|
132
|
+
let(:groupname) { 'testgroup' }
|
133
|
+
|
134
|
+
describe "an instance" do
|
135
|
+
let(:adsi_group) { stub 'group' }
|
136
|
+
let(:group) { Puppet::Util::ADSI::Group.new(groupname, adsi_group) }
|
137
|
+
|
138
|
+
it "should be able to add a member" do
|
139
|
+
adsi_group.expects(:Add).with("WinNT://testcomputername/someone,user")
|
140
|
+
|
141
|
+
group.add_member('someone')
|
142
|
+
end
|
143
|
+
|
144
|
+
it "should be able to remove a member" do
|
145
|
+
adsi_group.expects(:Remove).with("WinNT://testcomputername/someone,user")
|
146
|
+
|
147
|
+
group.remove_member('someone')
|
148
|
+
end
|
149
|
+
|
150
|
+
it "should provide its groups as a list of names" do
|
151
|
+
names = ['user1', 'user2']
|
152
|
+
|
153
|
+
users = names.map { |name| mock('user', :Name => name) }
|
154
|
+
|
155
|
+
adsi_group.expects(:Members).returns(users)
|
156
|
+
|
157
|
+
group.members.should =~ names
|
158
|
+
end
|
159
|
+
|
160
|
+
it "should be able to add a list of users to a group" do
|
161
|
+
names = ['user1', 'user2']
|
162
|
+
adsi_group.expects(:Members).returns names.map{|n| stub(:Name => n)}
|
163
|
+
|
164
|
+
adsi_group.expects(:Remove).with('WinNT://testcomputername/user1,user')
|
165
|
+
adsi_group.expects(:Add).with('WinNT://testcomputername/user3,user')
|
166
|
+
|
167
|
+
group.set_members(['user2', 'user3'])
|
168
|
+
end
|
169
|
+
|
170
|
+
it "should generate the correct URI" do
|
171
|
+
group.uri.should == "WinNT://testcomputername/#{groupname},group"
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
it "should generate the correct URI" do
|
176
|
+
Puppet::Util::ADSI::Group.uri("people").should == "WinNT://testcomputername/people,group"
|
177
|
+
end
|
178
|
+
|
179
|
+
it "should be able to create a group" do
|
180
|
+
adsi_group = stub("adsi")
|
181
|
+
|
182
|
+
connection.expects(:Create).with('group', groupname).returns(adsi_group)
|
183
|
+
|
184
|
+
group = Puppet::Util::ADSI::Group.create(groupname)
|
185
|
+
|
186
|
+
group.should be_a(Puppet::Util::ADSI::Group)
|
187
|
+
group.native_group.should == adsi_group
|
188
|
+
end
|
189
|
+
|
190
|
+
it "should be able to confirm the existence of a group" do
|
191
|
+
Puppet::Util::ADSI.expects(:connect).with("WinNT://testcomputername/#{groupname},group").returns connection
|
192
|
+
|
193
|
+
Puppet::Util::ADSI::Group.exists?(groupname).should be_true
|
194
|
+
end
|
195
|
+
|
196
|
+
it "should be able to delete a group" do
|
197
|
+
connection.expects(:Delete).with('group', groupname)
|
198
|
+
|
199
|
+
Puppet::Util::ADSI::Group.delete(groupname)
|
200
|
+
end
|
201
|
+
end
|
202
|
+
end
|
@@ -4,43 +4,47 @@ require 'spec_helper'
|
|
4
4
|
require 'puppet/util/autoload'
|
5
5
|
|
6
6
|
describe Puppet::Util::Autoload do
|
7
|
+
include PuppetSpec::Files
|
8
|
+
|
7
9
|
before do
|
8
10
|
@autoload = Puppet::Util::Autoload.new("foo", "tmp")
|
9
11
|
|
10
12
|
@autoload.stubs(:eachdir).yields "/my/dir"
|
11
13
|
end
|
12
14
|
|
13
|
-
it "should use the Cacher module" do
|
14
|
-
Puppet::Util::Autoload.ancestors.should be_include(Puppet::Util::Cacher)
|
15
|
-
end
|
16
|
-
|
17
15
|
describe "when building the search path" do
|
16
|
+
before :each do
|
17
|
+
@dira = make_absolute('/a')
|
18
|
+
@dirb = make_absolute('/b')
|
19
|
+
@dirc = make_absolute('/c')
|
20
|
+
end
|
21
|
+
|
18
22
|
it "should collect all of the plugins and lib directories that exist in the current environment's module path" do
|
19
23
|
Puppet.settings.expects(:value).with(:environment).returns "foo"
|
20
|
-
Puppet.settings.expects(:value).with(:modulepath, :foo).returns "
|
21
|
-
Dir.expects(:entries).with(
|
22
|
-
Dir.expects(:entries).with(
|
24
|
+
Puppet.settings.expects(:value).with(:modulepath, :foo).returns "#{@dira}#{File::PATH_SEPARATOR}#{@dirb}#{File::PATH_SEPARATOR}#{@dirc}"
|
25
|
+
Dir.expects(:entries).with(@dira).returns %w{one two}
|
26
|
+
Dir.expects(:entries).with(@dirb).returns %w{one two}
|
23
27
|
|
24
28
|
FileTest.stubs(:directory?).returns false
|
25
|
-
FileTest.expects(:directory?).with(
|
26
|
-
FileTest.expects(:directory?).with(
|
27
|
-
|
29
|
+
FileTest.expects(:directory?).with(@dira).returns true
|
30
|
+
FileTest.expects(:directory?).with(@dirb).returns true
|
31
|
+
["#{@dira}/one/plugins", "#{@dira}/two/lib", "#{@dirb}/one/plugins", "#{@dirb}/two/lib"].each do |d|
|
28
32
|
FileTest.expects(:directory?).with(d).returns true
|
29
33
|
end
|
30
34
|
|
31
|
-
@autoload.module_directories.should ==
|
35
|
+
@autoload.module_directories.should == ["#{@dira}/one/plugins", "#{@dira}/two/lib", "#{@dirb}/one/plugins", "#{@dirb}/two/lib"]
|
32
36
|
end
|
33
37
|
|
34
38
|
it "should not look for lib directories in directories starting with '.'" do
|
35
39
|
Puppet.settings.expects(:value).with(:environment).returns "foo"
|
36
|
-
Puppet.settings.expects(:value).with(:modulepath, :foo).returns
|
37
|
-
Dir.expects(:entries).with(
|
38
|
-
|
39
|
-
FileTest.expects(:directory?).with(
|
40
|
-
FileTest.expects(:directory?).with("
|
41
|
-
FileTest.expects(:directory?).with("
|
42
|
-
FileTest.expects(:directory?).with("
|
43
|
-
FileTest.expects(:directory?).with("
|
40
|
+
Puppet.settings.expects(:value).with(:modulepath, :foo).returns @dira
|
41
|
+
Dir.expects(:entries).with(@dira).returns %w{. ..}
|
42
|
+
|
43
|
+
FileTest.expects(:directory?).with(@dira).returns true
|
44
|
+
FileTest.expects(:directory?).with("#{@dira}/./lib").never
|
45
|
+
FileTest.expects(:directory?).with("#{@dira}/./plugins").never
|
46
|
+
FileTest.expects(:directory?).with("#{@dira}/../lib").never
|
47
|
+
FileTest.expects(:directory?).with("#{@dira}/../plugins").never
|
44
48
|
|
45
49
|
@autoload.module_directories
|
46
50
|
end
|