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
data/spec/unit/face/help_spec.rb
CHANGED
@@ -72,7 +72,7 @@ describe Puppet::Face[:help, '0.0.1'] do
|
|
72
72
|
# that can't be run from the command line, so, rather than iterating
|
73
73
|
# over all available faces, we need to iterate over the subcommands
|
74
74
|
# that are available from the command line.
|
75
|
-
Puppet::
|
75
|
+
Puppet::Application.available_application_names.each do |name|
|
76
76
|
next unless help_face.is_face_app?(name)
|
77
77
|
next if help_face.exclude_from_docs?(name)
|
78
78
|
face = Puppet::Face[name, :current]
|
@@ -84,12 +84,10 @@ describe Puppet::Face[:help, '0.0.1'] do
|
|
84
84
|
end
|
85
85
|
|
86
86
|
context "face summaries" do
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
Puppet::Face.faces.each do |name|
|
92
|
-
it "has a summary for #{name}" do
|
87
|
+
it "can generate face summaries" do
|
88
|
+
faces = Puppet::Face.faces
|
89
|
+
faces.length.should > 0
|
90
|
+
faces.each do |name|
|
93
91
|
Puppet::Face[name, :current].should have_a_summary
|
94
92
|
end
|
95
93
|
end
|
@@ -19,4 +19,8 @@ describe Puppet::SSL::CertificateRequest::Rest do
|
|
19
19
|
it "should set port_setting to :ca_port" do
|
20
20
|
Puppet::SSL::CertificateRequest::Rest.port_setting.should == :ca_port
|
21
21
|
end
|
22
|
+
|
23
|
+
it "should use the :ca SRV service" do
|
24
|
+
Puppet::SSL::CertificateRequest::Rest.srv_service.should == :ca
|
25
|
+
end
|
22
26
|
end
|
@@ -19,4 +19,8 @@ describe Puppet::SSL::CertificateRevocationList::Rest do
|
|
19
19
|
it "should set port_setting to :ca_port" do
|
20
20
|
Puppet::SSL::CertificateRevocationList::Rest.port_setting.should == :ca_port
|
21
21
|
end
|
22
|
+
|
23
|
+
it "should use the :ca SRV service" do
|
24
|
+
Puppet::SSL::CertificateRevocationList::Rest.srv_service.should == :ca
|
25
|
+
end
|
22
26
|
end
|
@@ -11,4 +11,8 @@ describe "Puppet::CertificateStatus::Rest" do
|
|
11
11
|
it "should be a terminus on Puppet::SSL::Host" do
|
12
12
|
@terminus.should be_instance_of(Puppet::Indirector::CertificateStatus::Rest)
|
13
13
|
end
|
14
|
+
|
15
|
+
it "should use the :ca SRV service" do
|
16
|
+
Puppet::Indirector::CertificateStatus::Rest.srv_service.should == :ca
|
17
|
+
end
|
14
18
|
end
|
@@ -2,7 +2,12 @@
|
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
4
|
require 'puppet/indirector/file_metadata'
|
5
|
+
require 'puppet/indirector/file_metadata/rest'
|
5
6
|
|
6
7
|
describe "Puppet::Indirector::Metadata::Rest" do
|
7
8
|
it "should add the node's cert name to the arguments"
|
9
|
+
|
10
|
+
it "should use the :fileserver SRV service" do
|
11
|
+
Puppet::Indirector::FileMetadata::Rest.srv_service.should == :fileserver
|
12
|
+
end
|
8
13
|
end
|
@@ -96,7 +96,9 @@ describe Puppet::Indirector::Hiera do
|
|
96
96
|
|
97
97
|
it "should return a hiera configuration hash" do
|
98
98
|
results = @hiera_class.hiera_config
|
99
|
-
|
99
|
+
default_hiera_config.each do |key,value|
|
100
|
+
results[key].should == value
|
101
|
+
end
|
100
102
|
results.should be_a_kind_of Hash
|
101
103
|
end
|
102
104
|
|
@@ -25,7 +25,7 @@ class FooExampleData
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
describe Puppet::Indirector::Queue
|
28
|
+
describe Puppet::Indirector::Queue do
|
29
29
|
before :each do
|
30
30
|
@model = mock 'model'
|
31
31
|
@indirection = stub 'indirection', :name => :my_queue, :register_terminus_type => nil, :model => @model
|
@@ -46,12 +46,6 @@ describe Puppet::Indirector::Queue, :if => Puppet.features.pson? do
|
|
46
46
|
@request = stub 'request', :key => :me, :instance => @subject
|
47
47
|
end
|
48
48
|
|
49
|
-
it "should require PSON" do
|
50
|
-
Puppet.features.expects(:pson?).returns false
|
51
|
-
|
52
|
-
expect { @store_class.new }.to raise_error(ArgumentError)
|
53
|
-
end
|
54
|
-
|
55
49
|
it 'should use the correct client type and queue' do
|
56
50
|
@store.queue.should == :my_queue
|
57
51
|
@store.client.should be_an_instance_of(Puppet::Indirector::Queue::TestClient)
|
@@ -27,6 +27,12 @@ describe Puppet::Indirector::SslFile do
|
|
27
27
|
Puppet[:trace] = false
|
28
28
|
end
|
29
29
|
|
30
|
+
after :each do
|
31
|
+
@file_class.store_in nil
|
32
|
+
@file_class.store_at nil
|
33
|
+
@file_class.store_ca_at nil
|
34
|
+
end
|
35
|
+
|
30
36
|
it "should use :main and :ssl upon initialization" do
|
31
37
|
Puppet.settings.expects(:use).with(:main, :ssl)
|
32
38
|
@file_class.new
|
@@ -43,11 +49,12 @@ describe Puppet::Indirector::SslFile do
|
|
43
49
|
end
|
44
50
|
|
45
51
|
it "should fail if no store directory or file location has been set" do
|
52
|
+
Puppet.settings.expects(:use).with(:main, :ssl)
|
46
53
|
@file_class.store_in nil
|
47
54
|
@file_class.store_at nil
|
48
|
-
|
49
|
-
|
50
|
-
|
55
|
+
expect {
|
56
|
+
@file_class.new
|
57
|
+
}.to raise_error(Puppet::DevError, /No file or directory setting provided/)
|
51
58
|
end
|
52
59
|
|
53
60
|
describe "when managing ssl files" do
|
@@ -113,30 +120,45 @@ describe Puppet::Indirector::SslFile do
|
|
113
120
|
|
114
121
|
describe "when finding certificates on disk" do
|
115
122
|
describe "and no certificate is present" do
|
116
|
-
before do
|
117
|
-
# Stub things so the case management bits work.
|
118
|
-
FileTest.stubs(:exist?).with(File.dirname(@certpath)).returns false
|
119
|
-
FileTest.expects(:exist?).with(@certpath).returns false
|
120
|
-
end
|
121
|
-
|
122
123
|
it "should return nil" do
|
124
|
+
FileTest.expects(:exist?).with(@path).returns(true)
|
125
|
+
Dir.expects(:entries).with(@path).returns([])
|
126
|
+
FileTest.expects(:exist?).with(@certpath).returns(false)
|
127
|
+
|
123
128
|
@searcher.find(@request).should be_nil
|
124
129
|
end
|
125
130
|
end
|
126
131
|
|
127
132
|
describe "and a certificate is present" do
|
128
|
-
|
129
|
-
|
130
|
-
end
|
133
|
+
let(:cert) { mock 'cert' }
|
134
|
+
let(:model) { mock 'model' }
|
131
135
|
|
132
|
-
|
133
|
-
cert = mock 'cert'
|
134
|
-
model = mock 'model'
|
136
|
+
before(:each) do
|
135
137
|
@file_class.stubs(:model).returns model
|
138
|
+
end
|
139
|
+
|
140
|
+
context "is readable" do
|
141
|
+
it "should return an instance of the model, which it should use to read the certificate" do
|
142
|
+
FileTest.expects(:exist?).with(@certpath).returns true
|
143
|
+
|
144
|
+
model.expects(:new).with("myname").returns cert
|
145
|
+
cert.expects(:read).with(@certpath)
|
146
|
+
|
147
|
+
@searcher.find(@request).should equal(cert)
|
148
|
+
end
|
149
|
+
end
|
136
150
|
|
137
|
-
|
138
|
-
|
139
|
-
|
151
|
+
context "is unreadable" do
|
152
|
+
it "should raise an exception" do
|
153
|
+
FileTest.expects(:exist?).with(@certpath).returns(true)
|
154
|
+
|
155
|
+
model.expects(:new).with("myname").returns cert
|
156
|
+
cert.expects(:read).with(@certpath).raises(Errno::EACCES)
|
157
|
+
|
158
|
+
expect {
|
159
|
+
@searcher.find(@request)
|
160
|
+
}.to raise_error(Errno::EACCES)
|
161
|
+
end
|
140
162
|
end
|
141
163
|
end
|
142
164
|
|
@@ -262,41 +284,46 @@ describe Puppet::Indirector::SslFile do
|
|
262
284
|
end
|
263
285
|
|
264
286
|
describe "when searching for certificates" do
|
265
|
-
|
266
|
-
|
267
|
-
|
287
|
+
let(:one) { stub 'one' }
|
288
|
+
let(:two) { stub 'two' }
|
289
|
+
let(:one_path) { File.join(@path, 'one.pem') }
|
290
|
+
let(:two_path) { File.join(@path, 'two.pem') }
|
291
|
+
let(:model) { mock 'model' }
|
292
|
+
|
293
|
+
before :each do
|
294
|
+
@file_class.stubs(:model).returns model
|
268
295
|
end
|
269
|
-
it "should return a certificate instance for all files that exist" do
|
270
|
-
Dir.expects(:entries).with(@path).returns %w{one.pem two.pem}
|
271
296
|
|
272
|
-
|
273
|
-
|
297
|
+
it "should return a certificate instance for all files that exist" do
|
298
|
+
Dir.expects(:entries).with(@path).returns(%w{. .. one.pem two.pem})
|
274
299
|
|
275
|
-
|
276
|
-
|
300
|
+
model.expects(:new).with("one").returns one
|
301
|
+
one.expects(:read).with(one_path)
|
302
|
+
model.expects(:new).with("two").returns two
|
303
|
+
two.expects(:read).with(two_path)
|
277
304
|
|
278
305
|
@searcher.search(@request).should == [one, two]
|
279
306
|
end
|
280
307
|
|
281
|
-
it "should
|
282
|
-
Dir.expects(:entries).with(@path).returns
|
283
|
-
|
284
|
-
one = stub 'one'
|
285
|
-
one.expects(:read).with(File.join(@path, "one.pem"))
|
308
|
+
it "should raise an exception if any file is unreadable" do
|
309
|
+
Dir.expects(:entries).with(@path).returns(%w{. .. one.pem two.pem})
|
286
310
|
|
287
|
-
|
311
|
+
model.expects(:new).with("one").returns(one)
|
312
|
+
one.expects(:read).with(one_path)
|
313
|
+
model.expects(:new).with("two").returns(two)
|
314
|
+
two.expects(:read).raises(Errno::EACCES)
|
288
315
|
|
289
|
-
|
316
|
+
expect {
|
317
|
+
@searcher.search(@request)
|
318
|
+
}.to raise_error(Errno::EACCES)
|
290
319
|
end
|
291
320
|
|
292
321
|
it "should skip any files that do not match /\.pem$/" do
|
293
|
-
Dir.expects(:entries).with(@path).returns
|
294
|
-
|
295
|
-
one = stub 'one', :read => nil
|
322
|
+
Dir.expects(:entries).with(@path).returns(%w{. .. one two.notpem})
|
296
323
|
|
297
|
-
|
324
|
+
model.expects(:new).never
|
298
325
|
|
299
|
-
@searcher.search(@request)
|
326
|
+
@searcher.search(@request).should == []
|
300
327
|
end
|
301
328
|
end
|
302
329
|
end
|
data/spec/unit/module_spec.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
2
|
require 'spec_helper'
|
3
|
+
require 'rbconfig'
|
3
4
|
|
4
5
|
require 'puppet/network/authconfig'
|
5
6
|
|
@@ -214,7 +215,6 @@ describe Puppet::Network::AuthStore::Declaration do
|
|
214
215
|
"1::2:3:4",
|
215
216
|
"1::2:3",
|
216
217
|
"1::8",
|
217
|
-
"::2:3:4:5:6:7:8",
|
218
218
|
"::2:3:4:5:6:7",
|
219
219
|
"::2:3:4:5:6",
|
220
220
|
"::2:3:4:5",
|
@@ -291,6 +291,27 @@ describe Puppet::Network::AuthStore::Declaration do
|
|
291
291
|
end unless ip =~ /:.*\./ # Hybrid IPs aren't supported by ruby's ipaddr
|
292
292
|
}
|
293
293
|
|
294
|
+
[
|
295
|
+
"::2:3:4:5:6:7:8",
|
296
|
+
].each { |ip|
|
297
|
+
describe "when the pattern is a valid IP such as #{ip}" do
|
298
|
+
let(:declaration) do
|
299
|
+
Puppet::Network::AuthStore::Declaration.new(:allow_ip,ip)
|
300
|
+
end
|
301
|
+
|
302
|
+
issue_7477 = !(IPAddr.new(ip) rescue false)
|
303
|
+
|
304
|
+
it "should match the specified IP" do
|
305
|
+
pending "resolution of ruby issue [7477](http://goo.gl/Bb1LU)", :if => issue_7477
|
306
|
+
declaration.should be_match('www.testsite.org',ip)
|
307
|
+
end
|
308
|
+
it "should not match other IPs" do
|
309
|
+
pending "resolution of ruby issue [7477](http://goo.gl/Bb1LU)", :if => issue_7477
|
310
|
+
declaration.should_not be_match('www.testsite.org','200.101.99.98')
|
311
|
+
end
|
312
|
+
end
|
313
|
+
}
|
314
|
+
|
294
315
|
{
|
295
316
|
'spirit.mars.nasa.gov' => 'a PQDN',
|
296
317
|
'ratchet.2ndsiteinc.com' => 'a PQDN with digits',
|
@@ -220,7 +220,7 @@ describe "Puppet Network Format" do
|
|
220
220
|
Puppet::Network::FormatHandler.format(:pson).should_not be_nil
|
221
221
|
end
|
222
222
|
|
223
|
-
describe "pson"
|
223
|
+
describe "pson" do
|
224
224
|
before do
|
225
225
|
@pson = Puppet::Network::FormatHandler.format(:pson)
|
226
226
|
end
|
@@ -441,6 +441,19 @@ describe Puppet::Node::Environment do
|
|
441
441
|
env.instance_eval { perform_initial_import }
|
442
442
|
end
|
443
443
|
|
444
|
+
it "should not do anything when using ruby dsl" do
|
445
|
+
Puppet[:manifest] = "test.rb"
|
446
|
+
@parser.expects(:parse).never
|
447
|
+
env.instance_eval { perform_initial_import }
|
448
|
+
end
|
449
|
+
|
450
|
+
it "returns empty hostclass when using Ruby DSL" do
|
451
|
+
Puppet[:manifest] = "test.rb"
|
452
|
+
env.instance_eval { perform_initial_import }.tap {|c|
|
453
|
+
c.should be_a Puppet::Parser::AST::Hostclass
|
454
|
+
}.code.should be nil
|
455
|
+
end
|
456
|
+
|
444
457
|
it "should mark the type collection as needing a reparse when there is an error parsing" do
|
445
458
|
@parser.expects(:parse).raises Puppet::ParseError.new("Syntax error at ...")
|
446
459
|
env.stubs(:known_resource_types).returns Puppet::Resource::TypeCollection.new(env)
|
@@ -34,7 +34,7 @@ describe Puppet::Parser::Collector, "when initializing" do
|
|
34
34
|
@collector.equery.should equal(@equery)
|
35
35
|
end
|
36
36
|
|
37
|
-
it "should
|
37
|
+
it "should canonicalize the type name" do
|
38
38
|
@collector = Puppet::Parser::Collector.new(@scope, "resource::type", @equery, @vquery, @form)
|
39
39
|
@collector.type.should == "Resource::Type"
|
40
40
|
end
|
@@ -247,6 +247,32 @@ describe Puppet::Parser::Compiler do
|
|
247
247
|
@compiler.compile
|
248
248
|
end
|
249
249
|
|
250
|
+
it "should evaluate ruby code on main object when using ruby dsl" do
|
251
|
+
compile_stub(:evaluate_main)
|
252
|
+
Puppet::Util::ManifestFiletypeHelper.expects(:is_ruby_filename?).at_least_once.returns true
|
253
|
+
@compiler.expects :assign_ruby_code
|
254
|
+
|
255
|
+
@compiler.compile
|
256
|
+
end
|
257
|
+
|
258
|
+
it "should create a new Puppet::DSL::Parser when using ruby dsl" do
|
259
|
+
compile_stub(:evaluate_main)
|
260
|
+
File.stubs(:read).returns("test code")
|
261
|
+
Puppet[:manifest] = "test.rb"
|
262
|
+
Puppet::DSL::Parser.expects(:prepare_for_evaluation).with {|main, code, filename| code == "test code" and main.is_a? Puppet::Resource::Type}.returns stub(:evaluate)
|
263
|
+
|
264
|
+
@compiler.compile
|
265
|
+
end
|
266
|
+
|
267
|
+
it "should call evaluate on DSL Parser instance when using ruby dsl" do
|
268
|
+
compile_stub(:evaluate_main)
|
269
|
+
Puppet::Util::ManifestFiletypeHelper.expects(:is_ruby_filename?).at_least_once.returns true
|
270
|
+
File.stubs(:read).returns("")
|
271
|
+
Puppet::DSL::Parser.expects :prepare_for_evaluation
|
272
|
+
|
273
|
+
@compiler.compile
|
274
|
+
end
|
275
|
+
|
250
276
|
it "should create a new, empty 'main' if no main class exists" do
|
251
277
|
compile_stub(:evaluate_main)
|
252
278
|
@compiler.compile
|
@@ -19,7 +19,7 @@ describe 'function for dynamically creating resources' do
|
|
19
19
|
end
|
20
20
|
|
21
21
|
it 'should require two or three arguments' do
|
22
|
-
expect { @scope.function_create_resources(['foo']) }.to raise_error(ArgumentError, 'create_resources():
|
22
|
+
expect { @scope.function_create_resources(['foo']) }.to raise_error(ArgumentError, 'create_resources(): Wrong number of arguments given (1 for minimum 2)')
|
23
23
|
expect { @scope.function_create_resources(['foo', 'bar', 'blah', 'baz']) }.to raise_error(ArgumentError, 'create_resources(): wrong number of arguments (4; must be 2 or 3)')
|
24
24
|
end
|
25
25
|
|
@@ -50,6 +50,17 @@ describe 'function for dynamically creating resources' do
|
|
50
50
|
catalog.resource(:file, "/etc/foo")['ensure'].should == 'present'
|
51
51
|
end
|
52
52
|
|
53
|
+
it 'should be able to add virtual resources' do
|
54
|
+
catalog = compile_to_catalog("create_resources('@file', {'/etc/foo'=>{'ensure'=>'present'}})\nrealize(File['/etc/foo'])")
|
55
|
+
catalog.resource(:file, "/etc/foo")['ensure'].should == 'present'
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'should be able to add exported resources' do
|
59
|
+
catalog = compile_to_catalog("create_resources('@@file', {'/etc/foo'=>{'ensure'=>'present'}})")
|
60
|
+
catalog.resource(:file, "/etc/foo")['ensure'].should == 'present'
|
61
|
+
catalog.resource(:file, "/etc/foo").exported.should == true
|
62
|
+
end
|
63
|
+
|
53
64
|
it 'should accept multiple types' do
|
54
65
|
catalog = compile_to_catalog("create_resources('notify', {'foo'=>{'message'=>'one'}, 'bar'=>{'message'=>'two'}})")
|
55
66
|
catalog.resource(:notify, "foo")['message'].should == 'one'
|
@@ -19,12 +19,12 @@ describe "the extlookup function" do
|
|
19
19
|
Puppet::Parser::Functions.function("extlookup").should == "function_extlookup"
|
20
20
|
end
|
21
21
|
|
22
|
-
it "should raise a
|
23
|
-
lambda { @scope.function_extlookup([]) }.should( raise_error(
|
22
|
+
it "should raise a ArgumentError if there is less than 1 arguments" do
|
23
|
+
lambda { @scope.function_extlookup([]) }.should( raise_error(ArgumentError))
|
24
24
|
end
|
25
25
|
|
26
|
-
it "should raise a
|
27
|
-
lambda { @scope.function_extlookup(["foo", "bar", "baz", "gazonk"]) }.should( raise_error(
|
26
|
+
it "should raise a ArgumentError if there is more than 3 arguments" do
|
27
|
+
lambda { @scope.function_extlookup(["foo", "bar", "baz", "gazonk"]) }.should( raise_error(ArgumentError))
|
28
28
|
end
|
29
29
|
|
30
30
|
it "should return the default" do
|
@@ -8,7 +8,7 @@ describe 'Puppet::Parser::Functions#hiera_array' do
|
|
8
8
|
let :scope do Puppet::Parser::Scope.new_for_test_harness('foo') end
|
9
9
|
|
10
10
|
it 'should require a key argument' do
|
11
|
-
expect { scope.function_hiera_array([]) }.to raise_error(
|
11
|
+
expect { scope.function_hiera_array([]) }.to raise_error(ArgumentError)
|
12
12
|
end
|
13
13
|
|
14
14
|
it 'should raise a useful error when nil is returned' do
|
@@ -4,7 +4,7 @@ describe 'Puppet::Parser::Functions#hiera_hash' do
|
|
4
4
|
let :scope do Puppet::Parser::Scope.new_for_test_harness('foo') end
|
5
5
|
|
6
6
|
it 'should require a key argument' do
|
7
|
-
expect { scope.function_hiera_hash([]) }.to raise_error(
|
7
|
+
expect { scope.function_hiera_hash([]) }.to raise_error(ArgumentError)
|
8
8
|
end
|
9
9
|
|
10
10
|
it 'should raise a useful error when nil is returned' do
|