puppet 6.12.0 → 6.13.0

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.

Files changed (144) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +12 -12
  3. data/README.md +1 -1
  4. data/ext/project_data.yaml +1 -1
  5. data/lib/puppet.rb +22 -7
  6. data/lib/puppet/application/resource.rb +1 -1
  7. data/lib/puppet/configurer.rb +8 -13
  8. data/lib/puppet/defaults.rb +83 -49
  9. data/lib/puppet/environments.rb +26 -18
  10. data/lib/puppet/face/facts.rb +8 -5
  11. data/lib/puppet/file_system/memory_file.rb +6 -0
  12. data/lib/puppet/file_system/memory_impl.rb +13 -0
  13. data/lib/puppet/file_system/windows.rb +7 -10
  14. data/lib/puppet/http.rb +2 -0
  15. data/lib/puppet/http/client.rb +30 -0
  16. data/lib/puppet/http/errors.rb +2 -0
  17. data/lib/puppet/http/service.rb +61 -2
  18. data/lib/puppet/http/service/compiler.rb +86 -0
  19. data/lib/puppet/http/service/file_server.rb +85 -0
  20. data/lib/puppet/http/service/report.rb +4 -8
  21. data/lib/puppet/http/session.rb +8 -1
  22. data/lib/puppet/indirector/catalog/compiler.rb +10 -0
  23. data/lib/puppet/indirector/file_bucket_file/file.rb +1 -1
  24. data/lib/puppet/indirector/json.rb +1 -1
  25. data/lib/puppet/indirector/msgpack.rb +1 -1
  26. data/lib/puppet/network/http/connection.rb +4 -0
  27. data/lib/puppet/network/http/nocache_pool.rb +1 -0
  28. data/lib/puppet/network/http/pool.rb +5 -1
  29. data/lib/puppet/parser/ast/pops_bridge.rb +6 -11
  30. data/lib/puppet/pops/evaluator/access_operator.rb +2 -2
  31. data/lib/puppet/pops/evaluator/evaluator_impl.rb +1 -1
  32. data/lib/puppet/pops/loader/puppet_plan_instantiator.rb +12 -3
  33. data/lib/puppet/pops/parser/evaluating_parser.rb +5 -7
  34. data/lib/puppet/pops/types/p_object_type_extension.rb +10 -0
  35. data/lib/puppet/pops/types/type_calculator.rb +24 -0
  36. data/lib/puppet/pops/validation/checker4_0.rb +1 -1
  37. data/lib/puppet/pops/validation/tasks_checker.rb +5 -1
  38. data/lib/puppet/provider/aix_object.rb +4 -2
  39. data/lib/puppet/provider/group/aix.rb +1 -0
  40. data/lib/puppet/provider/group/groupadd.rb +52 -24
  41. data/lib/puppet/provider/package/apt.rb +14 -3
  42. data/lib/puppet/provider/package/dnfmodule.rb +9 -2
  43. data/lib/puppet/provider/package/dpkg.rb +14 -7
  44. data/lib/puppet/provider/package/fink.rb +20 -3
  45. data/lib/puppet/provider/package/openbsd.rb +13 -1
  46. data/lib/puppet/provider/package/pkg.rb +18 -5
  47. data/lib/puppet/provider/package/yum.rb +9 -5
  48. data/lib/puppet/provider/user/aix.rb +1 -0
  49. data/lib/puppet/provider/user/directoryservice.rb +30 -5
  50. data/lib/puppet/provider/user/useradd.rb +6 -7
  51. data/lib/puppet/reports/store.rb +1 -1
  52. data/lib/puppet/settings.rb +2 -0
  53. data/lib/puppet/ssl/certificate.rb +2 -1
  54. data/lib/puppet/test/test_helper.rb +4 -0
  55. data/lib/puppet/transaction/resource_harness.rb +1 -1
  56. data/lib/puppet/type/group.rb +2 -2
  57. data/lib/puppet/type/package.rb +63 -9
  58. data/lib/puppet/type/user.rb +2 -2
  59. data/lib/puppet/util/log/destinations.rb +1 -1
  60. data/lib/puppet/util/pidlock.rb +26 -6
  61. data/lib/puppet/util/plist.rb +6 -0
  62. data/lib/puppet/util/storage.rb +0 -1
  63. data/lib/puppet/util/yaml.rb +1 -1
  64. data/lib/puppet/version.rb +1 -1
  65. data/locales/puppet.pot +127 -115
  66. data/man/man5/puppet.conf.5 +21 -7
  67. data/man/man8/puppet-agent.8 +1 -1
  68. data/man/man8/puppet-apply.8 +1 -1
  69. data/man/man8/puppet-catalog.8 +1 -1
  70. data/man/man8/puppet-config.8 +1 -1
  71. data/man/man8/puppet-describe.8 +1 -1
  72. data/man/man8/puppet-device.8 +1 -1
  73. data/man/man8/puppet-doc.8 +1 -1
  74. data/man/man8/puppet-epp.8 +1 -1
  75. data/man/man8/puppet-facts.8 +1 -1
  76. data/man/man8/puppet-filebucket.8 +1 -1
  77. data/man/man8/puppet-generate.8 +1 -1
  78. data/man/man8/puppet-help.8 +1 -1
  79. data/man/man8/puppet-key.8 +1 -1
  80. data/man/man8/puppet-lookup.8 +1 -1
  81. data/man/man8/puppet-man.8 +1 -1
  82. data/man/man8/puppet-module.8 +1 -1
  83. data/man/man8/puppet-node.8 +1 -1
  84. data/man/man8/puppet-parser.8 +1 -1
  85. data/man/man8/puppet-plugin.8 +1 -1
  86. data/man/man8/puppet-report.8 +1 -1
  87. data/man/man8/puppet-resource.8 +1 -1
  88. data/man/man8/puppet-script.8 +1 -1
  89. data/man/man8/puppet-ssl.8 +1 -1
  90. data/man/man8/puppet-status.8 +1 -1
  91. data/man/man8/puppet.8 +2 -2
  92. data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_md5/should_fetch_if_not_on_the_local_disk.yml +0 -35
  93. data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_md5/should_not_update_if_content_on_disk_is_up-to-date.yml +0 -37
  94. data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_md5/should_update_if_content_differs_on_disk.yml +0 -37
  95. data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_mtime/should_fetch_if_mtime_is_older_on_disk.yml +0 -35
  96. data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_mtime/should_fetch_if_no_header_specified.yml +0 -33
  97. data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_mtime/should_fetch_if_not_on_the_local_disk.yml +0 -35
  98. data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_mtime/should_not_update_if_mtime_is_newer_on_disk.yml +0 -35
  99. data/spec/integration/configurer_spec.rb +26 -7
  100. data/spec/integration/indirector/facts/facter_spec.rb +4 -0
  101. data/spec/unit/application/apply_spec.rb +2 -12
  102. data/spec/unit/application/resource_spec.rb +2 -2
  103. data/spec/unit/configurer/fact_handler_spec.rb +0 -4
  104. data/spec/unit/configurer_spec.rb +0 -3
  105. data/spec/unit/defaults_spec.rb +1 -1
  106. data/spec/unit/environments_spec.rb +57 -28
  107. data/spec/unit/face/facts_spec.rb +24 -20
  108. data/spec/unit/file_system_spec.rb +16 -2
  109. data/spec/unit/http/client_spec.rb +6 -0
  110. data/spec/unit/http/service/compiler_spec.rb +322 -0
  111. data/spec/unit/http/service/file_server_spec.rb +219 -0
  112. data/spec/unit/http/service/report_spec.rb +8 -1
  113. data/spec/unit/http/service_spec.rb +4 -0
  114. data/spec/unit/http/session_spec.rb +31 -0
  115. data/spec/unit/indirector/catalog/compiler_spec.rb +46 -29
  116. data/spec/unit/network/http/connection_spec.rb +23 -1
  117. data/spec/unit/network/http/nocache_pool_spec.rb +3 -3
  118. data/spec/unit/network/http/pool_spec.rb +32 -0
  119. data/spec/unit/node/facts_spec.rb +2 -1
  120. data/spec/unit/node_spec.rb +7 -4
  121. data/spec/unit/pops/serialization/to_from_hr_spec.rb +6 -1
  122. data/spec/unit/pops/validator/validator_spec.rb +7 -2
  123. data/spec/unit/provider/aix_object_spec.rb +16 -2
  124. data/spec/unit/provider/group/groupadd_spec.rb +167 -56
  125. data/spec/unit/provider/package/apt_spec.rb +13 -2
  126. data/spec/unit/provider/package/aptitude_spec.rb +1 -0
  127. data/spec/unit/provider/package/dnfmodule_spec.rb +22 -0
  128. data/spec/unit/provider/package/dpkg_spec.rb +28 -6
  129. data/spec/unit/provider/package/openbsd_spec.rb +17 -0
  130. data/spec/unit/provider/package/pkg_spec.rb +15 -1
  131. data/spec/unit/provider/package/yum_spec.rb +50 -0
  132. data/spec/unit/provider/user/directoryservice_spec.rb +41 -0
  133. data/spec/unit/provider/user/useradd_spec.rb +13 -8
  134. data/spec/unit/puppet_pal_2pec.rb +3 -0
  135. data/spec/unit/puppet_pal_catalog_spec.rb +3 -0
  136. data/spec/unit/puppet_spec.rb +14 -0
  137. data/spec/unit/ssl/certificate_spec.rb +7 -0
  138. data/spec/unit/transaction/persistence_spec.rb +1 -10
  139. data/spec/unit/type/package_spec.rb +8 -0
  140. data/spec/unit/type/user_spec.rb +0 -1
  141. data/spec/unit/util/pidlock_spec.rb +38 -16
  142. data/spec/unit/util/plist_spec.rb +20 -0
  143. data/spec/unit/util/storage_spec.rb +1 -8
  144. metadata +10 -4
