puppet 6.17.0-x86-mingw32 → 6.18.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.
- checksums.yaml +4 -4
- data/Gemfile.lock +6 -5
- data/lib/puppet/application/apply.rb +18 -20
- data/lib/puppet/application/lookup.rb +16 -4
- data/lib/puppet/configurer/downloader.rb +31 -10
- data/lib/puppet/confine.rb +1 -1
- data/lib/puppet/confine/any.rb +1 -1
- data/lib/puppet/defaults.rb +21 -3
- data/lib/puppet/feature/base.rb +1 -1
- data/lib/puppet/file_serving/mount/locales.rb +1 -2
- data/lib/puppet/file_serving/mount/pluginfacts.rb +1 -2
- data/lib/puppet/file_serving/mount/plugins.rb +1 -2
- data/lib/puppet/file_system/file_impl.rb +3 -3
- data/lib/puppet/functions/lstrip.rb +4 -4
- data/lib/puppet/functions/reverse_each.rb +1 -1
- data/lib/puppet/functions/rstrip.rb +4 -4
- data/lib/puppet/functions/step.rb +1 -1
- data/lib/puppet/functions/strip.rb +4 -4
- data/lib/puppet/gettext/config.rb +5 -5
- data/lib/puppet/gettext/module_translations.rb +4 -4
- data/lib/puppet/indirector/exec.rb +1 -1
- data/lib/puppet/indirector/facts/facter.rb +3 -3
- data/lib/puppet/indirector/file_metadata/http.rb +1 -0
- data/lib/puppet/indirector/hiera.rb +4 -0
- data/lib/puppet/indirector/indirection.rb +1 -1
- data/lib/puppet/indirector/report/processor.rb +2 -2
- data/lib/puppet/module.rb +1 -2
- data/lib/puppet/network/format_support.rb +2 -2
- data/lib/puppet/network/http/route.rb +2 -2
- data/lib/puppet/node/environment.rb +12 -5
- data/lib/puppet/pal/pal_impl.rb +27 -3
- data/lib/puppet/parameter.rb +1 -1
- data/lib/puppet/parser/functions.rb +21 -17
- data/lib/puppet/parser/functions/create_resources.rb +11 -7
- data/lib/puppet/parser/type_loader.rb +2 -2
- data/lib/puppet/pops/adaptable.rb +7 -13
- data/lib/puppet/pops/adapters.rb +8 -4
- data/lib/puppet/pops/loader/runtime3_type_loader.rb +4 -2
- data/lib/puppet/pops/loaders.rb +18 -11
- data/lib/puppet/pops/lookup/context.rb +1 -1
- data/lib/puppet/pops/lookup/hiera_config.rb +14 -1
- data/lib/puppet/pops/types/iterable.rb +34 -8
- data/lib/puppet/pops/validation/checker4_0.rb +19 -15
- data/lib/puppet/provider/file/windows.rb +1 -1
- data/lib/puppet/provider/package/apt.rb +34 -0
- data/lib/puppet/provider/package/gem.rb +4 -2
- data/lib/puppet/provider/package/puppet_gem.rb +5 -0
- data/lib/puppet/provider/package/zypper.rb +3 -0
- data/lib/puppet/provider/user/aix.rb +1 -1
- data/lib/puppet/provider/user/user_role_add.rb +1 -1
- data/lib/puppet/provider/user/windows_adsi.rb +18 -1
- data/lib/puppet/settings.rb +1 -1
- data/lib/puppet/ssl/validator/default_validator.rb +1 -1
- data/lib/puppet/test/test_helper.rb +10 -3
- data/lib/puppet/transaction.rb +2 -2
- data/lib/puppet/transaction/persistence.rb +1 -1
- data/lib/puppet/transaction/report.rb +1 -1
- data/lib/puppet/trusted_external.rb +2 -2
- data/lib/puppet/type.rb +4 -3
- data/lib/puppet/type/file.rb +2 -2
- data/lib/puppet/type/file/source.rb +27 -7
- data/lib/puppet/type/notify.rb +2 -2
- data/lib/puppet/type/service.rb +4 -0
- data/lib/puppet/type/user.rb +18 -3
- data/lib/puppet/util.rb +26 -12
- data/lib/puppet/util/autoload.rb +9 -7
- data/lib/puppet/util/character_encoding.rb +9 -5
- data/lib/puppet/util/execution.rb +2 -2
- data/lib/puppet/util/windows.rb +1 -0
- data/lib/puppet/util/windows/api_types.rb +15 -1
- data/lib/puppet/util/windows/monkey_patches/dir.rb +40 -0
- data/lib/puppet/util/windows/security.rb +4 -4
- data/lib/puppet/util/windows/user.rb +219 -0
- data/lib/puppet/version.rb +1 -1
- data/locales/puppet.pot +78 -69
- data/man/man5/puppet.conf.5 +22 -3
- data/man/man8/puppet-agent.8 +1 -1
- data/man/man8/puppet-apply.8 +1 -1
- data/man/man8/puppet-catalog.8 +1 -1
- data/man/man8/puppet-config.8 +1 -1
- data/man/man8/puppet-describe.8 +1 -1
- data/man/man8/puppet-device.8 +1 -1
- data/man/man8/puppet-doc.8 +1 -1
- data/man/man8/puppet-epp.8 +1 -1
- data/man/man8/puppet-facts.8 +1 -1
- data/man/man8/puppet-filebucket.8 +1 -1
- data/man/man8/puppet-generate.8 +1 -1
- data/man/man8/puppet-help.8 +1 -1
- data/man/man8/puppet-key.8 +1 -1
- data/man/man8/puppet-lookup.8 +2 -2
- data/man/man8/puppet-man.8 +1 -1
- data/man/man8/puppet-module.8 +1 -1
- data/man/man8/puppet-node.8 +1 -1
- data/man/man8/puppet-parser.8 +1 -1
- data/man/man8/puppet-plugin.8 +1 -1
- data/man/man8/puppet-report.8 +1 -1
- data/man/man8/puppet-resource.8 +1 -1
- data/man/man8/puppet-script.8 +1 -1
- data/man/man8/puppet-ssl.8 +1 -1
- data/man/man8/puppet-status.8 +1 -1
- data/man/man8/puppet.8 +2 -2
- data/spec/fixtures/integration/application/apply/environments/spec/modules/amod/lib/puppet/provider/applytest/applytest.rb +2 -0
- data/spec/fixtures/integration/application/apply/environments/spec/modules/amod/lib/puppet/type/applytest.rb +25 -0
- data/spec/fixtures/unit/forge/bacula-releases.json +128 -0
- data/spec/fixtures/unit/forge/bacula.tar.gz +0 -0
- data/spec/integration/application/agent_spec.rb +29 -37
- data/spec/integration/application/apply_spec.rb +149 -149
- data/spec/integration/application/config_spec.rb +74 -0
- data/spec/integration/application/doc_spec.rb +16 -6
- data/spec/integration/application/filebucket_spec.rb +65 -16
- data/spec/integration/application/help_spec.rb +42 -0
- data/spec/integration/application/lookup_spec.rb +13 -0
- data/spec/integration/application/module_spec.rb +68 -0
- data/spec/integration/application/plugin_spec.rb +50 -0
- data/spec/integration/data_binding_spec.rb +82 -0
- data/spec/integration/directory_environments_spec.rb +17 -17
- data/spec/integration/indirector/facts/facter_spec.rb +8 -6
- data/spec/integration/node/environment_spec.rb +1 -1
- data/spec/integration/util/execution_spec.rb +22 -0
- data/spec/integration/util/windows/monkey_patches/dir_spec.rb +11 -0
- data/spec/integration/util/windows/process_spec.rb +26 -32
- data/spec/integration/util/windows/user_spec.rb +7 -0
- data/spec/integration/util_spec.rb +7 -33
- data/spec/lib/puppet_spec/matchers.rb +0 -80
- data/spec/lib/puppet_spec/puppetserver.rb +8 -0
- data/spec/unit/application/agent_spec.rb +3 -4
- data/spec/unit/application/face_base_spec.rb +6 -4
- data/spec/unit/application/facts_spec.rb +39 -10
- data/spec/unit/application/man_spec.rb +52 -0
- data/spec/unit/application/resource_spec.rb +3 -1
- data/spec/unit/application/ssl_spec.rb +15 -2
- data/spec/unit/configurer/downloader_spec.rb +10 -0
- data/spec/unit/configurer_spec.rb +47 -31
- data/spec/unit/confine_spec.rb +2 -1
- data/spec/unit/face/config_spec.rb +3 -1
- data/spec/unit/file_serving/mount/locales_spec.rb +2 -2
- data/spec/unit/file_serving/mount/pluginfacts_spec.rb +2 -2
- data/spec/unit/file_serving/mount/plugins_spec.rb +2 -2
- data/spec/unit/file_system/uniquefile_spec.rb +18 -0
- data/spec/unit/http/client_spec.rb +0 -1
- data/spec/unit/http/resolver_spec.rb +0 -1
- data/spec/unit/http/service/ca_spec.rb +0 -1
- data/spec/unit/http/service/compiler_spec.rb +0 -1
- data/spec/unit/http/service/file_server_spec.rb +0 -1
- data/spec/unit/http/service/report_spec.rb +0 -1
- data/spec/unit/http/service_spec.rb +0 -1
- data/spec/unit/http/session_spec.rb +0 -1
- data/spec/unit/module_tool/tar/mini_spec.rb +20 -0
- data/spec/unit/network/format_support_spec.rb +3 -2
- data/spec/unit/node/environment_spec.rb +18 -1
- data/spec/unit/pops/loaders/loaders_spec.rb +70 -0
- data/spec/unit/pops/lookup/lookup_spec.rb +25 -0
- data/spec/unit/provider/package/apt_spec.rb +77 -0
- data/spec/unit/provider/package/aptitude_spec.rb +1 -0
- data/spec/unit/provider/package/puppet_gem_spec.rb +4 -1
- data/spec/unit/provider/package/zypper_spec.rb +14 -0
- data/spec/unit/provider/service/init_spec.rb +41 -0
- data/spec/unit/provider/service/systemd_spec.rb +1 -6
- data/spec/unit/provider/service/windows_spec.rb +28 -0
- data/spec/unit/provider/user/windows_adsi_spec.rb +82 -0
- data/spec/unit/puppet_pal_2pec.rb +40 -0
- data/spec/unit/reports/store_spec.rb +17 -13
- data/spec/unit/transaction/persistence_spec.rb +15 -0
- data/spec/unit/type/service_spec.rb +35 -2
- data/spec/unit/type/user_spec.rb +31 -2
- data/spec/unit/util/character_encoding_spec.rb +4 -4
- data/spec/unit/util/command_line_spec.rb +11 -6
- metadata +21 -44
- data/spec/integration/faces/config_spec.rb +0 -91
- data/spec/integration/faces/documentation_spec.rb +0 -57
- data/spec/integration/file_bucket/file_spec.rb +0 -50
- data/spec/integration/file_serving/content_spec.rb +0 -7
- data/spec/integration/file_serving/fileset_spec.rb +0 -12
- data/spec/integration/file_serving/metadata_spec.rb +0 -8
- data/spec/integration/file_serving/terminus_helper_spec.rb +0 -20
- data/spec/integration/file_system/uniquefile_spec.rb +0 -26
- data/spec/integration/module_tool/forge_spec.rb +0 -51
- data/spec/integration/module_tool/tar/mini_spec.rb +0 -28
- data/spec/integration/provider/service/init_spec.rb +0 -48
- data/spec/integration/provider/service/systemd_spec.rb +0 -25
- data/spec/integration/provider/service/windows_spec.rb +0 -50
- data/spec/integration/reference/providers_spec.rb +0 -21
- data/spec/integration/reports_spec.rb +0 -13
- data/spec/integration/ssl/certificate_request_spec.rb +0 -44
- data/spec/integration/ssl/host_spec.rb +0 -72
- data/spec/integration/ssl/key_spec.rb +0 -99
- data/spec/shared_behaviours/file_serving_model.rb +0 -51
- data/spec/unit/face/man_spec.rb +0 -25
- data/spec/unit/man_spec.rb +0 -31
@@ -84,6 +84,24 @@ describe Puppet::FileSystem::Uniquefile do
|
|
84
84
|
}.to raise_error(Errno::ENOENT, %r{No such file or directory - A directory component in .* does not exist or is a dangling symbolic link})
|
85
85
|
end
|
86
86
|
|
87
|
+
it "should use UTF8 characters in TMP,TEMP,TMPDIR environment variable", :if => Puppet::Util::Platform.windows? do
|
88
|
+
rune_utf8 = "\u16A0\u16C7\u16BB\u16EB\u16D2\u16E6\u16A6\u16EB\u16A0\u16B1\u16A9\u16A0\u16A2\u16B1\u16EB\u16A0\u16C1\u16B1\u16AA\u16EB\u16B7\u16D6\u16BB\u16B9\u16E6\u16DA\u16B3\u16A2\u16D7"
|
89
|
+
temp_rune_utf8 = File.join(Dir.tmpdir, rune_utf8)
|
90
|
+
Puppet::FileSystem.mkpath(temp_rune_utf8)
|
91
|
+
|
92
|
+
# Set the temporary environment variables to the UTF8 temp path
|
93
|
+
Puppet::Util::Windows::Process.set_environment_variable('TMPDIR', temp_rune_utf8)
|
94
|
+
Puppet::Util::Windows::Process.set_environment_variable('TMP', temp_rune_utf8)
|
95
|
+
Puppet::Util::Windows::Process.set_environment_variable('TEMP', temp_rune_utf8)
|
96
|
+
|
97
|
+
# Create a unique file
|
98
|
+
filename = Puppet::FileSystem::Uniquefile.open_tmp('foo') do |file|
|
99
|
+
File.dirname(file.path)
|
100
|
+
end
|
101
|
+
|
102
|
+
expect(filename).to eq(temp_rune_utf8)
|
103
|
+
end
|
104
|
+
|
87
105
|
context "Ruby 1.9.3 Tempfile tests" do
|
88
106
|
# the remaining tests in this file are ported directly from the ruby 1.9.3 source,
|
89
107
|
# since most of this file was ported from there
|
@@ -86,4 +86,24 @@ describe Puppet::ModuleTool::Tar::Mini, :if => (Puppet.features.minitar? and Pup
|
|
86
86
|
and_yield(type, name, {:entry => entry})
|
87
87
|
entry
|
88
88
|
end
|
89
|
+
|
90
|
+
describe "Extracts tars with long and short pathnames" do
|
91
|
+
let (:sourcetar) { fixtures('module.tar.gz') }
|
92
|
+
let (:longfilepath) { "puppetlabs-dsc-1.0.0/lib/puppet_x/dsc_resources/xWebAdministration/DSCResources/MSFT_xWebAppPoolDefaults/MSFT_xWebAppPoolDefaults.schema.mof" }
|
93
|
+
let (:shortfilepath) { "puppetlabs-dsc-1.0.0/README.md" }
|
94
|
+
|
95
|
+
it "unpacks a tar with a short path length" do
|
96
|
+
extractdir = PuppetSpec::Files.tmpdir('minitar')
|
97
|
+
|
98
|
+
minitar.unpack(sourcetar,extractdir,'module')
|
99
|
+
expect(File).to exist(File.expand_path("#{extractdir}/#{shortfilepath}"))
|
100
|
+
end
|
101
|
+
|
102
|
+
it "unpacks a tar with a long path length" do
|
103
|
+
extractdir = PuppetSpec::Files.tmpdir('minitar')
|
104
|
+
|
105
|
+
minitar.unpack(sourcetar,extractdir,'module')
|
106
|
+
expect(File).to exist(File.expand_path("#{extractdir}/#{longfilepath}"))
|
107
|
+
end
|
108
|
+
end
|
89
109
|
end
|
@@ -67,8 +67,9 @@ describe Puppet::Network::FormatHandler do
|
|
67
67
|
end
|
68
68
|
|
69
69
|
it "should log a debug message" do
|
70
|
-
|
71
|
-
expect(Puppet).to receive(:debug).
|
70
|
+
Puppet[:log_level] = 'debug'
|
71
|
+
expect(Puppet).to receive(:debug) { |&b| expect(b.call).to eq("Value of 'preferred_serialization_format' (unsupported) is invalid for FormatTester, using default (two)") }
|
72
|
+
expect(Puppet).to receive(:debug) { |&b| expect(b.call).to eq("FormatTester supports formats: two one") }
|
72
73
|
FormatTester.supported_formats
|
73
74
|
end
|
74
75
|
end
|
@@ -426,7 +426,7 @@ describe Puppet::Node::Environment do
|
|
426
426
|
it "includes the Bolt project in modules if it's defined" do
|
427
427
|
path = tmpdir('project')
|
428
428
|
PuppetSpec::Modules.generate_files('bolt_project', path)
|
429
|
-
project = Struct.new("Project", :name, :path).new('bolt_project', path)
|
429
|
+
project = Struct.new("Project", :name, :path, :load_as_module?).new('bolt_project', path, true)
|
430
430
|
|
431
431
|
Puppet.override(bolt_project: project) do
|
432
432
|
%w{foo bar}.each do |mod_name|
|
@@ -438,6 +438,23 @@ describe Puppet::Node::Environment do
|
|
438
438
|
expect(env.modules.collect{|mod| mod.name}.sort).to eq(%w{bolt_project foo bar bee baz}.sort)
|
439
439
|
end
|
440
440
|
end
|
441
|
+
|
442
|
+
it "does not include the Bolt project in modules if load_as_module? is false" do
|
443
|
+
path = tmpdir('project')
|
444
|
+
PuppetSpec::Modules.generate_files('bolt_project', path)
|
445
|
+
project = Struct.new("Project", :name, :path, :load_as_module?).new('bolt_project', path, false)
|
446
|
+
|
447
|
+
Puppet.override(bolt_project: project) do
|
448
|
+
%w{foo bar}.each do |mod_name|
|
449
|
+
PuppetSpec::Modules.generate_files(mod_name, first_modulepath)
|
450
|
+
end
|
451
|
+
%w{bee baz}.each do |mod_name|
|
452
|
+
PuppetSpec::Modules.generate_files(mod_name, second_modulepath)
|
453
|
+
end
|
454
|
+
expect(env.modules.collect{|mod| mod.name}.sort).to eq(%w{foo bar bee baz}.sort)
|
455
|
+
end
|
456
|
+
|
457
|
+
end
|
441
458
|
end
|
442
459
|
end
|
443
460
|
end
|
@@ -92,6 +92,35 @@ describe 'loaders' do
|
|
92
92
|
it 'errors with message about empty file for files that contain no logic' do
|
93
93
|
expect{loader.load(:resource_type_pp, 'empty')}.to raise_error(ArgumentError, /it is empty/)
|
94
94
|
end
|
95
|
+
|
96
|
+
it 'creates a pcore resource type loader' do
|
97
|
+
pcore_loader = env.loaders.runtime3_type_loader.resource_3x_loader
|
98
|
+
expect(pcore_loader.loader_name).to eq('pcore_resource_types')
|
99
|
+
expect(pcore_loader).to be_a(Puppet::Pops::Loader::ModuleLoaders::FileBased)
|
100
|
+
end
|
101
|
+
|
102
|
+
it 'does not create a pcore resource type loader if requested not to' do
|
103
|
+
env.loaders = nil # clear cached loaders
|
104
|
+
loaders = Puppet::Pops::Loaders.new(env, false, false)
|
105
|
+
expect(loaders.runtime3_type_loader.resource_3x_loader).to be_nil
|
106
|
+
end
|
107
|
+
|
108
|
+
it 'does not create a pcore resource type loader for an empty environment' do
|
109
|
+
loaders = Puppet::Pops::Loaders.new(empty_test_env)
|
110
|
+
expect(loaders.runtime3_type_loader.resource_3x_loader).to be_nil
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
def expect_loader_hierarchy(loaders, expected_loaders)
|
115
|
+
actual_loaders = []
|
116
|
+
|
117
|
+
loader = loaders.private_environment_loader
|
118
|
+
while loader
|
119
|
+
actual_loaders << [loader.loader_name, loader]
|
120
|
+
loader = loader.parent
|
121
|
+
end
|
122
|
+
|
123
|
+
expect(actual_loaders).to contain_exactly(*expected_loaders)
|
95
124
|
end
|
96
125
|
|
97
126
|
it 'creates a puppet_system loader' do
|
@@ -123,6 +152,47 @@ describe 'loaders' do
|
|
123
152
|
expect(loaders.private_environment_loader().to_s).to eql("(DependencyLoader 'environment private' [])")
|
124
153
|
end
|
125
154
|
|
155
|
+
it 'creates a hierarchy of loaders' do
|
156
|
+
expect_loader_hierarchy(
|
157
|
+
Puppet::Pops::Loaders.new(empty_test_env),
|
158
|
+
[
|
159
|
+
[nil, Puppet::Pops::Loader::StaticLoader],
|
160
|
+
['puppet_system', Puppet::Pops::Loader::ModuleLoaders::LibRootedFileBased],
|
161
|
+
[empty_test_env.name, Puppet::Pops::Loader::Runtime3TypeLoader],
|
162
|
+
['environment', Puppet::Pops::Loader::SimpleEnvironmentLoader],
|
163
|
+
['environment private', Puppet::Pops::Loader::DependencyLoader],
|
164
|
+
]
|
165
|
+
)
|
166
|
+
end
|
167
|
+
|
168
|
+
it 'excludes the Runtime3TypeLoader when tasks are enabled' do
|
169
|
+
Puppet[:tasks] = true
|
170
|
+
|
171
|
+
expect_loader_hierarchy(
|
172
|
+
Puppet::Pops::Loaders.new(empty_test_env),
|
173
|
+
[
|
174
|
+
[nil, Puppet::Pops::Loader::StaticLoader],
|
175
|
+
['puppet_system', Puppet::Pops::Loader::ModuleLoaders::LibRootedFileBased],
|
176
|
+
['environment', Puppet::Pops::Loader::ModuleLoaders::EmptyLoader],
|
177
|
+
['environment private', Puppet::Pops::Loader::DependencyLoader],
|
178
|
+
]
|
179
|
+
)
|
180
|
+
end
|
181
|
+
|
182
|
+
it 'includes the agent cache loader when for_agent is true' do
|
183
|
+
expect_loader_hierarchy(
|
184
|
+
Puppet::Pops::Loaders.new(empty_test_env, true),
|
185
|
+
[
|
186
|
+
[nil, Puppet::Pops::Loader::StaticLoader],
|
187
|
+
['puppet_system', Puppet::Pops::Loader::ModuleLoaders::LibRootedFileBased],
|
188
|
+
['cached_puppet_lib', Puppet::Pops::Loader::ModuleLoaders::LibRootedFileBased],
|
189
|
+
[empty_test_env.name, Puppet::Pops::Loader::Runtime3TypeLoader],
|
190
|
+
['environment', Puppet::Pops::Loader::SimpleEnvironmentLoader],
|
191
|
+
['environment private', Puppet::Pops::Loader::DependencyLoader],
|
192
|
+
],
|
193
|
+
)
|
194
|
+
end
|
195
|
+
|
126
196
|
context 'when loading from a module' do
|
127
197
|
it 'loads a ruby function using a qualified or unqualified name' do
|
128
198
|
loaders = Puppet::Pops::Loaders.new(environment_for(module_with_metadata))
|
@@ -14,6 +14,7 @@ describe 'The lookup API' do
|
|
14
14
|
let(:env) { Puppet::Node::Environment.create(env_name.to_sym, [File.join(populated_env_dir, 'modules')]) }
|
15
15
|
let(:node) { Puppet::Node.new('test', :environment => env) }
|
16
16
|
let(:compiler) { Puppet::Parser::Compiler.new(node) }
|
17
|
+
let(:pal_compiler) { Puppet::Pal::ScriptCompiler.new(compiler) }
|
17
18
|
let(:scope) { compiler.topscope }
|
18
19
|
let(:invocation) { Invocation.new(scope) }
|
19
20
|
|
@@ -345,6 +346,30 @@ describe 'The lookup API' do
|
|
345
346
|
end
|
346
347
|
end
|
347
348
|
end
|
349
|
+
|
350
|
+
context 'when using plan_hierarchy' do
|
351
|
+
let(:code_dir_content) do
|
352
|
+
{
|
353
|
+
'hiera.yaml' => <<-YAML.unindent,
|
354
|
+
version: 5
|
355
|
+
plan_hierarchy:
|
356
|
+
- path: foo.yaml
|
357
|
+
name: Common
|
358
|
+
YAML
|
359
|
+
'data' => {
|
360
|
+
'foo.yaml' => <<-YAML.unindent
|
361
|
+
pop: star
|
362
|
+
YAML
|
363
|
+
}
|
364
|
+
}
|
365
|
+
end
|
366
|
+
|
367
|
+
it 'uses plan_hierarchy when using ScriptCompiler' do
|
368
|
+
Puppet.override(pal_compiler: pal_compiler) do
|
369
|
+
expect(Lookup.lookup('pop', nil, nil, true, nil, invocation)).to eq('star')
|
370
|
+
end
|
371
|
+
end
|
372
|
+
end
|
348
373
|
end
|
349
374
|
end
|
350
375
|
end
|
@@ -86,6 +86,83 @@ Version table:
|
|
86
86
|
provider.run_preseed
|
87
87
|
end
|
88
88
|
|
89
|
+
describe ".instances" do
|
90
|
+
before do
|
91
|
+
allow(Puppet::Type::Package::ProviderDpkg).to receive(:instances).and_return([resource])
|
92
|
+
end
|
93
|
+
|
94
|
+
context "when package is manual marked" do
|
95
|
+
before do
|
96
|
+
allow(described_class).to receive(:aptmark).with('showmanual').and_return("#{resource.name}\n")
|
97
|
+
end
|
98
|
+
|
99
|
+
it 'sets mark to manual' do
|
100
|
+
expect(resource).to receive(:mark=).with(:manual)
|
101
|
+
described_class.instances
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
context 'when package is not manual marked ' do
|
106
|
+
before do
|
107
|
+
allow(described_class).to receive(:aptmark).with('showmanual').and_return('')
|
108
|
+
end
|
109
|
+
|
110
|
+
it 'does not set mark to manual' do
|
111
|
+
expect(resource).not_to receive(:mark=).with(:manual)
|
112
|
+
described_class.instances
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
describe 'query' do
|
118
|
+
before do
|
119
|
+
allow(provider).to receive(:dpkgquery).and_return("name: #{resource.name}" )
|
120
|
+
end
|
121
|
+
|
122
|
+
context "when package is manual marked" do
|
123
|
+
before do
|
124
|
+
allow(described_class).to receive(:aptmark).with('showmanual').and_return("#{resource.name}\n")
|
125
|
+
end
|
126
|
+
|
127
|
+
it 'sets mark to manual' do
|
128
|
+
result = provider.query
|
129
|
+
expect(result[:mark]).to eql(:manual)
|
130
|
+
end
|
131
|
+
end
|
132
|
+
|
133
|
+
context 'when package is not manual marked ' do
|
134
|
+
before do
|
135
|
+
allow(described_class).to receive(:aptmark).with('showmanual').and_return('')
|
136
|
+
end
|
137
|
+
|
138
|
+
it 'does not set mark to manual' do
|
139
|
+
result = provider.query
|
140
|
+
expect(result[:mark]).to be_nil
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
describe 'flush' do
|
146
|
+
|
147
|
+
context "when package is manual marked" do
|
148
|
+
before do
|
149
|
+
provider.mark = :manual
|
150
|
+
end
|
151
|
+
|
152
|
+
it 'does not call aptmark' do
|
153
|
+
expect(provider).not_to receive(:aptmark)
|
154
|
+
provider.flush
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
context 'when package is not manual marked ' do
|
159
|
+
it 'calls aptmark' do
|
160
|
+
expect(described_class).to receive(:aptmark).with('manual', resource.name)
|
161
|
+
provider.flush
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
89
166
|
describe "when installing" do
|
90
167
|
it "should preseed if a responsefile is provided" do
|
91
168
|
resource[:responsefile] = "/my/file"
|
@@ -13,6 +13,7 @@ describe Puppet::Type.type(:package).provider(:aptitude) do
|
|
13
13
|
|
14
14
|
before do
|
15
15
|
allow(Puppet::Util).to receive(:which).with('/usr/bin/dpkg-query').and_return(dpkgquery_path)
|
16
|
+
allow(described_class).to receive(:aptmark).with('showmanual').and_return("")
|
16
17
|
end
|
17
18
|
|
18
19
|
{ :absent => "deinstall ok config-files faff 1.2.3-1\n",
|
@@ -20,7 +20,10 @@ describe Puppet::Type.type(:package).provider(:puppet_gem) do
|
|
20
20
|
let(:provider_gem_cmd) { '/opt/puppetlabs/puppet/bin/gem' }
|
21
21
|
end
|
22
22
|
|
23
|
-
|
23
|
+
custom_environment = {"HOME"=>ENV["HOME"]}
|
24
|
+
custom_environment['PKG_CONFIG_PATH'] = '/opt/puppetlabs/puppet/lib/pkgconfig' unless Puppet::Util::Platform.windows?
|
25
|
+
|
26
|
+
let(:execute_options) { {:failonfail => true, :combine => true, :custom_environment => custom_environment} }
|
24
27
|
|
25
28
|
before :each do
|
26
29
|
resource.provider = provider
|
@@ -309,5 +309,19 @@ describe Puppet::Type.type(:package).provider(:zypper) do
|
|
309
309
|
|
310
310
|
it { is_expected.to be false }
|
311
311
|
end
|
312
|
+
|
313
|
+
context 'when using eq range' do
|
314
|
+
context 'when ensure without release' do
|
315
|
+
before { allow(@resource).to receive(:[]).with(:ensure).and_return('1.19') }
|
316
|
+
|
317
|
+
it { is_expected.to be true }
|
318
|
+
end
|
319
|
+
|
320
|
+
context 'when ensure with release' do
|
321
|
+
before { allow(@resource).to receive(:[]).with(:ensure).and_return('1.19-2') }
|
322
|
+
|
323
|
+
it { is_expected.to be true }
|
324
|
+
end
|
325
|
+
end
|
312
326
|
end
|
313
327
|
end
|
@@ -38,6 +38,47 @@ describe 'Puppet::Type::Service::Provider::Init', unless: Puppet::Util::Platform
|
|
38
38
|
%w{functions.sh reboot.sh shutdown.sh functions halt killall single linuxconf reboot boot wait-for-state rcS module-init-tools}
|
39
39
|
end
|
40
40
|
|
41
|
+
describe "when running on FreeBSD" do
|
42
|
+
before :each do
|
43
|
+
allow(Facter).to receive(:value).with(:operatingsystem).and_return('FreeBSD')
|
44
|
+
allow(Facter).to receive(:value).with(:osfamily).and_return('FreeBSD')
|
45
|
+
end
|
46
|
+
|
47
|
+
it "should set its default path to include /etc/rc.d and /usr/local/etc/rc.d" do
|
48
|
+
expect(provider_class.defpath).to eq(["/etc/rc.d", "/usr/local/etc/rc.d"])
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe "when running on HP-UX" do
|
53
|
+
before :each do
|
54
|
+
allow(Facter).to receive(:value).with(:operatingsystem).and_return('HP-UX')
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should set its default path to include /sbin/init.d" do
|
58
|
+
expect(provider_class.defpath).to eq("/sbin/init.d")
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
describe "when running on Archlinux" do
|
63
|
+
before :each do
|
64
|
+
allow(Facter).to receive(:value).with(:operatingsystem).and_return('Archlinux')
|
65
|
+
end
|
66
|
+
|
67
|
+
it "should set its default path to include /etc/rc.d" do
|
68
|
+
expect(provider_class.defpath).to eq("/etc/rc.d")
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
describe "when not running on FreeBSD, HP-UX or Archlinux" do
|
73
|
+
before :each do
|
74
|
+
allow(Facter).to receive(:value).with(:operatingsystem).and_return('RedHat')
|
75
|
+
end
|
76
|
+
|
77
|
+
it "should set its default path to include /etc/init.d" do
|
78
|
+
expect(provider_class.defpath).to eq("/etc/init.d")
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
41
82
|
describe "when getting all service instances" do
|
42
83
|
before :each do
|
43
84
|
allow(provider_class).to receive(:defpath).and_return('tmp')
|