puppet 5.1.0-x86-mingw32 → 5.2.0-x86-mingw32
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/lib/puppet.rb +6 -53
- data/lib/puppet/application.rb +14 -7
- data/lib/puppet/application/agent.rb +6 -2
- data/lib/puppet/application/apply.rb +6 -2
- data/lib/puppet/application/cert.rb +6 -2
- data/lib/puppet/application/describe.rb +6 -2
- data/lib/puppet/application/device.rb +40 -29
- data/lib/puppet/application/doc.rb +6 -2
- data/lib/puppet/application/filebucket.rb +6 -2
- data/lib/puppet/application/lookup.rb +6 -2
- data/lib/puppet/application/master.rb +6 -2
- data/lib/puppet/application/resource.rb +6 -2
- data/lib/puppet/face/catalog.rb +1 -1
- data/lib/puppet/face/certificate_request.rb +1 -1
- data/lib/puppet/face/certificate_revocation_list.rb +1 -1
- data/lib/puppet/face/help.rb +17 -13
- data/lib/puppet/file_serving/configuration.rb +3 -0
- data/lib/puppet/file_serving/configuration/parser.rb +2 -0
- data/lib/puppet/file_serving/mount/tasks.rb +21 -0
- data/lib/puppet/functions/epp.rb +3 -0
- data/lib/puppet/functions/lookup.rb +2 -1
- data/lib/puppet/generate/models/type/property.rb +1 -1
- data/lib/puppet/gettext/config.rb +70 -0
- data/lib/puppet/gettext/stubs.rb +11 -0
- data/lib/puppet/indirector/request.rb +4 -4
- data/lib/puppet/info_service.rb +10 -0
- data/lib/puppet/info_service/task_information_service.rb +32 -0
- data/lib/puppet/module.rb +43 -12
- data/lib/puppet/module/task.rb +90 -0
- data/lib/puppet/parser/ast/leaf.rb +1 -1
- data/lib/puppet/parser/functions/dig.rb +11 -2
- data/lib/puppet/parser/functions/epp.rb +3 -0
- data/lib/puppet/parser/functions/new.rb +8 -8
- data/lib/puppet/pops/evaluator/evaluator_impl.rb +1 -1
- data/lib/puppet/pops/evaluator/runtime3_support.rb +1 -0
- data/lib/puppet/pops/issues.rb +11 -5
- data/lib/puppet/pops/loader/static_loader.rb +1 -1
- data/lib/puppet/pops/model/factory.rb +42 -2
- data/lib/puppet/pops/model/model_tree_dumper.rb +1 -1
- data/lib/puppet/pops/parser/egrammar.ra +30 -9
- data/lib/puppet/pops/parser/eparser.rb +1094 -1043
- data/lib/puppet/pops/patterns.rb +1 -1
- data/lib/puppet/pops/serialization/from_data_converter.rb +1 -1
- data/lib/puppet/pops/serialization/json_path.rb +1 -1
- data/lib/puppet/pops/serialization/to_data_converter.rb +12 -3
- data/lib/puppet/pops/types/p_object_type.rb +31 -3
- data/lib/puppet/pops/types/p_sem_ver_range_type.rb +3 -3
- data/lib/puppet/pops/types/p_timespan_type.rb +1 -1
- data/lib/puppet/pops/types/p_timestamp_type.rb +1 -1
- data/lib/puppet/pops/types/string_converter.rb +15 -12
- data/lib/puppet/pops/types/type_calculator.rb +1 -1
- data/lib/puppet/pops/types/type_factory.rb +7 -0
- data/lib/puppet/pops/types/type_formatter.rb +1 -1
- data/lib/puppet/pops/types/type_mismatch_describer.rb +86 -130
- data/lib/puppet/pops/types/type_parser.rb +10 -4
- data/lib/puppet/pops/types/types.rb +81 -22
- data/lib/puppet/provider/package/aix.rb +4 -4
- data/lib/puppet/provider/package/yum.rb +1 -0
- data/lib/puppet/type.rb +1 -1
- data/lib/puppet/type/mount.rb +1 -1
- data/lib/puppet/type/sshkey.rb +9 -1
- data/lib/puppet/util.rb +1 -1
- data/lib/puppet/util/command_line.rb +1 -1
- data/lib/puppet/util/log.rb +15 -10
- data/lib/puppet/util/windows/api_types.rb +9 -5
- data/lib/puppet/util/windows/process.rb +9 -1
- data/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet.rb +1 -3
- data/lib/puppet/version.rb +1 -1
- data/locales/ja/puppet.po +9270 -0
- data/locales/puppet.pot +272 -212
- data/spec/fixtures/unit/provider/package/yum/yum-check-update-plugin-output.txt +36 -0
- data/spec/integration/indirector/file_content/file_server_spec.rb +17 -0
- data/spec/integration/indirector/file_metadata/file_server_spec.rb +10 -0
- data/spec/integration/util/windows/process_spec.rb +45 -0
- data/spec/lib/puppet_spec/modules.rb +10 -0
- data/spec/shared_contexts/types_setup.rb +19 -4
- data/spec/spec_helper.rb +6 -7
- data/spec/unit/face/help_spec.rb +2 -2
- data/spec/unit/file_serving/configuration_spec.rb +14 -4
- data/spec/unit/file_serving/mount/modules_spec.rb +1 -1
- data/spec/unit/file_serving/mount/tasks_spec.rb +72 -0
- data/spec/unit/functions/epp_spec.rb +5 -0
- data/spec/unit/functions/regsubst_spec.rb +1 -1
- data/spec/unit/gettext_config_spec.rb +57 -0
- data/spec/unit/indirector/request_spec.rb +41 -0
- data/spec/unit/info_service_spec.rb +66 -2
- data/spec/unit/module_spec.rb +81 -1
- data/spec/unit/parser/ast/leaf_spec.rb +3 -4
- data/spec/unit/pops/evaluator/access_ops_spec.rb +5 -0
- data/spec/unit/pops/factory_spec.rb +5 -1
- data/spec/unit/pops/parser/parser_spec.rb +138 -0
- data/spec/unit/pops/serialization/to_from_hr_spec.rb +74 -1
- data/spec/unit/pops/types/p_init_type_spec.rb +1 -1
- data/spec/unit/pops/types/p_object_type_spec.rb +217 -33
- data/spec/unit/pops/types/p_timespan_type_spec.rb +7 -0
- data/spec/unit/pops/types/p_timestamp_type_spec.rb +7 -0
- data/spec/unit/pops/types/string_converter_spec.rb +48 -11
- data/spec/unit/pops/types/type_calculator_spec.rb +37 -5
- data/spec/unit/pops/types/type_mismatch_describer_spec.rb +12 -0
- data/spec/unit/pops/types/type_parser_spec.rb +25 -0
- data/spec/unit/pops/validator/validator_spec.rb +2 -2
- data/spec/unit/provider/package/aix_spec.rb +26 -1
- data/spec/unit/provider/package/yum_spec.rb +10 -0
- data/spec/unit/task_spec.rb +102 -0
- data/spec/unit/util/log_spec.rb +32 -3
- data/spec/unit/util/windows/api_types_spec.rb +51 -0
- metadata +3488 -3452
- checksums.yaml +0 -7
@@ -0,0 +1,36 @@
|
|
1
|
+
Loaded plugins: fastestmirror
|
2
|
+
Loading mirror speeds from cached hostfile
|
3
|
+
|
4
|
+
NetworkManager.x86_64 1:1.0.0-14.git20150121.b4ea599c.el7 base
|
5
|
+
NetworkManager-glib.x86_64 1:1.0.0-14.git20150121.b4ea599c.el7 base
|
6
|
+
NetworkManager-tui.x86_64 1:1.0.0-14.git20150121.b4ea599c.el7 base
|
7
|
+
alsa-firmware.noarch 1.0.28-2.el7 base
|
8
|
+
alsa-lib.x86_64 1.0.28-2.el7 base
|
9
|
+
audit.x86_64 2.4.1-5.el7 base
|
10
|
+
audit-libs.x86_64 2.4.1-5.el7 base
|
11
|
+
authconfig.x86_64 6.2.8-9.el7 base
|
12
|
+
avahi.x86_64 0.6.31-14.el7 base
|
13
|
+
avahi-autoipd.x86_64 0.6.31-14.el7 base
|
14
|
+
avahi-libs.x86_64 0.6.31-14.el7 base
|
15
|
+
bash.x86_64 4.2.46-12.el7 base
|
16
|
+
bind-libs-lite.x86_64 32:9.9.4-18.el7_1.1 updates
|
17
|
+
bind-license.noarch 32:9.9.4-18.el7_1.1 updates
|
18
|
+
binutils.x86_64 2.23.52.0.1-30.el7_1.2 updates
|
19
|
+
biosdevname.x86_64 0.6.1-2.el7 base
|
20
|
+
btrfs-progs.x86_64 3.16.2-1.el7 base
|
21
|
+
ca-certificates.noarch 2015.2.4-70.0.el7_1 updates
|
22
|
+
centos-logos.noarch 70.0.6-2.el7.centos updates
|
23
|
+
centos-release.x86_64 7-1.1503.el7.centos.2.8 base
|
24
|
+
cpp.x86_64 4.8.3-9.el7 base
|
25
|
+
cronie.x86_64 1.4.11-13.el7 base
|
26
|
+
cronie-anacron.x86_64 1.4.11-13.el7 base
|
27
|
+
cryptsetup-libs.x86_64 1.6.6-3.el7 base
|
28
|
+
dbus.x86_64 1:1.6.12-11.el7 base
|
29
|
+
dbus-libs.x86_64 1:1.6.12-11.el7 base
|
30
|
+
device-mapper.x86_64 7:1.02.93-3.el7 base
|
31
|
+
device-mapper-event.x86_64 7:1.02.93-3.el7 base
|
32
|
+
device-mapper-event-libs.x86_64 7:1.02.93-3.el7 base
|
33
|
+
device-mapper-libs.x86_64 7:1.02.93-3.el7 base
|
34
|
+
Random plugin output
|
35
|
+
Loaded plugins: fastestmirror, product-id, fake-plugin
|
36
|
+
Random plugin failed, is the mirror available?
|
@@ -57,6 +57,23 @@ describe Puppet::Indirector::FileContent::FileServer, " when finding files" do
|
|
57
57
|
expect(result.content).to eq("1\r\n")
|
58
58
|
end
|
59
59
|
|
60
|
+
it "should find file content of tasks in modules" do
|
61
|
+
path = tmpfile("task_file_content")
|
62
|
+
Dir.mkdir(path)
|
63
|
+
|
64
|
+
modpath = File.join(path, "myothermod")
|
65
|
+
FileUtils.mkdir_p(File.join(modpath, "tasks"))
|
66
|
+
file = File.join(modpath, "tasks", "mytask")
|
67
|
+
File.open(file, "wb") { |f| f.write "I'm a task" }
|
68
|
+
|
69
|
+
env = Puppet::Node::Environment.create(:foo, [path])
|
70
|
+
result = Puppet::FileServing::Content.indirection.find("tasks/myothermod/mytask", :environment => env)
|
71
|
+
|
72
|
+
expect(result).not_to be_nil
|
73
|
+
expect(result).to be_instance_of(Puppet::FileServing::Content)
|
74
|
+
expect(result.content).to eq("I'm a task")
|
75
|
+
end
|
76
|
+
|
60
77
|
it "should find file content in files when node name expansions are used" do
|
61
78
|
Puppet::FileSystem.stubs(:exist?).returns true
|
62
79
|
Puppet::FileSystem.stubs(:exist?).with(Puppet[:fileserverconfig]).returns(true)
|
@@ -42,6 +42,16 @@ describe Puppet::Indirector::FileMetadata::FileServer, " when finding files" do
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
+
describe "that are tasks in modules" do
|
46
|
+
with_checksum_types("task_file_content", "mymod/tasks/mytask") do
|
47
|
+
it "should return the correct metadata" do
|
48
|
+
env = Puppet::Node::Environment.create(:foo, [env_path])
|
49
|
+
result = Puppet::FileServing::Metadata.indirection.find("tasks/mymod/mytask", :environment => env, :checksum_type => checksum_type)
|
50
|
+
expect_correct_checksum(result, checksum_type, checksum, Puppet::FileServing::Metadata)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
45
55
|
describe "when node name expansions are used" do
|
46
56
|
with_checksum_types("file_server_testing", "mynode/myfile") do
|
47
57
|
it "should return the correct metadata" do
|
@@ -34,6 +34,51 @@ describe "Puppet::Util::Windows::Process", :if => Puppet.features.microsoft_wind
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
+
describe "when reading environment variables" do
|
38
|
+
after :each do
|
39
|
+
# spec\integration\test\test_helper_spec.rb calls set_environment_strings
|
40
|
+
# after :all and thus needs access to the real APIs once again
|
41
|
+
Puppet::Util::Windows::Process.unstub(:GetEnvironmentStringsW)
|
42
|
+
Puppet::Util::Windows::Process.unstub(:FreeEnvironmentStringsW)
|
43
|
+
end
|
44
|
+
|
45
|
+
it "will ignore only keys or values with corrupt byte sequences" do
|
46
|
+
arraydest = []
|
47
|
+
Puppet::Util::Log.newdestination(Puppet::Test::LogCollector.new(arraydest))
|
48
|
+
|
49
|
+
env_vars = {}
|
50
|
+
|
51
|
+
# Create a UTF-16LE version of the below null separated environment string
|
52
|
+
# "a=b\x00c=d\x00e=\xDD\xDD\x00f=g\x00\x00"
|
53
|
+
env_var_block =
|
54
|
+
"a=b\x00".encode(Encoding::UTF_16LE) +
|
55
|
+
"c=d\x00".encode(Encoding::UTF_16LE) +
|
56
|
+
'e='.encode(Encoding::UTF_16LE) + "\xDD\xDD".force_encoding(Encoding::UTF_16LE) + "\x00".encode(Encoding::UTF_16LE) +
|
57
|
+
"f=g\x00\x00".encode(Encoding::UTF_16LE)
|
58
|
+
|
59
|
+
env_var_block_bytes = env_var_block.bytes.to_a
|
60
|
+
|
61
|
+
FFI::MemoryPointer.new(:byte, env_var_block_bytes.count) do |ptr|
|
62
|
+
# uchar here is synonymous with byte
|
63
|
+
ptr.put_array_of_uchar(0, env_var_block_bytes)
|
64
|
+
|
65
|
+
# stub the block of memory that the Win32 API would typically return via pointer
|
66
|
+
Puppet::Util::Windows::Process.expects(:GetEnvironmentStringsW).returns(ptr)
|
67
|
+
# stub out the real API call to free memory, else process crashes
|
68
|
+
Puppet::Util::Windows::Process.expects(:FreeEnvironmentStringsW)
|
69
|
+
|
70
|
+
env_vars = Puppet::Util::Windows::Process.get_environment_strings
|
71
|
+
end
|
72
|
+
|
73
|
+
# based on corrupted memory, the e=\xDD\xDD should have been removed from the set
|
74
|
+
expect(env_vars).to eq({'a' => 'b', 'c' => 'd', 'f' => 'g'})
|
75
|
+
|
76
|
+
# and Puppet should emit a warning about it
|
77
|
+
expect(arraydest.last.level).to eq(:warning)
|
78
|
+
expect(arraydest.last.message).to eq("Discarding environment variable e=\uFFFD which contains invalid bytes")
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
37
82
|
describe "when setting environment variables" do
|
38
83
|
it "can properly handle env var values with = in them" do
|
39
84
|
begin
|
@@ -20,6 +20,16 @@ module PuppetSpec::Modules
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
+
if tasks = options[:tasks]
|
24
|
+
tasks_dir = File.join(module_dir, 'tasks')
|
25
|
+
FileUtils.mkdir_p(tasks_dir)
|
26
|
+
tasks.each do |task_files|
|
27
|
+
task_files.each do |task_file|
|
28
|
+
FileUtils.touch(File.join(tasks_dir, task_file))
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
23
33
|
Puppet::Module.new(name, module_dir, environment)
|
24
34
|
end
|
25
35
|
|
@@ -93,6 +93,7 @@ shared_context 'types_setup' do
|
|
93
93
|
Puppet::Pops::Types::PFloatType,
|
94
94
|
Puppet::Pops::Types::PBooleanType,
|
95
95
|
Puppet::Pops::Types::PEnumType,
|
96
|
+
Puppet::Pops::Types::PPatternType,
|
96
97
|
]
|
97
98
|
end
|
98
99
|
def scalar_data_types
|
@@ -161,18 +162,32 @@ shared_context 'types_setup' do
|
|
161
162
|
end
|
162
163
|
|
163
164
|
def self.data_compatible_types
|
165
|
+
tf = Puppet::Pops::Types::TypeFactory
|
164
166
|
result = scalar_data_types
|
165
|
-
result << Puppet::Pops::Types::PArrayType.new(
|
166
|
-
result << Puppet::Pops::Types::PHashType.new(Puppet::Pops::Types::PStringType::DEFAULT,
|
167
|
+
result << Puppet::Pops::Types::PArrayType.new(tf.data)
|
168
|
+
result << Puppet::Pops::Types::PHashType.new(Puppet::Pops::Types::PStringType::DEFAULT, tf.data)
|
167
169
|
result << Puppet::Pops::Types::PUndefType
|
168
|
-
result << Puppet::Pops::Types::
|
169
|
-
result << Puppet::Pops::Types::PTupleType.new([Puppet::Pops::Types::PScalarDataType::DEFAULT])
|
170
|
+
result << Puppet::Pops::Types::PTupleType.new([tf.data])
|
170
171
|
result
|
171
172
|
end
|
172
173
|
def data_compatible_types
|
173
174
|
self.class.data_compatible_types
|
174
175
|
end
|
175
176
|
|
177
|
+
def self.rich_data_compatible_types
|
178
|
+
tf = Puppet::Pops::Types::TypeFactory
|
179
|
+
result = scalar_types
|
180
|
+
result << Puppet::Pops::Types::PArrayType.new(tf.rich_data)
|
181
|
+
result << Puppet::Pops::Types::PHashType.new(tf.rich_data_key, tf.rich_data)
|
182
|
+
result << Puppet::Pops::Types::PUndefType
|
183
|
+
result << Puppet::Pops::Types::PDefaultType
|
184
|
+
result << Puppet::Pops::Types::PTupleType.new([tf.rich_data])
|
185
|
+
result
|
186
|
+
end
|
187
|
+
def rich_data_compatible_types
|
188
|
+
self.class.rich_data_compatible_types
|
189
|
+
end
|
190
|
+
|
176
191
|
def self.type_from_class(c)
|
177
192
|
c.is_a?(Class) ? c::DEFAULT : c
|
178
193
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -8,19 +8,18 @@ $LOAD_PATH.unshift File.join(dir, 'lib')
|
|
8
8
|
# Don't want puppet getting the command line arguments for rake or autotest
|
9
9
|
ARGV.clear
|
10
10
|
|
11
|
-
# Stub out gettext's `_` method, which attempts to load translations.
|
12
|
-
# Several of our mocks (mostly around file system interaction) are broken by
|
13
|
-
# FastGettext's implementation of this method.
|
14
|
-
def _(msg)
|
15
|
-
msg
|
16
|
-
end
|
17
|
-
|
18
11
|
begin
|
19
12
|
require 'rubygems'
|
20
13
|
rescue LoadError
|
21
14
|
end
|
22
15
|
|
23
16
|
require 'puppet'
|
17
|
+
|
18
|
+
# Stub out gettext's `_` and `n_()` methods, which attempt to load translations.
|
19
|
+
# Several of our mocks (mostly around file system interaction) are broken by
|
20
|
+
# FastGettext's implementation of these methods.
|
21
|
+
require 'puppet/gettext/stubs'
|
22
|
+
|
24
23
|
gem 'rspec', '>=3.1.0'
|
25
24
|
require 'rspec/expectations'
|
26
25
|
require 'rspec/its'
|
data/spec/unit/face/help_spec.rb
CHANGED
@@ -103,13 +103,13 @@ describe Puppet::Face[:help, '0.0.1'] do
|
|
103
103
|
end
|
104
104
|
|
105
105
|
it "returns an 'unavailable' summary if the 'agent' application fails to generate help" do
|
106
|
-
Puppet::Application['agent'].class.any_instance.stubs(:
|
106
|
+
Puppet::Application['agent'].class.any_instance.stubs(:summary).raises(ArgumentError, "whoops")
|
107
107
|
|
108
108
|
expect(subject).to match(/agent\s+! Subcommand unavailable due to error\. Check error logs\./)
|
109
109
|
end
|
110
110
|
|
111
111
|
it "returns an 'unavailable' summary if the legacy application raises a LoadError" do
|
112
|
-
Puppet::Application['agent'].class.any_instance.stubs(:
|
112
|
+
Puppet::Application['agent'].class.any_instance.stubs(:summary).raises(LoadError, "cannot load such file -- yard")
|
113
113
|
|
114
114
|
expect(subject).to match(/agent\s+! Subcommand unavailable due to error\. Check error logs\./)
|
115
115
|
end
|
@@ -83,14 +83,15 @@ describe Puppet::FileServing::Configuration do
|
|
83
83
|
expect(config.mounted?("one")).to be_truthy
|
84
84
|
end
|
85
85
|
|
86
|
-
it "should add modules and
|
86
|
+
it "should add modules, plugins, and tasks mounts even if the file does not exist" do
|
87
87
|
Puppet::FileSystem.expects(:exist?).returns false # the file doesn't exist
|
88
88
|
config = Puppet::FileServing::Configuration.configuration
|
89
89
|
expect(config.mounted?("modules")).to be_truthy
|
90
90
|
expect(config.mounted?("plugins")).to be_truthy
|
91
|
+
expect(config.mounted?("tasks")).to be_truthy
|
91
92
|
end
|
92
93
|
|
93
|
-
it "should allow all access to modules and
|
94
|
+
it "should allow all access to modules, plugins, and tasks if no fileserver.conf exists" do
|
94
95
|
Puppet::FileSystem.expects(:exist?).returns false # the file doesn't exist
|
95
96
|
modules = stub 'modules', :empty? => true
|
96
97
|
Puppet::FileServing::Mount::Modules.stubs(:new).returns(modules)
|
@@ -100,10 +101,14 @@ describe Puppet::FileServing::Configuration do
|
|
100
101
|
Puppet::FileServing::Mount::Plugins.stubs(:new).returns(plugins)
|
101
102
|
plugins.expects(:allow).with('*')
|
102
103
|
|
104
|
+
tasks = stub 'tasks', :empty? => true
|
105
|
+
Puppet::FileServing::Mount::Tasks.stubs(:new).returns(tasks)
|
106
|
+
tasks.expects(:allow).with('*')
|
107
|
+
|
103
108
|
Puppet::FileServing::Configuration.configuration
|
104
109
|
end
|
105
110
|
|
106
|
-
it "should not allow access from all to modules and
|
111
|
+
it "should not allow access from all to modules, plugins, and tasks if the fileserver.conf provided some rules" do
|
107
112
|
Puppet::FileSystem.expects(:exist?).returns false # the file doesn't exist
|
108
113
|
|
109
114
|
modules = stub 'modules', :empty? => false
|
@@ -114,15 +119,20 @@ describe Puppet::FileServing::Configuration do
|
|
114
119
|
Puppet::FileServing::Mount::Plugins.stubs(:new).returns(plugins)
|
115
120
|
plugins.expects(:allow).with('*').never
|
116
121
|
|
122
|
+
tasks = stub 'tasks', :empty? => false
|
123
|
+
Puppet::FileServing::Mount::Tasks.stubs(:new).returns(tasks)
|
124
|
+
tasks.expects(:allow).with('*').never
|
125
|
+
|
117
126
|
Puppet::FileServing::Configuration.configuration
|
118
127
|
end
|
119
128
|
|
120
|
-
it "should add modules and
|
129
|
+
it "should add modules, plugins, and tasks mounts even if they are not returned by the parser" do
|
121
130
|
@parser.expects(:parse).returns("one" => mock("mount"))
|
122
131
|
Puppet::FileSystem.expects(:exist?).returns true # the file doesn't exist
|
123
132
|
config = Puppet::FileServing::Configuration.configuration
|
124
133
|
expect(config.mounted?("modules")).to be_truthy
|
125
134
|
expect(config.mounted?("plugins")).to be_truthy
|
135
|
+
expect(config.mounted?("tasks")).to be_truthy
|
126
136
|
end
|
127
137
|
end
|
128
138
|
|
@@ -41,7 +41,7 @@ describe Puppet::FileServing::Mount::Modules do
|
|
41
41
|
|
42
42
|
describe "when searching for files" do
|
43
43
|
it "should fail if no module is specified" do
|
44
|
-
expect { @mount.
|
44
|
+
expect { @mount.search("", @request) }.to raise_error(/No module specified/)
|
45
45
|
end
|
46
46
|
|
47
47
|
it "should use the node's environment to search the module" do
|
@@ -0,0 +1,72 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
require 'spec_helper'
|
3
|
+
require 'puppet/file_serving/mount/tasks'
|
4
|
+
|
5
|
+
describe Puppet::FileServing::Mount::Tasks do
|
6
|
+
before do
|
7
|
+
@mount = Puppet::FileServing::Mount::Tasks.new("tasks")
|
8
|
+
|
9
|
+
@environment = stub 'environment', :module => nil
|
10
|
+
@request = stub 'request', :environment => @environment
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "when finding task files" do
|
14
|
+
it "should fail if no task is specified" do
|
15
|
+
expect { @mount.find("", @request) }.to raise_error(/No task specified/)
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should use the request's environment to find the module" do
|
19
|
+
mod_name = 'foo'
|
20
|
+
@environment.expects(:module).with(mod_name)
|
21
|
+
|
22
|
+
@mount.find(mod_name, @request)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should use the first segment of the request's path as the module name" do
|
26
|
+
@environment.expects(:module).with("foo")
|
27
|
+
@mount.find("foo/bartask", @request)
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should return nil if the module in the path doesn't exist" do
|
31
|
+
@environment.expects(:module).with("foo").returns(nil)
|
32
|
+
expect(@mount.find("foo/bartask", @request)).to be_nil
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should return the file path from the module" do
|
36
|
+
mod = mock('module')
|
37
|
+
mod.expects(:task_file).with("bartask").returns("mocked")
|
38
|
+
@environment.expects(:module).with("foo").returns(mod)
|
39
|
+
expect(@mount.find("foo/bartask", @request)).to eq("mocked")
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe "when searching for task files" do
|
44
|
+
it "should fail if no module is specified" do
|
45
|
+
expect { @mount.search("", @request) }.to raise_error(/No task specified/)
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should use the request's environment to find the module" do
|
49
|
+
mod_name = 'foo'
|
50
|
+
@environment.expects(:module).with(mod_name)
|
51
|
+
|
52
|
+
@mount.search(mod_name, @request)
|
53
|
+
end
|
54
|
+
|
55
|
+
it "should use the first segment of the request's path as the module name" do
|
56
|
+
@environment.expects(:module).with("foo")
|
57
|
+
@mount.search("foo/bartask", @request)
|
58
|
+
end
|
59
|
+
|
60
|
+
it "should return nil if the module in the path doesn't exist" do
|
61
|
+
@environment.expects(:module).with("foo").returns(nil)
|
62
|
+
expect(@mount.search("foo/bartask", @request)).to be_nil
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should return the file path from the module" do
|
66
|
+
mod = mock('module')
|
67
|
+
mod.expects(:task_file).with("bartask").returns("mocked")
|
68
|
+
@environment.expects(:module).with("foo").returns(mod)
|
69
|
+
expect(@mount.search("foo/bartask", @request)).to eq(["mocked"])
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -17,6 +17,11 @@ describe "the epp function" do
|
|
17
17
|
expect(eval_template("<%= $kryptonite == undef %>")).to eq("true")
|
18
18
|
end
|
19
19
|
|
20
|
+
it "gets error accessing a variable that is malformed" do
|
21
|
+
expect { eval_template("<%= $kryptonite::USER %>")}.to raise_error(
|
22
|
+
/Illegal variable name, The given name 'kryptonite::USER' does not conform to the naming rule/)
|
23
|
+
end
|
24
|
+
|
20
25
|
it "get nil accessing a variable that is undef" do
|
21
26
|
scope['undef_var'] = nil
|
22
27
|
expect(eval_template("<%= $undef_var == undef %>")).to eq("true")
|
@@ -30,7 +30,7 @@ describe 'the regsubst function' do
|
|
30
30
|
end
|
31
31
|
|
32
32
|
it 'should raise an Error if given a bad flag' do
|
33
|
-
expect { regsubst('foo', 'bar', 'gazonk', 'X') }.to raise_error(/parameter 'flags' expects a match for Pattern\[\/\^\[GEIM\]\*\$\/\], got 'X'/)
|
33
|
+
expect { regsubst('foo', 'bar', 'gazonk', 'X') }.to raise_error(/parameter 'flags' expects an undef value or a match for Pattern\[\/\^\[GEIM\]\*\$\/\], got 'X'/)
|
34
34
|
end
|
35
35
|
|
36
36
|
it 'should raise an Error if given a bad encoding' do
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'puppet/gettext/config'
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe Puppet::GettextConfig do
|
5
|
+
require 'puppet_spec/files'
|
6
|
+
include PuppetSpec::Files
|
7
|
+
|
8
|
+
let(:local_path) do
|
9
|
+
local_path ||= Puppet::GettextConfig::LOCAL_PATH
|
10
|
+
end
|
11
|
+
|
12
|
+
let(:windows_path) do
|
13
|
+
windows_path ||= Puppet::GettextConfig::WINDOWS_PATH
|
14
|
+
end
|
15
|
+
|
16
|
+
let(:posix_path) do
|
17
|
+
windows_path ||= Puppet::GettextConfig::POSIX_PATH
|
18
|
+
end
|
19
|
+
|
20
|
+
describe 'translation mode selection' do
|
21
|
+
it 'should select PO mode when given a local config path' do
|
22
|
+
expect(Puppet::GettextConfig.translation_mode(local_path)).to eq(:po)
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'should select PO mode when given a non-package config path' do
|
26
|
+
expect(Puppet::GettextConfig.translation_mode('../fake/path')).to eq(:po)
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'should select MO mode when given a Windows package config path' do
|
30
|
+
expect(Puppet::GettextConfig.translation_mode(windows_path)).to eq(:mo)
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'should select MO mode when given a POSIX package config path' do
|
34
|
+
expect(Puppet::GettextConfig.translation_mode(posix_path)).to eq(:mo)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe 'initialization' do
|
39
|
+
context 'when given a nil config path' do
|
40
|
+
it 'should return false' do
|
41
|
+
expect(Puppet::GettextConfig.initialize(nil, :po)).to be false
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
context 'when given a valid config file location' do
|
46
|
+
it 'should return true' do
|
47
|
+
expect(Puppet::GettextConfig.initialize(local_path, :po)).to be true
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
context 'when given a bad file format' do
|
52
|
+
it 'should raise an exception' do
|
53
|
+
expect { Puppet::GettextConfig.initialize(local_path, :bad_format) }.to raise_error(Puppet::Error)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|