@@ -124,7 +124,7 @@ describe Puppet::Type.type(:user).provider(:useradd) do
124
124
 
125
125
  describe "on systems with the libuser and forcelocal=true" do
126
126
  before do
127
- described_class.has_feature :libuser
127
+ described_class.has_feature :manages_local_users_and_groups
128
128
  resource[:forcelocal] = true
129
129
  end
130
130
 
@@ -188,7 +188,7 @@ describe Puppet::Type.type(:user).provider(:useradd) do
188
188
 
189
189
  describe 'when modifying the password' do
190
190
  before do
191
- described_class.has_feature :libuser
191
+ described_class.has_feature :manages_local_users_and_groups
192
192
  described_class.has_feature :manages_passwords
193
193
  #Setting any resource value here initializes needed variables and methods in the resource and provider
194
194
  #Setting a password value here initializes the existence and management of the password parameter itself
@@ -210,7 +210,7 @@ describe Puppet::Type.type(:user).provider(:useradd) do
210
210
  describe '#modify' do
211
211
  describe "on systems with the libuser and forcelocal=false" do
212
212
  before do
213
- described_class.has_feature :libuser
213
+ described_class.has_feature :manages_local_users_and_groups
214
214
  resource[:forcelocal] = false
215
215
  end
216
216
 
