puppet 3.0.2 → 3.1.0.rc1
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/Gemfile +13 -11
- data/README.md +9 -7
- data/README_DEVELOPER.md +21 -30
- data/bin/extlookup2hiera +0 -0
- data/conf/auth.conf +42 -26
- data/conf/fileserver.conf +41 -0
- data/conf/tagmail.conf +16 -0
- data/examples/hiera/modules/data/manifests/common.pp +2 -1
- data/examples/hiera/modules/ntp/manifests/config.pp +4 -3
- data/examples/hiera/modules/ntp/manifests/data.pp +2 -1
- data/examples/hiera/modules/users/manifests/common.pp +2 -1
- data/examples/hiera/modules/users/manifests/dc1.pp +2 -1
- data/examples/hiera/modules/users/manifests/development.pp +2 -1
- data/examples/hiera/site.pp +1 -1
- data/ext/debian/fileserver.conf +39 -15
- data/ext/envpuppet +2 -0
- data/ext/gentoo/puppet/fileserver.conf +41 -12
- data/ext/ips/puppet-agent +1 -6
- data/ext/ips/puppetagent.xml +0 -4
- data/ext/osx/postflight.erb +109 -0
- data/ext/project_data.yaml +2 -2
- data/ext/redhat/fileserver.conf +41 -12
- data/ext/redhat/puppet.spec.erb +8 -13
- data/install.rb +2 -5
- data/lib/puppet.rb +30 -13
- data/lib/puppet/application.rb +34 -16
- data/lib/puppet/application/agent.rb +4 -4
- data/lib/puppet/application/master.rb +25 -5
- data/lib/puppet/defaults.rb +11 -7
- data/lib/puppet/dsl.rb +7 -3
- data/lib/puppet/dsl/actions.rb +283 -0
- data/lib/puppet/dsl/blank_slate.rb +55 -0
- data/lib/puppet/dsl/context.rb +393 -0
- data/lib/puppet/dsl/parser.rb +57 -0
- data/lib/puppet/dsl/resource_decorator.rb +56 -0
- data/lib/puppet/dsl/resource_reference.rb +95 -0
- data/lib/puppet/dsl/type_reference.rb +102 -0
- data/lib/puppet/error.rb +1 -1
- data/lib/puppet/face/help.rb +2 -4
- data/lib/puppet/face/man.rb +8 -2
- data/lib/puppet/feature/pson.rb +1 -3
- data/lib/puppet/indirector/catalog/active_record.rb +3 -0
- data/lib/puppet/indirector/catalog/compiler.rb +1 -2
- data/lib/puppet/indirector/catalog/queue.rb +4 -0
- data/lib/puppet/indirector/catalog/static_compiler.rb +30 -0
- data/lib/puppet/indirector/catalog/store_configs.rb +3 -0
- data/lib/puppet/indirector/certificate_request/rest.rb +1 -0
- data/lib/puppet/indirector/certificate_revocation_list/rest.rb +1 -0
- data/lib/puppet/indirector/certificate_status/file.rb +4 -0
- data/lib/puppet/indirector/certificate_status/rest.rb +1 -0
- data/lib/puppet/indirector/facts/active_record.rb +3 -0
- data/lib/puppet/indirector/facts/couch.rb +3 -0
- data/lib/puppet/indirector/facts/inventory_active_record.rb +4 -0
- data/lib/puppet/indirector/facts/store_configs.rb +3 -0
- data/lib/puppet/indirector/file_metadata/rest.rb +2 -0
- data/lib/puppet/indirector/instrumentation_data/local.rb +3 -0
- data/lib/puppet/indirector/instrumentation_data/rest.rb +3 -0
- data/lib/puppet/indirector/instrumentation_listener/local.rb +3 -0
- data/lib/puppet/indirector/instrumentation_listener/rest.rb +3 -0
- data/lib/puppet/indirector/instrumentation_probe/local.rb +3 -0
- data/lib/puppet/indirector/instrumentation_probe/rest.rb +3 -0
- data/lib/puppet/indirector/node/active_record.rb +3 -0
- data/lib/puppet/indirector/node/rest.rb +2 -2
- data/lib/puppet/indirector/node/store_configs.rb +3 -0
- data/lib/puppet/indirector/node/write_only_yaml.rb +32 -0
- data/lib/puppet/indirector/queue.rb +0 -1
- data/lib/puppet/indirector/request.rb +1 -2
- data/lib/puppet/indirector/resource/active_record.rb +4 -0
- data/lib/puppet/indirector/resource/ral.rb +3 -0
- data/lib/puppet/indirector/resource/rest.rb +3 -0
- data/lib/puppet/indirector/resource/store_configs.rb +3 -0
- data/lib/puppet/indirector/run/local.rb +3 -0
- data/lib/puppet/indirector/ssl_file.rb +16 -14
- data/lib/puppet/indirector/status/local.rb +3 -0
- data/lib/puppet/indirector/status/rest.rb +4 -0
- data/lib/puppet/interface.rb +78 -3
- data/lib/puppet/interface/action.rb +39 -3
- data/lib/puppet/interface/action_builder.rb +74 -1
- data/lib/puppet/interface/action_manager.rb +33 -3
- data/lib/puppet/interface/documentation.rb +116 -5
- data/lib/puppet/interface/face_collection.rb +6 -7
- data/lib/puppet/interface/option.rb +10 -1
- data/lib/puppet/interface/option_builder.rb +29 -1
- data/lib/puppet/interface/option_manager.rb +21 -6
- data/lib/puppet/metatype/manager.rb +47 -9
- data/lib/puppet/module_tool.rb +0 -1
- data/lib/puppet/network/formats.rb +0 -2
- data/lib/puppet/node.rb +2 -3
- data/lib/puppet/node/environment.rb +14 -1
- data/lib/puppet/parameter.rb +309 -44
- data/lib/puppet/parameter/package_options.rb +5 -0
- data/lib/puppet/parameter/path.rb +26 -3
- data/lib/puppet/parameter/value.rb +30 -6
- data/lib/puppet/parameter/value_collection.rb +82 -20
- data/lib/puppet/parser.rb +3 -0
- data/lib/puppet/parser/ast/definition.rb +2 -5
- data/lib/puppet/parser/ast/hostclass.rb +2 -3
- data/lib/puppet/parser/ast/node.rb +2 -5
- data/lib/puppet/parser/ast/resourceparam.rb +1 -1
- data/lib/puppet/parser/compiler.rb +10 -0
- data/lib/puppet/parser/functions.rb +111 -7
- data/lib/puppet/parser/functions/create_resources.rb +23 -2
- data/lib/puppet/parser/functions/defined.rb +1 -1
- data/lib/puppet/parser/functions/extlookup.rb +2 -1
- data/lib/puppet/parser/functions/fail.rb +1 -1
- data/lib/puppet/parser/functions/file.rb +1 -1
- data/lib/puppet/parser/functions/fqdn_rand.rb +1 -1
- data/lib/puppet/parser/functions/generate.rb +1 -1
- data/lib/puppet/parser/functions/hiera.rb +1 -1
- data/lib/puppet/parser/functions/hiera_array.rb +1 -1
- data/lib/puppet/parser/functions/hiera_hash.rb +1 -1
- data/lib/puppet/parser/functions/hiera_include.rb +1 -1
- data/lib/puppet/parser/functions/include.rb +1 -1
- data/lib/puppet/parser/functions/inline_template.rb +1 -1
- data/lib/puppet/parser/functions/md5.rb +1 -1
- data/lib/puppet/parser/functions/realize.rb +1 -1
- data/lib/puppet/parser/functions/regsubst.rb +54 -57
- data/lib/puppet/parser/functions/require.rb +1 -0
- data/lib/puppet/parser/functions/search.rb +1 -1
- data/lib/puppet/parser/functions/sha1.rb +1 -1
- data/lib/puppet/parser/functions/shellquote.rb +1 -1
- data/lib/puppet/parser/functions/split.rb +1 -2
- data/lib/puppet/parser/functions/sprintf.rb +7 -10
- data/lib/puppet/parser/functions/tag.rb +1 -1
- data/lib/puppet/parser/functions/tagged.rb +1 -1
- data/lib/puppet/parser/functions/template.rb +1 -1
- data/lib/puppet/parser/functions/versioncmp.rb +1 -5
- data/lib/puppet/parser/parser_support.rb +11 -27
- data/lib/puppet/parser/scope.rb +48 -4
- data/lib/puppet/parser/type_loader.rb +31 -7
- data/lib/puppet/property.rb +304 -70
- data/lib/puppet/property/ensure.rb +14 -1
- data/lib/puppet/property/keyvalue.rb +17 -8
- data/lib/puppet/property/list.rb +3 -0
- data/lib/puppet/property/ordered_list.rb +7 -0
- data/lib/puppet/provider.rb +275 -53
- data/lib/puppet/provider/augeas/augeas.rb +17 -3
- data/lib/puppet/provider/confiner.rb +30 -1
- data/lib/puppet/provider/group/pw.rb +2 -2
- data/lib/puppet/provider/package/pip.rb +0 -1
- data/lib/puppet/provider/package/pkgin.rb +2 -0
- data/lib/puppet/provider/service/bsd.rb +1 -1
- data/lib/puppet/provider/service/freebsd.rb +10 -6
- data/lib/puppet/provider/service/init.rb +1 -1
- data/lib/puppet/provider/service/service.rb +1 -1
- data/lib/puppet/provider/user/pw.rb +2 -2
- data/lib/puppet/provider/user/useradd.rb +2 -3
- data/lib/puppet/reference/configuration.rb +6 -0
- data/lib/puppet/reports.rb +44 -4
- data/lib/puppet/reports/tagmail.rb +1 -1
- data/lib/puppet/resource.rb +38 -25
- data/lib/puppet/resource/type.rb +14 -6
- data/lib/puppet/settings.rb +66 -142
- data/lib/puppet/settings/config_file.rb +99 -0
- data/lib/puppet/settings/file_setting.rb +92 -24
- data/lib/puppet/settings/value_translator.rb +15 -0
- data/lib/puppet/ssl/certificate_authority/interface.rb +2 -2
- data/lib/puppet/test/test_helper.rb +8 -3
- data/lib/puppet/transaction.rb +1 -2
- data/lib/puppet/transaction/report.rb +122 -13
- data/lib/puppet/type.rb +763 -150
- data/lib/puppet/type/augeas.rb +4 -0
- data/lib/puppet/type/file/ensure.rb +1 -1
- data/lib/puppet/type/file/group.rb +1 -1
- data/lib/puppet/type/file/mode.rb +2 -0
- data/lib/puppet/type/file/selcontext.rb +1 -0
- data/lib/puppet/type/group.rb +12 -0
- data/lib/puppet/type/mount.rb +2 -2
- data/lib/puppet/type/notify.rb +1 -1
- data/lib/puppet/type/router.rb +1 -1
- data/lib/puppet/type/service.rb +1 -0
- data/lib/puppet/type/ssh_authorized_key.rb +3 -1
- data/lib/puppet/type/user.rb +8 -1
- data/lib/puppet/util.rb +8 -0
- data/lib/puppet/util/autoload.rb +7 -10
- data/lib/puppet/util/classgen.rb +58 -33
- data/lib/puppet/util/command_line.rb +120 -77
- data/lib/puppet/util/constant_inflector.rb +2 -0
- data/lib/puppet/util/execution.rb +63 -33
- data/lib/puppet/util/filetype.rb +1 -1
- data/lib/puppet/util/manifest_filetype_helper.rb +22 -0
- data/lib/puppet/util/methodhelper.rb +19 -0
- data/lib/puppet/util/monkey_patches.rb +46 -0
- data/lib/puppet/util/plugins.rb +2 -2
- data/lib/puppet/util/provider_features.rb +24 -8
- data/lib/puppet/util/rubygems.rb +8 -1
- data/lib/puppet/util/zaml.rb +1 -1
- data/lib/puppet/version.rb +74 -3
- data/spec/integration/application/apply_spec.rb +1 -1
- data/spec/integration/defaults_spec.rb +1 -0
- data/spec/integration/dsl/classes_spec.rb +191 -0
- data/spec/integration/dsl/defaults_spec.rb +38 -0
- data/spec/integration/dsl/definitions_spec.rb +73 -0
- data/spec/integration/dsl/functions_spec.rb +95 -0
- data/spec/integration/dsl/nodes_spec.rb +96 -0
- data/spec/integration/dsl/params_spec.rb +146 -0
- data/spec/integration/dsl/relationships_spec.rb +46 -0
- data/spec/integration/dsl/resources_spec.rb +202 -0
- data/spec/integration/dsl/type_loading_spec.rb +64 -0
- data/spec/integration/indirector/catalog/queue_spec.rb +1 -1
- data/spec/integration/network/formats_spec.rb +32 -45
- data/spec/integration/parser/collector_spec.rb +105 -25
- data/spec/integration/parser/scope_spec.rb +64 -1
- data/spec/integration/resource/catalog_spec.rb +2 -4
- data/spec/integration/type/package_spec.rb +1 -1
- data/spec/lib/matchers/catalog.rb +50 -0
- data/spec/lib/puppet_spec/compiler.rb +11 -0
- data/spec/lib/puppet_spec/dsl.rb +29 -0
- data/spec/spec_helper.rb +17 -3
- data/spec/unit/application/agent_spec.rb +0 -1
- data/spec/unit/application/apply_spec.rb +1 -1
- data/spec/unit/application/face_base_spec.rb +11 -4
- data/spec/unit/application/indirection_base_spec.rb +4 -8
- data/spec/unit/application/kick_spec.rb +5 -2
- data/spec/unit/application/master_spec.rb +0 -6
- data/spec/unit/application_spec.rb +38 -14
- data/spec/unit/dsl/actions_spec.rb +402 -0
- data/spec/unit/dsl/blank_slate_spec.rb +27 -0
- data/spec/unit/dsl/context_spec.rb +678 -0
- data/spec/unit/dsl/parser_spec.rb +56 -0
- data/spec/unit/dsl/resource_decorator_spec.rb +94 -0
- data/spec/unit/dsl/resource_reference_spec.rb +150 -0
- data/spec/unit/dsl/type_reference_spec.rb +164 -0
- data/spec/unit/face/help_spec.rb +5 -7
- data/spec/unit/indirector/certificate_request/rest_spec.rb +4 -0
- data/spec/unit/indirector/certificate_revocation_list/rest_spec.rb +4 -0
- data/spec/unit/indirector/certificate_status/rest_spec.rb +4 -0
- data/spec/unit/indirector/file_metadata/rest_spec.rb +5 -0
- data/spec/unit/indirector/hiera_spec.rb +3 -1
- data/spec/unit/indirector/queue_spec.rb +1 -7
- data/spec/unit/indirector/ssl_file_spec.rb +66 -39
- data/spec/unit/module_spec.rb +1 -1
- data/spec/unit/network/authstore_spec.rb +22 -1
- data/spec/unit/network/formats_spec.rb +1 -1
- data/spec/unit/node/environment_spec.rb +13 -0
- data/spec/unit/parser/collector_spec.rb +1 -1
- data/spec/unit/parser/compiler_spec.rb +26 -0
- data/spec/unit/parser/functions/create_resources_spec.rb +12 -1
- data/spec/unit/parser/functions/extlookup_spec.rb +4 -4
- data/spec/unit/parser/functions/hiera_array_spec.rb +1 -1
- data/spec/unit/parser/functions/hiera_hash_spec.rb +1 -1
- data/spec/unit/parser/functions/hiera_include_spec.rb +1 -1
- data/spec/unit/parser/functions/hiera_spec.rb +1 -1
- data/spec/unit/parser/functions/regsubst_spec.rb +4 -4
- data/spec/unit/parser/functions/split_spec.rb +4 -4
- data/spec/unit/parser/functions/sprintf_spec.rb +2 -2
- data/spec/unit/parser/functions/versioncmp_spec.rb +4 -4
- data/spec/unit/parser/functions_spec.rb +51 -1
- data/spec/unit/parser/parser_spec.rb +0 -14
- data/spec/unit/parser/type_loader_spec.rb +15 -1
- data/spec/unit/provider/augeas/augeas_spec.rb +31 -0
- data/spec/unit/provider/package/apt_spec.rb +0 -2
- data/spec/unit/provider/package/pip_spec.rb +12 -2
- data/spec/unit/provider/service/freebsd_spec.rb +8 -0
- data/spec/unit/provider/service/gentoo_spec.rb +20 -20
- data/spec/unit/provider/service/openrc_spec.rb +20 -20
- data/spec/unit/provider/service/src_spec.rb +4 -4
- data/spec/unit/provider/service/systemd_spec.rb +0 -8
- data/spec/unit/provider/service/windows_spec.rb +1 -1
- data/spec/unit/provider/user/useradd_spec.rb +2 -9
- data/spec/unit/relationship_spec.rb +2 -2
- data/spec/unit/resource/catalog_spec.rb +2 -2
- data/spec/unit/resource/type_spec.rb +49 -25
- data/spec/unit/resource_spec.rb +34 -2
- data/spec/unit/settings/config_file_spec.rb +100 -0
- data/spec/unit/settings/file_setting_spec.rb +87 -84
- data/spec/unit/settings/value_translator_spec.rb +77 -0
- data/spec/unit/settings_spec.rb +96 -29
- data/spec/unit/type/file/ensure_spec.rb +75 -36
- data/spec/unit/type/file_spec.rb +0 -68
- data/spec/unit/type/group_spec.rb +10 -0
- data/spec/unit/util/autoload_spec.rb +6 -0
- data/spec/unit/util/command_line_spec.rb +54 -62
- data/spec/unit/util/manifest_filetype_helper_spec.rb +29 -0
- data/spec/unit/util/metric_spec.rb +0 -9
- data/spec/unit/util/posix_spec.rb +0 -4
- data/spec/unit/util/rdoc_spec.rb +0 -12
- data/spec/unit/util/zaml_spec.rb +188 -130
- data/spec/unit/version_spec.rb +42 -0
- metadata +123 -90
- data/README_HIERA.md +0 -148
- data/conf/epm.list +0 -8
- data/conf/namespaceauth.conf +0 -20
- data/conf/puppet-queue.conf +0 -10
- data/examples/allatonce +0 -13
- data/examples/assignments +0 -11
- data/examples/components +0 -73
- data/examples/etc/init.d/sleeper +0 -70
- data/examples/etc/otherfile +0 -0
- data/examples/etc/puppet/fileserver.conf +0 -13
- data/examples/etc/puppet/namespaceauth.conf +0 -20
- data/examples/etc/puppet/puppet.conf +0 -10
- data/examples/etc/puppet/tagmail.conf +0 -1
- data/examples/execs +0 -16
- data/examples/file.bl +0 -11
- data/examples/filedefaults +0 -10
- data/examples/fileparsing +0 -116
- data/examples/filerecursion +0 -15
- data/examples/functions +0 -3
- data/examples/groups +0 -7
- data/examples/head +0 -30
- data/examples/importing +0 -8
- data/examples/mac_dscl.pp +0 -28
- data/examples/mac_dscl_revert.pp +0 -26
- data/examples/mac_pkgdmg.pp +0 -7
- data/examples/modules/sample_module.pp +0 -10
- data/examples/modules/sample_module/lib/puppet/parser/functions/hostname_to_dn.rb +0 -36
- data/examples/modules/sample_module/manifests/init.pp +0 -12
- data/examples/modules/sample_module/templates/sample.erb +0 -5
- data/examples/nodes +0 -20
- data/examples/one +0 -8
- data/examples/relationships +0 -34
- data/examples/selectors +0 -28
- data/examples/simpletests +0 -11
- data/examples/svncommit +0 -13
- data/lib/puppet/dsl/resource_api.rb +0 -120
- data/lib/puppet/dsl/resource_type_api.rb +0 -34
- data/spec/integration/parser/ruby_manifest_spec.rb +0 -127
- data/spec/unit/dsl/resource_api_spec.rb +0 -180
- data/spec/unit/dsl/resource_type_api_spec.rb +0 -53
@@ -10,7 +10,7 @@ describe 'Puppet::Parser::Functions#hiera_include' do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
it 'should require a key argument' do
|
13
|
-
expect { scope.function_hiera_include([]) }.to raise_error(
|
13
|
+
expect { scope.function_hiera_include([]) }.to raise_error(ArgumentError)
|
14
14
|
end
|
15
15
|
|
16
16
|
it 'should raise a useful error when nil is returned' do
|
@@ -6,7 +6,7 @@ describe 'Puppet::Parser::Functions#hiera' do
|
|
6
6
|
let :scope do Puppet::Parser::Scope.new_for_test_harness('foo') end
|
7
7
|
|
8
8
|
it 'should require a key argument' do
|
9
|
-
expect { scope.function_hiera([]) }.to raise_error(
|
9
|
+
expect { scope.function_hiera([]) }.to raise_error(ArgumentError)
|
10
10
|
end
|
11
11
|
|
12
12
|
it 'should raise a useful error when nil is returned' do
|
@@ -16,12 +16,12 @@ describe "the regsubst function" do
|
|
16
16
|
Puppet::Parser::Functions.function("regsubst").should == "function_regsubst"
|
17
17
|
end
|
18
18
|
|
19
|
-
it "should raise a
|
20
|
-
lambda { @scope.function_regsubst(["foo", "bar"]) }.should( raise_error(
|
19
|
+
it "should raise a ArgumentError if there is less than 3 arguments" do
|
20
|
+
lambda { @scope.function_regsubst(["foo", "bar"]) }.should( raise_error(ArgumentError))
|
21
21
|
end
|
22
22
|
|
23
|
-
it "should raise a
|
24
|
-
lambda { @scope.function_regsubst(["foo", "bar", "gazonk", "del", "x", "y"]) }.should( raise_error(
|
23
|
+
it "should raise a ArgumentError if there is more than 5 arguments" do
|
24
|
+
lambda { @scope.function_regsubst(["foo", "bar", "gazonk", "del", "x", "y"]) }.should( raise_error(ArgumentError))
|
25
25
|
end
|
26
26
|
|
27
27
|
|
@@ -16,12 +16,12 @@ describe "the split function" do
|
|
16
16
|
Puppet::Parser::Functions.function("split").should == "function_split"
|
17
17
|
end
|
18
18
|
|
19
|
-
it "should raise a
|
20
|
-
lambda { @scope.function_split(["foo"]) }.should( raise_error(
|
19
|
+
it "should raise a ArgumentError if there is less than 2 arguments" do
|
20
|
+
lambda { @scope.function_split(["foo"]) }.should( raise_error(ArgumentError))
|
21
21
|
end
|
22
22
|
|
23
|
-
it "should raise a
|
24
|
-
lambda { @scope.function_split(["foo", "bar", "gazonk"]) }.should( raise_error(
|
23
|
+
it "should raise a ArgumentError if there is more than 2 arguments" do
|
24
|
+
lambda { @scope.function_split(["foo", "bar", "gazonk"]) }.should( raise_error(ArgumentError))
|
25
25
|
end
|
26
26
|
|
27
27
|
it "should raise a RegexpError if the regexp is malformed" do
|
@@ -16,8 +16,8 @@ describe "the sprintf function" do
|
|
16
16
|
Puppet::Parser::Functions.function("sprintf").should == "function_sprintf"
|
17
17
|
end
|
18
18
|
|
19
|
-
it "should raise a
|
20
|
-
lambda { @scope.function_sprintf([]) }.should( raise_error(
|
19
|
+
it "should raise a ArgumentError if there is less than 1 argument" do
|
20
|
+
lambda { @scope.function_sprintf([]) }.should( raise_error(ArgumentError))
|
21
21
|
end
|
22
22
|
|
23
23
|
it "should format integers" do
|
@@ -16,12 +16,12 @@ describe "the versioncmp function" do
|
|
16
16
|
Puppet::Parser::Functions.function("versioncmp").should == "function_versioncmp"
|
17
17
|
end
|
18
18
|
|
19
|
-
it "should raise a
|
20
|
-
lambda { @scope.function_versioncmp(["1.2"]) }.should raise_error(
|
19
|
+
it "should raise a ArgumentError if there is less than 2 arguments" do
|
20
|
+
lambda { @scope.function_versioncmp(["1.2"]) }.should raise_error(ArgumentError)
|
21
21
|
end
|
22
22
|
|
23
|
-
it "should raise a
|
24
|
-
lambda { @scope.function_versioncmp(["1.2", "2.4.5", "3.5.6"]) }.should raise_error(
|
23
|
+
it "should raise a ArgumentError if there is more than 2 arguments" do
|
24
|
+
lambda { @scope.function_versioncmp(["1.2", "2.4.5", "3.5.6"]) }.should raise_error(ArgumentError)
|
25
25
|
end
|
26
26
|
|
27
27
|
it "should call Puppet::Util::Package.versioncmp (included in scope)" do
|
@@ -39,7 +39,7 @@ describe Puppet::Parser::Functions do
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
-
describe "when calling function to test function
|
42
|
+
describe "when calling function to test function existence" do
|
43
43
|
before do
|
44
44
|
@module = Module.new
|
45
45
|
Puppet::Parser::Functions.stubs(:environment_module).returns @module
|
@@ -64,6 +64,56 @@ describe Puppet::Parser::Functions do
|
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
|
+
describe "when calling function to test arity" do
|
68
|
+
before :each do
|
69
|
+
Puppet::Node::Environment.stubs(:current).returns(nil)
|
70
|
+
@compiler = Puppet::Parser::Compiler.new(Puppet::Node.new("foo"))
|
71
|
+
@scope = Puppet::Parser::Scope.new(@compiler)
|
72
|
+
end
|
73
|
+
|
74
|
+
it "should raise an error if the function is called with too many arguments" do
|
75
|
+
Puppet::Parser::Functions.newfunction("name", :arity => 2) { |args| }
|
76
|
+
lambda { @scope.function_name([1,2,3]) }.should raise_error ArgumentError
|
77
|
+
end
|
78
|
+
|
79
|
+
it "should raise an error if the function is called with too few arguments" do
|
80
|
+
Puppet::Parser::Functions.newfunction("name", :arity => 2) { |args| }
|
81
|
+
lambda { @scope.function_name([1]) }.should raise_error ArgumentError
|
82
|
+
end
|
83
|
+
|
84
|
+
it "should not raise an error if the function is called with correct number of arguments" do
|
85
|
+
Puppet::Parser::Functions.newfunction("name", :arity => 2) { |args| }
|
86
|
+
lambda { @scope.function_name([1,2]) }.should_not raise_error ArgumentError
|
87
|
+
end
|
88
|
+
|
89
|
+
it "should raise an error if the variable arg function is called with too few arguments" do
|
90
|
+
Puppet::Parser::Functions.newfunction("name", :arity => -3) { |args| }
|
91
|
+
lambda { @scope.function_name([1]) }.should raise_error ArgumentError
|
92
|
+
end
|
93
|
+
|
94
|
+
it "should not raise an error if the variable arg function is called with correct number of arguments" do
|
95
|
+
Puppet::Parser::Functions.newfunction("name", :arity => -3) { |args| }
|
96
|
+
lambda { @scope.function_name([1,2]) }.should_not raise_error ArgumentError
|
97
|
+
end
|
98
|
+
|
99
|
+
it "should not raise an error if the variable arg function is called with more number of arguments" do
|
100
|
+
Puppet::Parser::Functions.newfunction("name", :arity => -3) { |args| }
|
101
|
+
lambda { @scope.function_name([1,2,3]) }.should_not raise_error ArgumentError
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
describe "::arity" do
|
106
|
+
it "returns the given arity of a function" do
|
107
|
+
Puppet::Parser::Functions.newfunction("name", :arity => 4) { |args| }
|
108
|
+
Puppet::Parser::Functions.arity(:name).should == 4
|
109
|
+
end
|
110
|
+
|
111
|
+
it "returns -1 if no arity is given" do
|
112
|
+
Puppet::Parser::Functions.newfunction("name") { |args| }
|
113
|
+
Puppet::Parser::Functions.arity(:name).should == -1
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
67
117
|
describe "::get_function" do
|
68
118
|
it "can retrieve a function defined on the *root* environment" do
|
69
119
|
Thread.current[:environment] = nil
|
@@ -49,20 +49,6 @@ describe Puppet::Parser do
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
-
describe "when parsing files" do
|
53
|
-
before do
|
54
|
-
FileTest.stubs(:exist?).returns true
|
55
|
-
File.stubs(:read).returns ""
|
56
|
-
@parser.stubs(:watch_file)
|
57
|
-
end
|
58
|
-
|
59
|
-
it "should treat files ending in 'rb' as ruby files" do
|
60
|
-
@parser.expects(:parse_ruby_file)
|
61
|
-
@parser.file = "/my/file.rb"
|
62
|
-
@parser.parse
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
52
|
describe "when parsing append operator" do
|
67
53
|
|
68
54
|
it "should not raise syntax errors" do
|
@@ -92,6 +92,20 @@ describe Puppet::Parser::TypeLoader do
|
|
92
92
|
# This will fail if it tries to reimport the file.
|
93
93
|
@loader.import("myfile")
|
94
94
|
end
|
95
|
+
|
96
|
+
it "checks the type of DSL to import" do
|
97
|
+
Puppet::Parser::Files.expects(:find_manifests).returns ["modname", [make_absolute("/one")]]
|
98
|
+
Puppet::Util::ManifestFiletypeHelper.expects(:is_ruby_filename?).at_least_once.returns false
|
99
|
+
|
100
|
+
@loader.import("myfile")
|
101
|
+
end
|
102
|
+
|
103
|
+
it "evaluates loaded Ruby code" do
|
104
|
+
File.stubs(:read).returns("hostclass(:asdf) {}")
|
105
|
+
Puppet::Parser::Files.stubs(:find_manifests).returns ["modname", [make_absolute("/one.rb")]]
|
106
|
+
|
107
|
+
@loader.import("myfile").map(&:name).should include "asdf"
|
108
|
+
end
|
95
109
|
end
|
96
110
|
|
97
111
|
describe "when importing all" do
|
@@ -122,7 +136,7 @@ describe Puppet::Parser::TypeLoader do
|
|
122
136
|
|
123
137
|
# write out the class
|
124
138
|
if type == "ruby"
|
125
|
-
File.open(path, "w") { |f| f.print "hostclass '#{name}' do
|
139
|
+
File.open(path, "w") { |f| f.print "hostclass :'#{name}' do; end" }
|
126
140
|
else
|
127
141
|
File.open(path, "w") { |f| f.print "class #{name} {}" }
|
128
142
|
end
|
@@ -570,6 +570,7 @@ describe provider_class do
|
|
570
570
|
it "should handle setm commands" do
|
571
571
|
@resource[:changes] = ["set test[1]/Jar/Jar Foo","set test[2]/Jar/Jar Bar","setm test Jar/Jar Binks"]
|
572
572
|
@resource[:context] = "/foo/"
|
573
|
+
@augeas.expects(:respond_to?).with("setm").returns(true)
|
573
574
|
@augeas.expects(:set).with("/foo/test[1]/Jar/Jar", "Foo").returns(true)
|
574
575
|
@augeas.expects(:set).with("/foo/test[2]/Jar/Jar", "Bar").returns(true)
|
575
576
|
@augeas.expects(:setm).with("/foo/test", "Jar/Jar", "Binks").returns(true)
|
@@ -577,6 +578,36 @@ describe provider_class do
|
|
577
578
|
@augeas.expects(:close)
|
578
579
|
@provider.execute_changes.should == :executed
|
579
580
|
end
|
581
|
+
|
582
|
+
it "should throw error if setm command not supported" do
|
583
|
+
@resource[:changes] = ["set test[1]/Jar/Jar Foo","set test[2]/Jar/Jar Bar","setm test Jar/Jar Binks"]
|
584
|
+
@resource[:context] = "/foo/"
|
585
|
+
@augeas.expects(:respond_to?).with("setm").returns(false)
|
586
|
+
@augeas.expects(:set).with("/foo/test[1]/Jar/Jar", "Foo").returns(true)
|
587
|
+
@augeas.expects(:set).with("/foo/test[2]/Jar/Jar", "Bar").returns(true)
|
588
|
+
expect { @provider.execute_changes }.to raise_error RuntimeError, /command 'setm' not supported/
|
589
|
+
end
|
590
|
+
|
591
|
+
it "should handle clearm commands" do
|
592
|
+
@resource[:changes] = ["set test[1]/Jar/Jar Foo","set test[2]/Jar/Jar Bar","clearm test Jar/Jar"]
|
593
|
+
@resource[:context] = "/foo/"
|
594
|
+
@augeas.expects(:respond_to?).with("clearm").returns(true)
|
595
|
+
@augeas.expects(:set).with("/foo/test[1]/Jar/Jar", "Foo").returns(true)
|
596
|
+
@augeas.expects(:set).with("/foo/test[2]/Jar/Jar", "Bar").returns(true)
|
597
|
+
@augeas.expects(:clearm).with("/foo/test", "Jar/Jar").returns(true)
|
598
|
+
@augeas.expects(:save).returns(true)
|
599
|
+
@augeas.expects(:close)
|
600
|
+
@provider.execute_changes.should == :executed
|
601
|
+
end
|
602
|
+
|
603
|
+
it "should throw error if clearm command not supported" do
|
604
|
+
@resource[:changes] = ["set test[1]/Jar/Jar Foo","set test[2]/Jar/Jar Bar","clearm test Jar/Jar"]
|
605
|
+
@resource[:context] = "/foo/"
|
606
|
+
@augeas.expects(:respond_to?).with("clearm").returns(false)
|
607
|
+
@augeas.expects(:set).with("/foo/test[1]/Jar/Jar", "Foo").returns(true)
|
608
|
+
@augeas.expects(:set).with("/foo/test[2]/Jar/Jar", "Bar").returns(true)
|
609
|
+
expect { @provider.execute_changes }.to raise_error RuntimeError, /command 'clearm' not supported/
|
610
|
+
end
|
580
611
|
end
|
581
612
|
|
582
613
|
describe "when making changes", :if => Puppet.features.augeas? do
|
@@ -76,8 +76,6 @@ Version table:
|
|
76
76
|
@provider.run_preseed
|
77
77
|
end
|
78
78
|
|
79
|
-
it "should fail if a cdrom is listed in the sources list and :allowcdrom is not specified"
|
80
|
-
|
81
79
|
describe "when installing" do
|
82
80
|
it "should preseed if a responsefile is provided" do
|
83
81
|
@resource.expects(:[]).with(:responsefile).returns "/my/file"
|
@@ -109,11 +109,21 @@ describe provider_class do
|
|
109
109
|
@provider.install
|
110
110
|
end
|
111
111
|
|
112
|
+
it "omits the -e flag (GH-1256)" do
|
113
|
+
# The -e flag makes the provider non-idempotent
|
114
|
+
@resource[:ensure] = :installed
|
115
|
+
@resource[:source] = @url
|
116
|
+
@provider.expects(:lazy_pip).with() do |*args|
|
117
|
+
not args.include?("-e")
|
118
|
+
end
|
119
|
+
@provider.install
|
120
|
+
end
|
121
|
+
|
112
122
|
it "should install from SCM" do
|
113
123
|
@resource[:ensure] = :installed
|
114
124
|
@resource[:source] = @url
|
115
125
|
@provider.expects(:lazy_pip).
|
116
|
-
with("install", '-q',
|
126
|
+
with("install", '-q', "#{@url}#egg=fake_package")
|
117
127
|
@provider.install
|
118
128
|
end
|
119
129
|
|
@@ -121,7 +131,7 @@ describe provider_class do
|
|
121
131
|
@resource[:ensure] = "0123456"
|
122
132
|
@resource[:source] = @url
|
123
133
|
@provider.expects(:lazy_pip).
|
124
|
-
with("install", "-q", "
|
134
|
+
with("install", "-q", "#{@url}@0123456#egg=fake_package")
|
125
135
|
@provider.install
|
126
136
|
end
|
127
137
|
|
@@ -35,6 +35,14 @@ OUTPUT
|
|
35
35
|
@provider.rcvar.should == ['# ntpd', 'ntpd_enable="YES"', '# (default: "")']
|
36
36
|
end
|
37
37
|
|
38
|
+
it "should correctly parse rcvar for DragonFly BSD" do
|
39
|
+
@provider.stubs(:execute).returns <<OUTPUT
|
40
|
+
# ntpd
|
41
|
+
$ntpd=YES
|
42
|
+
OUTPUT
|
43
|
+
@provider.rcvar.should == ['# ntpd', 'ntpd=YES']
|
44
|
+
end
|
45
|
+
|
38
46
|
it "should find the right rcvar_value for FreeBSD < 7" do
|
39
47
|
@provider.stubs(:rcvar).returns(['# ntpd', 'ntpd_enable=YES'])
|
40
48
|
|
@@ -72,12 +72,12 @@ describe Puppet::Type.type(:service).provider(:gentoo) do
|
|
72
72
|
describe "#start" do
|
73
73
|
it "should use the supplied start command if specified" do
|
74
74
|
provider = described_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :start => '/bin/foo'))
|
75
|
-
provider.expects(:execute).with(['/bin/foo'], :failonfail => true, :squelch => true)
|
75
|
+
provider.expects(:execute).with(['/bin/foo'], :failonfail => true, :override_locale => false, :squelch => true)
|
76
76
|
provider.start
|
77
77
|
end
|
78
78
|
it "should start the service with <initscript> start otherwise" do
|
79
79
|
provider = described_class.new(Puppet::Type.type(:service).new(:name => 'sshd'))
|
80
|
-
provider.expects(:execute).with(['/etc/init.d/sshd',:start], :failonfail => true, :squelch => true)
|
80
|
+
provider.expects(:execute).with(['/etc/init.d/sshd',:start], :failonfail => true, :override_locale => false, :squelch => true)
|
81
81
|
provider.expects(:search).with('sshd').returns('/etc/init.d/sshd')
|
82
82
|
provider.start
|
83
83
|
end
|
@@ -86,12 +86,12 @@ describe Puppet::Type.type(:service).provider(:gentoo) do
|
|
86
86
|
describe "#stop" do
|
87
87
|
it "should use the supplied stop command if specified" do
|
88
88
|
provider = described_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :stop => '/bin/foo'))
|
89
|
-
provider.expects(:execute).with(['/bin/foo'], :failonfail => true, :squelch => true)
|
89
|
+
provider.expects(:execute).with(['/bin/foo'], :failonfail => true, :override_locale => false, :squelch => true)
|
90
90
|
provider.stop
|
91
91
|
end
|
92
92
|
it "should stop the service with <initscript> stop otherwise" do
|
93
93
|
provider = described_class.new(Puppet::Type.type(:service).new(:name => 'sshd'))
|
94
|
-
provider.expects(:execute).with(['/etc/init.d/sshd',:stop], :failonfail => true, :squelch => true)
|
94
|
+
provider.expects(:execute).with(['/etc/init.d/sshd',:stop], :failonfail => true, :override_locale => false, :squelch => true)
|
95
95
|
provider.expects(:search).with('sshd').returns('/etc/init.d/sshd')
|
96
96
|
provider.stop
|
97
97
|
end
|
@@ -153,23 +153,23 @@ describe Puppet::Type.type(:service).provider(:gentoo) do
|
|
153
153
|
describe "when a special status command is specified" do
|
154
154
|
it "should use the status command from the resource" do
|
155
155
|
provider = described_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :status => '/bin/foo'))
|
156
|
-
provider.expects(:execute).with(['/etc/init.d/sshd',:status], :failonfail => false, :squelch => true).never
|
157
|
-
provider.expects(:execute).with(['/bin/foo'], :failonfail => false, :squelch => true)
|
156
|
+
provider.expects(:execute).with(['/etc/init.d/sshd',:status], :failonfail => false, :override_locale => false, :squelch => true).never
|
157
|
+
provider.expects(:execute).with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => true)
|
158
158
|
provider.status
|
159
159
|
end
|
160
160
|
|
161
161
|
it "should return :stopped when the status command returns with a non-zero exitcode" do
|
162
162
|
provider = described_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :status => '/bin/foo'))
|
163
|
-
provider.expects(:execute).with(['/etc/init.d/sshd',:status], :failonfail => false, :squelch => true).never
|
164
|
-
provider.expects(:execute).with(['/bin/foo'], :failonfail => false, :squelch => true)
|
163
|
+
provider.expects(:execute).with(['/etc/init.d/sshd',:status], :failonfail => false, :override_locale => false, :squelch => true).never
|
164
|
+
provider.expects(:execute).with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => true)
|
165
165
|
$CHILD_STATUS.stubs(:exitstatus).returns 3
|
166
166
|
provider.status.should == :stopped
|
167
167
|
end
|
168
168
|
|
169
169
|
it "should return :running when the status command returns with a zero exitcode" do
|
170
170
|
provider = described_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :status => '/bin/foo'))
|
171
|
-
provider.expects(:execute).with(['/etc/init.d/sshd',:status], :failonfail => false, :squelch => true).never
|
172
|
-
provider.expects(:execute).with(['/bin/foo'], :failonfail => false, :squelch => true)
|
171
|
+
provider.expects(:execute).with(['/etc/init.d/sshd',:status], :failonfail => false, :override_locale => false, :squelch => true).never
|
172
|
+
provider.expects(:execute).with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => true)
|
173
173
|
$CHILD_STATUS.stubs(:exitstatus).returns 0
|
174
174
|
provider.status.should == :running
|
175
175
|
end
|
@@ -178,14 +178,14 @@ describe Puppet::Type.type(:service).provider(:gentoo) do
|
|
178
178
|
describe "when hasstatus is false" do
|
179
179
|
it "should return running if a pid can be found" do
|
180
180
|
provider = described_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :hasstatus => false))
|
181
|
-
provider.expects(:execute).with(['/etc/init.d/sshd',:status], :failonfail => false, :squelch => true).never
|
181
|
+
provider.expects(:execute).with(['/etc/init.d/sshd',:status], :failonfail => false, :override_locale => false, :squelch => true).never
|
182
182
|
provider.expects(:getpid).returns 1000
|
183
183
|
provider.status.should == :running
|
184
184
|
end
|
185
185
|
|
186
186
|
it "should return stopped if no pid can be found" do
|
187
187
|
provider = described_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :hasstatus => false))
|
188
|
-
provider.expects(:execute).with(['/etc/init.d/sshd',:status], :failonfail => false, :squelch => true).never
|
188
|
+
provider.expects(:execute).with(['/etc/init.d/sshd',:status], :failonfail => false, :override_locale => false, :squelch => true).never
|
189
189
|
provider.expects(:getpid).returns nil
|
190
190
|
provider.status.should == :stopped
|
191
191
|
end
|
@@ -195,7 +195,7 @@ describe Puppet::Type.type(:service).provider(:gentoo) do
|
|
195
195
|
it "should return running if <initscript> status exits with a zero exitcode" do
|
196
196
|
provider = described_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :hasstatus => true))
|
197
197
|
provider.expects(:search).with('sshd').returns('/etc/init.d/sshd')
|
198
|
-
provider.expects(:execute).with(['/etc/init.d/sshd',:status], :failonfail => false, :squelch => true)
|
198
|
+
provider.expects(:execute).with(['/etc/init.d/sshd',:status], :failonfail => false, :override_locale => false, :squelch => true)
|
199
199
|
$CHILD_STATUS.stubs(:exitstatus).returns 0
|
200
200
|
provider.status.should == :running
|
201
201
|
end
|
@@ -203,7 +203,7 @@ describe Puppet::Type.type(:service).provider(:gentoo) do
|
|
203
203
|
it "should return stopped if <initscript> status exits with a non-zero exitcode" do
|
204
204
|
provider = described_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :hasstatus => true))
|
205
205
|
provider.expects(:search).with('sshd').returns('/etc/init.d/sshd')
|
206
|
-
provider.expects(:execute).with(['/etc/init.d/sshd',:status], :failonfail => false, :squelch => true)
|
206
|
+
provider.expects(:execute).with(['/etc/init.d/sshd',:status], :failonfail => false, :override_locale => false, :squelch => true)
|
207
207
|
$CHILD_STATUS.stubs(:exitstatus).returns 3
|
208
208
|
provider.status.should == :stopped
|
209
209
|
end
|
@@ -213,24 +213,24 @@ describe Puppet::Type.type(:service).provider(:gentoo) do
|
|
213
213
|
describe "#restart" do
|
214
214
|
it "should use the supplied restart command if specified" do
|
215
215
|
provider = described_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :restart => '/bin/foo'))
|
216
|
-
provider.expects(:execute).with(['/etc/init.d/sshd',:restart], :failonfail => true, :squelch => true).never
|
217
|
-
provider.expects(:execute).with(['/bin/foo'], :failonfail => true, :squelch => true)
|
216
|
+
provider.expects(:execute).with(['/etc/init.d/sshd',:restart], :failonfail => true, :override_locale => false, :squelch => true).never
|
217
|
+
provider.expects(:execute).with(['/bin/foo'], :failonfail => true, :override_locale => false, :squelch => true)
|
218
218
|
provider.restart
|
219
219
|
end
|
220
220
|
|
221
221
|
it "should restart the service with <initscript> restart if hasrestart is true" do
|
222
222
|
provider = described_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :hasrestart => true))
|
223
223
|
provider.expects(:search).with('sshd').returns('/etc/init.d/sshd')
|
224
|
-
provider.expects(:execute).with(['/etc/init.d/sshd',:restart], :failonfail => true, :squelch => true)
|
224
|
+
provider.expects(:execute).with(['/etc/init.d/sshd',:restart], :failonfail => true, :override_locale => false, :squelch => true)
|
225
225
|
provider.restart
|
226
226
|
end
|
227
227
|
|
228
228
|
it "should restart the service with <initscript> stop/start if hasrestart is false" do
|
229
229
|
provider = described_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :hasrestart => false))
|
230
230
|
provider.expects(:search).with('sshd').returns('/etc/init.d/sshd')
|
231
|
-
provider.expects(:execute).with(['/etc/init.d/sshd',:restart], :failonfail => true, :squelch => true).never
|
232
|
-
provider.expects(:execute).with(['/etc/init.d/sshd',:stop], :failonfail => true, :squelch => true)
|
233
|
-
provider.expects(:execute).with(['/etc/init.d/sshd',:start], :failonfail => true, :squelch => true)
|
231
|
+
provider.expects(:execute).with(['/etc/init.d/sshd',:restart], :failonfail => true, :override_locale => false, :squelch => true).never
|
232
|
+
provider.expects(:execute).with(['/etc/init.d/sshd',:stop], :failonfail => true, :override_locale => false, :squelch => true)
|
233
|
+
provider.expects(:execute).with(['/etc/init.d/sshd',:start], :failonfail => true, :override_locale => false, :squelch => true)
|
234
234
|
provider.restart
|
235
235
|
end
|
236
236
|
end
|
@@ -35,12 +35,12 @@ describe Puppet::Type.type(:service).provider(:openrc) do
|
|
35
35
|
describe "#start" do
|
36
36
|
it "should use the supplied start command if specified" do
|
37
37
|
provider = described_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :start => '/bin/foo'))
|
38
|
-
provider.expects(:execute).with(['/bin/foo'], :failonfail => true, :squelch => true)
|
38
|
+
provider.expects(:execute).with(['/bin/foo'], :failonfail => true, :override_locale => false, :squelch => true)
|
39
39
|
provider.start
|
40
40
|
end
|
41
41
|
it "should start the service with rc-service start otherwise" do
|
42
42
|
provider = described_class.new(Puppet::Type.type(:service).new(:name => 'sshd'))
|
43
|
-
provider.expects(:execute).with(['/sbin/rc-service','sshd',:start], :failonfail => true, :squelch => true)
|
43
|
+
provider.expects(:execute).with(['/sbin/rc-service','sshd',:start], :failonfail => true, :override_locale => false, :squelch => true)
|
44
44
|
provider.start
|
45
45
|
end
|
46
46
|
end
|
@@ -48,12 +48,12 @@ describe Puppet::Type.type(:service).provider(:openrc) do
|
|
48
48
|
describe "#stop" do
|
49
49
|
it "should use the supplied stop command if specified" do
|
50
50
|
provider = described_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :stop => '/bin/foo'))
|
51
|
-
provider.expects(:execute).with(['/bin/foo'], :failonfail => true, :squelch => true)
|
51
|
+
provider.expects(:execute).with(['/bin/foo'], :failonfail => true, :override_locale => false, :squelch => true)
|
52
52
|
provider.stop
|
53
53
|
end
|
54
54
|
it "should stop the service with rc-service stop otherwise" do
|
55
55
|
provider = described_class.new(Puppet::Type.type(:service).new(:name => 'sshd'))
|
56
|
-
provider.expects(:execute).with(['/sbin/rc-service','sshd',:stop], :failonfail => true, :squelch => true)
|
56
|
+
provider.expects(:execute).with(['/sbin/rc-service','sshd',:stop], :failonfail => true, :override_locale => false, :squelch => true)
|
57
57
|
provider.stop
|
58
58
|
end
|
59
59
|
end
|
@@ -128,23 +128,23 @@ describe Puppet::Type.type(:service).provider(:openrc) do
|
|
128
128
|
describe "when a special status command if specified" do
|
129
129
|
it "should use the status command from the resource" do
|
130
130
|
provider = described_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :status => '/bin/foo'))
|
131
|
-
provider.expects(:execute).with(['/sbin/rc-service','sshd',:status], :failonfail => false, :squelch => true).never
|
132
|
-
provider.expects(:execute).with(['/bin/foo'], :failonfail => false, :squelch => true)
|
131
|
+
provider.expects(:execute).with(['/sbin/rc-service','sshd',:status], :failonfail => false, :override_locale => false, :squelch => true).never
|
132
|
+
provider.expects(:execute).with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => true)
|
133
133
|
provider.status
|
134
134
|
end
|
135
135
|
|
136
136
|
it "should return :stopped when status command returns with a non-zero exitcode" do
|
137
137
|
provider = described_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :status => '/bin/foo'))
|
138
|
-
provider.expects(:execute).with(['/sbin/rc-service','sshd',:status], :failonfail => false, :squelch => true).never
|
139
|
-
provider.expects(:execute).with(['/bin/foo'], :failonfail => false, :squelch => true)
|
138
|
+
provider.expects(:execute).with(['/sbin/rc-service','sshd',:status], :failonfail => false, :override_locale => false, :squelch => true).never
|
139
|
+
provider.expects(:execute).with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => true)
|
140
140
|
$CHILD_STATUS.stubs(:exitstatus).returns 3
|
141
141
|
provider.status.should == :stopped
|
142
142
|
end
|
143
143
|
|
144
144
|
it "should return :running when status command returns with a zero exitcode" do
|
145
145
|
provider = described_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :status => '/bin/foo'))
|
146
|
-
provider.expects(:execute).with(['/sbin/rc-service','sshd',:status], :failonfail => false, :squelch => true).never
|
147
|
-
provider.expects(:execute).with(['/bin/foo'], :failonfail => false, :squelch => true)
|
146
|
+
provider.expects(:execute).with(['/sbin/rc-service','sshd',:status], :failonfail => false, :override_locale => false, :squelch => true).never
|
147
|
+
provider.expects(:execute).with(['/bin/foo'], :failonfail => false, :override_locale => false, :squelch => true)
|
148
148
|
$CHILD_STATUS.stubs(:exitstatus).returns 0
|
149
149
|
provider.status.should == :running
|
150
150
|
end
|
@@ -153,14 +153,14 @@ describe Puppet::Type.type(:service).provider(:openrc) do
|
|
153
153
|
describe "when hasstatus is false" do
|
154
154
|
it "should return running if a pid can be found" do
|
155
155
|
provider = described_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :hasstatus => false))
|
156
|
-
provider.expects(:execute).with(['/sbin/rc-service','sshd',:status], :failonfail => false, :squelch => true).never
|
156
|
+
provider.expects(:execute).with(['/sbin/rc-service','sshd',:status], :failonfail => false, :override_locale => false, :squelch => true).never
|
157
157
|
provider.expects(:getpid).returns 1000
|
158
158
|
provider.status.should == :running
|
159
159
|
end
|
160
160
|
|
161
161
|
it "should return stopped if no pid can be found" do
|
162
162
|
provider = described_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :hasstatus => false))
|
163
|
-
provider.expects(:execute).with(['/sbin/rc-service','sshd',:status], :failonfail => false, :squelch => true).never
|
163
|
+
provider.expects(:execute).with(['/sbin/rc-service','sshd',:status], :failonfail => false, :override_locale => false, :squelch => true).never
|
164
164
|
provider.expects(:getpid).returns nil
|
165
165
|
provider.status.should == :stopped
|
166
166
|
end
|
@@ -169,14 +169,14 @@ describe Puppet::Type.type(:service).provider(:openrc) do
|
|
169
169
|
describe "when hasstatus is true" do
|
170
170
|
it "should return running if rc-service status exits with a zero exitcode" do
|
171
171
|
provider = described_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :hasstatus => true))
|
172
|
-
provider.expects(:execute).with(['/sbin/rc-service','sshd',:status], :failonfail => false, :squelch => true)
|
172
|
+
provider.expects(:execute).with(['/sbin/rc-service','sshd',:status], :failonfail => false, :override_locale => false, :squelch => true)
|
173
173
|
$CHILD_STATUS.stubs(:exitstatus).returns 0
|
174
174
|
provider.status.should == :running
|
175
175
|
end
|
176
176
|
|
177
177
|
it "should return stopped if rc-service status exits with a non-zero exitcode" do
|
178
178
|
provider = described_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :hasstatus => true))
|
179
|
-
provider.expects(:execute).with(['/sbin/rc-service','sshd',:status], :failonfail => false, :squelch => true)
|
179
|
+
provider.expects(:execute).with(['/sbin/rc-service','sshd',:status], :failonfail => false, :override_locale => false, :squelch => true)
|
180
180
|
$CHILD_STATUS.stubs(:exitstatus).returns 3
|
181
181
|
provider.status.should == :stopped
|
182
182
|
end
|
@@ -186,22 +186,22 @@ describe Puppet::Type.type(:service).provider(:openrc) do
|
|
186
186
|
describe "#restart" do
|
187
187
|
it "should use the supplied restart command if specified" do
|
188
188
|
provider = described_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :restart => '/bin/foo'))
|
189
|
-
provider.expects(:execute).with(['/sbin/rc-service','sshd',:restart], :failonfail => true, :squelch => true).never
|
190
|
-
provider.expects(:execute).with(['/bin/foo'], :failonfail => true, :squelch => true)
|
189
|
+
provider.expects(:execute).with(['/sbin/rc-service','sshd',:restart], :failonfail => true, :override_locale => false, :squelch => true).never
|
190
|
+
provider.expects(:execute).with(['/bin/foo'], :failonfail => true, :override_locale => false, :squelch => true)
|
191
191
|
provider.restart
|
192
192
|
end
|
193
193
|
|
194
194
|
it "should restart the service with rc-service restart if hasrestart is true" do
|
195
195
|
provider = described_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :hasrestart => true))
|
196
|
-
provider.expects(:execute).with(['/sbin/rc-service','sshd',:restart], :failonfail => true, :squelch => true)
|
196
|
+
provider.expects(:execute).with(['/sbin/rc-service','sshd',:restart], :failonfail => true, :override_locale => false, :squelch => true)
|
197
197
|
provider.restart
|
198
198
|
end
|
199
199
|
|
200
200
|
it "should restart the service with rc-service stop/start if hasrestart is false" do
|
201
201
|
provider = described_class.new(Puppet::Type.type(:service).new(:name => 'sshd', :hasrestart => false))
|
202
|
-
provider.expects(:execute).with(['/sbin/rc-service','sshd',:restart], :failonfail => true, :squelch => true).never
|
203
|
-
provider.expects(:execute).with(['/sbin/rc-service','sshd',:stop], :failonfail => true, :squelch => true)
|
204
|
-
provider.expects(:execute).with(['/sbin/rc-service','sshd',:start], :failonfail => true, :squelch => true)
|
202
|
+
provider.expects(:execute).with(['/sbin/rc-service','sshd',:restart], :failonfail => true, :override_locale => false, :squelch => true).never
|
203
|
+
provider.expects(:execute).with(['/sbin/rc-service','sshd',:stop], :failonfail => true, :override_locale => false, :squelch => true)
|
204
|
+
provider.expects(:execute).with(['/sbin/rc-service','sshd',:start], :failonfail => true, :override_locale => false, :squelch => true)
|
205
205
|
provider.restart
|
206
206
|
end
|
207
207
|
end
|