@@ -318,13 +318,13 @@ describe Puppet::Type.type(:user).provider(:useradd) do
318
318
  end
319
319
 
320
320
  describe "#comment" do
321
- before { described_class.has_feature :libuser }
321
+ before { described_class.has_feature :manages_local_users_and_groups }
322
322
 
323
323
  let(:content) { "myuser:x:x:x:local comment:x:x" }
324
324
 
325
325
  it "should return the local comment string when forcelocal is true" do
326
326
  resource[:forcelocal] = true
327
- allow(File).to receive(:open).with('/etc/passwd').and_yield(content)
327
+ allow(File).to receive(:read).with('/etc/passwd').and_return(content)
328
328
  expect(provider.comment).to eq('local comment')
329
329
  end
330
330
 
@@ -337,7 +337,7 @@ describe Puppet::Type.type(:user).provider(:useradd) do
337
337
  end
338
338
 
339
339
  describe "#finduser" do
340
- before { allow(File).to receive(:open).with('/etc/passwd').and_yield(content) }
340
+ before { allow(File).to receive(:read).with('/etc/passwd').and_return(content) }
341
341
 
342
342
  let(:content) { "sample_account:sample_password:sample_uid:sample_gid:sample_gecos:sample_directory:sample_shell" }
343
343
  let(:output) do
@@ -361,6 +361,11 @@ describe Puppet::Type.type(:user).provider(:useradd) do
361
361
  it "returns false when specified key/value pair is not found" do
362
362
  expect(provider.finduser(:account, 'invalid_account')).to eq(false)
363
363
  end
364
+
365
+ it "reads the user file only once per resource" do
366
+ expect(File).to receive(:read).with('/etc/passwd').once
367
+ 5.times { provider.finduser(:account, 'sample_account') }
368
+ end
364
369
  end
365
370
 
366
371
  describe "#check_allow_dup" do
@@ -696,7 +701,7 @@ describe Puppet::Type.type(:user).provider(:useradd) do
696
701
 
697
702
  describe "on systems with the libuser and forcelocal=false" do
698
703
  before do
699
- described_class.has_feature :libuser
704
+ described_class.has_feature :manages_local_users_and_groups
700
705
  resource[:forcelocal] = false
701
706
  end
702
707
 
@@ -708,7 +713,7 @@ describe Puppet::Type.type(:user).provider(:useradd) do
708
713
 
709
714
  describe "on systems with the libuser and forcelocal=true" do
710
715
  before do
711
- described_class.has_feature :libuser
716
+ described_class.has_feature :manages_local_users_and_groups
712
717
  resource[:forcelocal] = true
713
718
  end
714
719
 
@@ -710,6 +710,9 @@ describe 'Puppet Pal' do
710
710
 
711
711
  context 'facts are supported such that' do
712
712
  it 'they are obtained if they are not given' do
713
+ facts = Puppet::Node::Facts.new(Puppet[:certname], 'puppetversion' => Puppet.version)
714
+ Puppet::Node::Facts.indirection.save(facts)
715
+
713
716
  testing_env_dir # creates the structure
714
717
  result = Puppet::Pal.in_tmp_environment('pal_env', modulepath: modulepath ) do |ctx|
715
718
  ctx.with_script_compiler {|c| c.evaluate_string("$facts =~ Hash and $facts[puppetversion] == '#{Puppet.version}'") }
@@ -722,6 +722,9 @@ describe 'Puppet Pal' do
722
722
 
723
723
  context 'facts are supported such that' do
724
724
  it 'they are obtained if they are not given' do
725
+ facts = Puppet::Node::Facts.new(Puppet[:certname], 'puppetversion' => Puppet.version)
726
+ Puppet::Node::Facts.indirection.save(facts)
727
+
725
728
  testing_env_dir # creates the structure
726
729
  result = Puppet::Pal.in_tmp_environment('pal_env', modulepath: modulepath ) do |ctx|
727
730
  ctx.with_catalog_compiler {|c| c.evaluate_string("$facts =~ Hash and $facts[puppetversion] == '#{Puppet.version}'") }
@@ -69,4 +69,18 @@ describe Puppet do
69
69
  expect(SemanticPuppet::Version).to be_valid(Puppet::OLDEST_RECOMMENDED_RUBY_VERSION)
70
70
  end
71
71
  end
72
+
73
+ context "Settings" do
74
+ before(:each) do
75
+ @old_settings = Puppet.settings
76
+ end
77
+ after(:each) do
78
+ Puppet.replace_settings_object(@old_settings)
79
+ end
80
+ it "should allow for settings to be redefined with a custom object" do
81
+ new_settings = double()
82
+ Puppet.replace_settings_object(new_settings)
83
+ expect(Puppet.settings).to eq(new_settings)
84
+ end
85
+ end
72
86
  end
@@ -135,6 +135,13 @@ describe Puppet::SSL::Certificate do
135
135
  expect(cert.custom_extensions).to include('oid' => '1.3.6.1.4.1.34380.1.2.1', 'value' => 'x509 :(')
136
136
  end
137
137
 
138
+ it "returns extensions under the ppAuthCertExt" do
139
+ exts = {'pp_auth_role' => 'taketwo'}
140
+ cert = build_cert(:extension_requests => exts)
141
+ sign_wrapped_cert(cert)
142
+ expect(cert.custom_extensions).to include('oid' => 'pp_auth_role', 'value' => 'taketwo')
143
+ end
144
+
138
145
  it "doesn't return standard extensions" do
139
146
  cert = build_cert(:dns_alt_names => 'foo')
140
147
  expect(cert.custom_extensions).to be_empty
@@ -146,16 +146,7 @@ describe Puppet::Transaction::Persistence do
146
146
  Dir.mkdir(Puppet[:transactionstorefile])
147
147
  persistence = Puppet::Transaction::Persistence.new
148
148
 
149
- if Puppet::Util::Platform.windows?
150
- expect do
151
- persistence.save
152
- end.to raise_error do |error|
153
- expect(error).to be_a(Puppet::Util::Windows::Error)
154
- expect(error.code).to eq(5) # ERROR_ACCESS_DENIED
155
- end
156
- else
157
- expect { persistence.save }.to raise_error(Errno::EISDIR, /Is a directory/)
158
- end
149
+ expect { persistence.save }.to raise_error(Errno::EISDIR, /Is a directory/)
159
150
 
160
151
  Dir.rmdir(Puppet[:transactionstorefile])
161
152
  end
@@ -30,6 +30,10 @@ describe Puppet::Type.type(:package) do
30
30
  expect(Puppet::Type.type(:package).provider_feature(:versionable)).not_to be_nil
31
31
  end
32
32
 
33
+ it "should have a :supports_flavors feature" do
34
+ expect(Puppet::Type.type(:package).provider_feature(:supports_flavors)).not_to be_nil
35
+ end
36
+
33
37
  it "should have a :package_settings feature that requires :package_settings_insync?, :package_settings and :package_settings=" do
34
38
  expect(Puppet::Type.type(:package).provider_feature(:package_settings).methods).to eq([:package_settings_insync?, :package_settings, :package_settings=])
35
39
  end
@@ -53,6 +57,10 @@ describe Puppet::Type.type(:package) do
53
57
  it "should have a package_settings property" do
54
58
  expect(Puppet::Type.type(:package).attrtype(:package_settings)).to eq(:property)
55
59
  end
60
+
61
+ it "should have a flavor property" do
62
+ expect(Puppet::Type.type(:package).attrtype(:flavor)).to eq(:property)
63
+ end
56
64
  end
57
65
 
58
66
  describe "when validating attribute values" do
@@ -408,7 +408,6 @@ describe Puppet::Type.type(:user) do
408
408
  Puppet::Resource::Catalog.new :testing do |conf|
409
409
  [testuser, testrole].each { |resource| conf.add_resource resource }
410
410
  end
411
- allow(Puppet::Type::User::ProviderDirectoryservice).to receive(:get_macosx_version_major).and_return("10.5")
412
411
 
413
412
  rel = testuser.autorequire[0]
414
413
  expect(rel.source.ref).to eq(testrole.ref)
@@ -9,6 +9,28 @@ describe Puppet::Util::Pidlock, if: !Puppet::Util::Platform.jruby? do
9
9
  before(:each) do
10
10
  @lockfile = tmpfile("lock")
11
11
  @lock = Puppet::Util::Pidlock.new(@lockfile)
12
+ @ps_argument_for_current_kernel = @lock.send(:ps_argument_for_current_kernel)
13
+ end
14
+
15
+ describe "#ps pid argument on posix", unless: Puppet::Util::Platform.windows? do
16
+ before(:each) do
17
+ @lock.lock
18
+ end
19
+
20
+ it "should allow ps execution" do
21
+ expect { Puppet::Util::Execution.execute(['ps', @ps_argument_for_current_kernel, @lock.lock_pid, '-o', 'comm=']) }.not_to raise_error
22
+ expect { Puppet::Util::Execution.execute(['ps', @ps_argument_for_current_kernel, @lock.lock_pid, '-o', 'args=']) }.not_to raise_error
23
+ expect(@lock).to be_locked
24
+ end
25
+
26
+ it "should fallback to -p when default argument fails ps execution" do
27
+ allow(@lock).to receive(:ps_argument_for_current_kernel).and_return("-eq")
28
+ allow(Puppet::Util::Execution).to receive(:execute).with(['ps', "-eq", @lock.lock_pid, '-o', 'comm=']).and_raise(Puppet::ExecutionFailure, 'Execution of command returned 1: error')
29
+
30
+ expect(Puppet::Util::Execution).to receive(:execute).with(['ps', "-p", @lock.lock_pid, '-o', 'comm=']).and_return('puppet')
31
+ expect(Puppet::Util::Execution).to receive(:execute).with(['ps', "-p", @lock.lock_pid, '-o', 'args=']).and_return('puppet')
32
+ expect(@lock).to be_locked
33
+ end
12
34
  end
13
35
 
14
36
  describe "#lock" do
@@ -25,19 +47,19 @@ describe Puppet::Util::Pidlock, if: !Puppet::Util::Platform.jruby? do
25
47
  if Puppet::Util::Platform.windows?
26
48
  allow(Puppet::Util::Windows::Process).to receive(:get_process_image_name_by_pid).with(@lock.lock_pid).and_return('C:\Program Files\Puppet Labs\Puppet\puppet\bin\ruby.exe')
27
49
  else
28
- allow(Puppet::Util::Execution).to receive(:execute).with(['ps', '-p', @lock.lock_pid, '-o', 'comm=']).and_return('puppet')
29
- allow(Puppet::Util::Execution).to receive(:execute).with(['ps', '-p', @lock.lock_pid, '-o', 'args=']).and_return('puppet')
50
+ allow(Puppet::Util::Execution).to receive(:execute).with(['ps', @ps_argument_for_current_kernel, @lock.lock_pid, '-o', 'comm=']).and_return('puppet')
51
+ allow(Puppet::Util::Execution).to receive(:execute).with(['ps', @ps_argument_for_current_kernel, @lock.lock_pid, '-o', 'args=']).and_return('puppet')
30
52
  end
31
53
  expect(@lock).to be_locked
32
54
  end
33
55
 
34
56
  it "should become locked if puppet is a gem" do
35
57
  @lock.lock
36
- unless Puppet::Util::Platform.windows?
37
- expect(Puppet::Util::Execution).to receive(:execute).with(['ps', '-p', @lock.lock_pid, '-o', 'comm=']).and_return('ruby')
38
- expect(Puppet::Util::Execution).to receive(:execute).with(['ps', '-p', @lock.lock_pid, '-o', 'args=']).and_return('ruby /root/puppet/.bundle/ruby/2.3.0/bin/puppet agent --no-daemonize -v')
39
- else
58
+ if Puppet::Util::Platform.windows?
40
59
  allow(Puppet::Util::Windows::Process).to receive(:get_process_image_name_by_pid).with(@lock.lock_pid).and_return('C:\tools\ruby25\bin\ruby.exe')
60
+ else
61
+ expect(Puppet::Util::Execution).to receive(:execute).with(['ps', @ps_argument_for_current_kernel, @lock.lock_pid, '-o', 'comm=']).and_return('ruby')
62
+ expect(Puppet::Util::Execution).to receive(:execute).with(['ps', @ps_argument_for_current_kernel, @lock.lock_pid, '-o', 'args=']).and_return('ruby /root/puppet/.bundle/ruby/2.3.0/bin/puppet agent --no-daemonize -v')
41
63
  end
42
64
  expect(@lock).to be_locked
43
65
  end
@@ -120,19 +142,19 @@ describe Puppet::Util::Pidlock, if: !Puppet::Util::Platform.jruby? do
120
142
  if Puppet::Util::Platform.windows?
121
143
  allow(Puppet::Util::Windows::Process).to receive(:get_process_image_name_by_pid).with(@lock.lock_pid).and_return('C:\Program Files\Puppet Labs\Puppet\puppet\bin\ruby.exe')
122
144
  else
123
- allow(Puppet::Util::Execution).to receive(:execute).with(['ps', '-p', @lock.lock_pid, '-o', 'comm=']).and_return('puppet')
124
- allow(Puppet::Util::Execution).to receive(:execute).with(['ps', '-p', @lock.lock_pid, '-o', 'args=']).and_return('puppet')
145
+ allow(Puppet::Util::Execution).to receive(:execute).with(['ps', @ps_argument_for_current_kernel, @lock.lock_pid, '-o', 'comm=']).and_return('puppet')
146
+ allow(Puppet::Util::Execution).to receive(:execute).with(['ps', @ps_argument_for_current_kernel, @lock.lock_pid, '-o', 'args=']).and_return('puppet')
125
147
  end
126
148
  expect(@lock).to be_locked
127
149
  end
128
150
 
129
151
  it "should return true if locked when puppet as gem" do
130
152
  @lock.lock
131
- unless Puppet::Util::Platform.windows?
132
- expect(Puppet::Util::Execution).to receive(:execute).with(['ps', '-p', @lock.lock_pid, '-o', 'comm=']).and_return('ruby')
133
- expect(Puppet::Util::Execution).to receive(:execute).with(['ps', '-p', @lock.lock_pid, '-o', 'args=']).and_return('ruby /root/puppet/.bundle/ruby/2.3.0/bin/puppet agent --no-daemonize -v')
134
- else
153
+ if Puppet::Util::Platform.windows?
135
154
  allow(Puppet::Util::Windows::Process).to receive(:get_process_image_name_by_pid).with(@lock.lock_pid).and_return('C:\tools\ruby25\bin\ruby.exe')
155
+ else
156
+ expect(Puppet::Util::Execution).to receive(:execute).with(['ps', @ps_argument_for_current_kernel, @lock.lock_pid, '-o', 'comm=']).and_return('ruby')
157
+ expect(Puppet::Util::Execution).to receive(:execute).with(['ps', @ps_argument_for_current_kernel, @lock.lock_pid, '-o', 'args=']).and_return('ruby /root/puppet/.bundle/ruby/2.3.0/bin/puppet agent --no-daemonize -v')
136
158
  end
137
159
  expect(@lock).to be_locked
138
160
  end
@@ -182,8 +204,8 @@ describe Puppet::Util::Pidlock, if: !Puppet::Util::Platform.jruby? do
182
204
  if Puppet::Util::Platform.windows?
183
205
  allow(Puppet::Util::Windows::Process).to receive(:get_process_image_name_by_pid).with(6789).and_return('C:\Program Files\Puppet Labs\Puppet\puppet\bin\ruby.exe')
184
206
  else
185
- allow(Puppet::Util::Execution).to receive(:execute).with(['ps', '-p', 6789, '-o', 'comm=']).and_return('puppet')
186
- allow(Puppet::Util::Execution).to receive(:execute).with(['ps', '-p', 6789, '-o', 'args=']).and_return('puppet')
207
+ allow(Puppet::Util::Execution).to receive(:execute).with(['ps', @ps_argument_for_current_kernel, 6789, '-o', 'comm=']).and_return('puppet')
208
+ allow(Puppet::Util::Execution).to receive(:execute).with(['ps', @ps_argument_for_current_kernel, 6789, '-o', 'args=']).and_return('puppet')
187
209
  end
188
210
  @lock.lock
189
211
  expect(Puppet::FileSystem.exist?(@lockfile)).to be_truthy
@@ -212,8 +234,8 @@ describe Puppet::Util::Pidlock, if: !Puppet::Util::Platform.jruby? do
212
234
  if Puppet::Util::Platform.windows?
213
235
  allow(Puppet::Util::Windows::Process).to receive(:get_process_image_name_by_pid).with(1234).and_return('C:\Program Files\Puppet Labs\Puppet\puppet\bin\ruby.exe')
214
236
  else
215
- allow(Puppet::Util::Execution).to receive(:execute).with(['ps', '-p', 1234, '-o', 'comm=']).and_return('puppet')
216
- allow(Puppet::Util::Execution).to receive(:execute).with(['ps', '-p', 1234, '-o', 'args=']).and_return('puppet')
237
+ allow(Puppet::Util::Execution).to receive(:execute).with(['ps', @ps_argument_for_current_kernel, 1234, '-o', 'comm=']).and_return('puppet')
238
+ allow(Puppet::Util::Execution).to receive(:execute).with(['ps', @ps_argument_for_current_kernel, 1234, '-o', 'args=']).and_return('puppet')
217
239
  end
218
240
  # lock the file
219
241
  @lock.lock
@@ -1,3 +1,5 @@
1
+ # coding: utf-8
2
+
1
3
  require 'spec_helper'
2
4
  require 'puppet/util/plist'
3
5
  require 'puppet_spec/files'
@@ -52,6 +54,19 @@ describe Puppet::Util::Plist, :if => Puppet.features.cfpropertylist? do
52
54
  </dict>
53
55
  </plist>'
54
56
  end
57
+ let(:ascii_xml_plist) do
58
+ '<?xml version="1.0" encoding="UTF-8"?>
59
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
60
+ <plist version="1.0">
61
+ <dict>
62
+ <key>RecordName</key>
63
+ <array>
64
+ <string>Timișoara</string>
65
+ <string>Tōkyō</string>
66
+ </array>
67
+ </dict>
68
+ </plist>'.force_encoding(Encoding::US_ASCII)
69
+ end
55
70
  let(:non_plist_data) do
56
71
  "Take my love, take my land
57
72
  Take me where I cannot stand
@@ -62,6 +77,7 @@ describe Puppet::Util::Plist, :if => Puppet.features.cfpropertylist? do
62
77
  "\xCF\xFA\xED\xFE\a\u0000\u0000\u0001\u0003\u0000\u0000\x80\u0002\u0000\u0000\u0000\u0012\u0000\u0000\u0000\b"
63
78
  end
64
79
  let(:valid_xml_plist_hash) { {"LastUsedPrinters"=>[{"Network"=>"10.85.132.1", "PrinterID"=>"baskerville_corp_puppetlabs_net"}, {"Network"=>"10.14.96.1", "PrinterID"=>"Statler"}]} }
80
+ let(:ascii_xml_plist_hash) { {"RecordName"=>["Timișoara", "Tōkyō"]} }
65
81
  let(:plist_path) { file_containing('sample.plist', valid_xml_plist) }
66
82
  let(:binary_plist_magic_number) { 'bplist00' }
67
83
  let(:bad_xml_doctype) { '<!DOCTYPE plist PUBLIC -//Apple Computer' }
@@ -132,6 +148,10 @@ describe Puppet::Util::Plist, :if => Puppet.features.cfpropertylist? do
132
148
  expect(subject.parse_plist(valid_xml_plist)).to eq(valid_xml_plist_hash)
133
149
  end
134
150
 
151
+ it "returns a valid hash when an ASCII XML plist is provided" do
152
+ expect(subject.parse_plist(ascii_xml_plist)).to eq(ascii_xml_plist_hash)
153
+ end
154
+
135
155
  it "raises a debug message and replaces a bad XML plist doctype should one be encountered" do
136
156
  expect(subject).to receive(:new_cfpropertylist).with({:data => good_xml_doctype}).and_return('plist_object')
137
157
  allow(subject).to receive(:convert_cfpropertylist_to_native_types).with('plist_object')
@@ -201,14 +201,7 @@ describe Puppet::Util::Storage do
201
201
  Dir.mkdir(Puppet[:statefile])
202
202
  Puppet::Util::Storage.cache(:yayness)
203
203
 
204
- if Puppet::Util::Platform.windows?
205
- expect { Puppet::Util::Storage.store }.to raise_error do |error|
206
- expect(error).to be_a(Puppet::Util::Windows::Error)
207
- expect(error.code).to eq(5) # ERROR_ACCESS_DENIED
208
- end
209
- else
210
- expect { Puppet::Util::Storage.store }.to raise_error(Errno::EISDIR, /Is a directory/)
211
- end
204
+ expect { Puppet::Util::Storage.store }.to raise_error(Errno::EISDIR, /Is a directory/)
212
205
 
213
206
  Dir.rmdir(Puppet[:statefile])
214
207
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.12.0
4
+ version: 6.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet Labs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-13 00:00:00.000000000 Z
11
+ date: 2020-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: facter
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: 2.0.1
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '4'
22
+ version: '5'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: 2.0.1
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '4'
32
+ version: '5'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: hiera
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -571,6 +571,8 @@ files:
571
571
  - lib/puppet/http/retry_after_handler.rb
572
572
  - lib/puppet/http/service.rb
573
573
  - lib/puppet/http/service/ca.rb
574
+ - lib/puppet/http/service/compiler.rb
575
+ - lib/puppet/http/service/file_server.rb
574
576
  - lib/puppet/http/service/report.rb
575
577
  - lib/puppet/http/session.rb
576
578
  - lib/puppet/indirector.rb
@@ -2078,6 +2080,8 @@ files:
2078
2080
  - spec/unit/http/client_spec.rb
2079
2081
  - spec/unit/http/resolver_spec.rb
2080
2082
  - spec/unit/http/service/ca_spec.rb
2083
+ - spec/unit/http/service/compiler_spec.rb
2084
+ - spec/unit/http/service/file_server_spec.rb
2081
2085
  - spec/unit/http/service/report_spec.rb
2082
2086
  - spec/unit/http/service_spec.rb
2083
2087
  - spec/unit/http/session_spec.rb
@@ -3333,6 +3337,8 @@ test_files:
3333
3337
  - spec/unit/http/client_spec.rb
3334
3338
  - spec/unit/http/resolver_spec.rb
3335
3339
  - spec/unit/http/service/ca_spec.rb
3340
+ - spec/unit/http/service/compiler_spec.rb
3341
+ - spec/unit/http/service/file_server_spec.rb
3336
3342
  - spec/unit/http/service/report_spec.rb
3337
3343
  - spec/unit/http/service_spec.rb
3338
3344
  - spec/unit/http/session_spec.rb