puppet 7.10.0 → 7.11.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 (127) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -2
  3. data/Gemfile.lock +9 -9
  4. data/lib/puppet/application/agent.rb +4 -0
  5. data/lib/puppet/application/apply.rb +20 -2
  6. data/lib/puppet/application/resource.rb +15 -13
  7. data/lib/puppet/concurrent/thread_local_singleton.rb +1 -0
  8. data/lib/puppet/configurer.rb +14 -4
  9. data/lib/puppet/confine/variable.rb +1 -1
  10. data/lib/puppet/defaults.rb +9 -3
  11. data/lib/puppet/facter_impl.rb +96 -0
  12. data/lib/puppet/file_serving/mount/file.rb +4 -4
  13. data/lib/puppet/file_system/file_impl.rb +3 -1
  14. data/lib/puppet/forge.rb +1 -1
  15. data/lib/puppet/indirector/catalog/compiler.rb +3 -3
  16. data/lib/puppet/indirector/facts/facter.rb +6 -6
  17. data/lib/puppet/indirector/indirection.rb +1 -1
  18. data/lib/puppet/module_tool/applications/uninstaller.rb +1 -1
  19. data/lib/puppet/module_tool/applications/upgrader.rb +1 -1
  20. data/lib/puppet/pal/pal_impl.rb +1 -1
  21. data/lib/puppet/parser/scope.rb +8 -7
  22. data/lib/puppet/parser/templatewrapper.rb +1 -0
  23. data/lib/puppet/pops/lookup/lookup_adapter.rb +3 -2
  24. data/lib/puppet/pops/model/ast.rb +1 -0
  25. data/lib/puppet/pops/model/factory.rb +14 -13
  26. data/lib/puppet/pops/parser/egrammar.ra +2 -2
  27. data/lib/puppet/pops/parser/eparser.rb +752 -753
  28. data/lib/puppet/pops/parser/lexer2.rb +69 -68
  29. data/lib/puppet/pops/parser/slurp_support.rb +1 -0
  30. data/lib/puppet/pops/serialization/to_stringified_converter.rb +1 -1
  31. data/lib/puppet/pops/types/type_formatter.rb +7 -6
  32. data/lib/puppet/pops/types/types.rb +1 -1
  33. data/lib/puppet/provider/aix_object.rb +1 -1
  34. data/lib/puppet/provider/group/groupadd.rb +5 -2
  35. data/lib/puppet/provider/package/pkg.rb +1 -1
  36. data/lib/puppet/provider/package/puppet_gem.rb +1 -1
  37. data/lib/puppet/provider/package/puppetserver_gem.rb +1 -1
  38. data/lib/puppet/provider/package/yum.rb +1 -1
  39. data/lib/puppet/provider/service/base.rb +1 -1
  40. data/lib/puppet/provider/service/init.rb +5 -5
  41. data/lib/puppet/provider/service/launchd.rb +1 -1
  42. data/lib/puppet/provider/service/redhat.rb +1 -1
  43. data/lib/puppet/provider/service/smf.rb +3 -3
  44. data/lib/puppet/provider/service/systemd.rb +1 -1
  45. data/lib/puppet/provider/service/upstart.rb +5 -5
  46. data/lib/puppet/provider/user/aix.rb +44 -1
  47. data/lib/puppet/provider/user/directoryservice.rb +1 -1
  48. data/lib/puppet/provider/user/useradd.rb +10 -7
  49. data/lib/puppet/provider.rb +1 -1
  50. data/lib/puppet/reference/providers.rb +2 -2
  51. data/lib/puppet/resource/type_collection.rb +2 -1
  52. data/lib/puppet/runtime.rb +11 -1
  53. data/lib/puppet/settings/file_setting.rb +3 -8
  54. data/lib/puppet/settings.rb +2 -2
  55. data/lib/puppet/test/test_helper.rb +4 -1
  56. data/lib/puppet/type/exec.rb +9 -1
  57. data/lib/puppet/type/group.rb +0 -1
  58. data/lib/puppet/type/resources.rb +1 -1
  59. data/lib/puppet/type/user.rb +0 -1
  60. data/lib/puppet/util/command_line.rb +1 -1
  61. data/lib/puppet/util/filetype.rb +2 -2
  62. data/lib/puppet/util/log.rb +1 -2
  63. data/lib/puppet/util/logging.rb +1 -25
  64. data/lib/puppet/util/pidlock.rb +1 -1
  65. data/lib/puppet/util/rdoc/parser/puppet_parser_core.rb +1 -1
  66. data/lib/puppet/util/suidmanager.rb +1 -2
  67. data/lib/puppet/util/tagging.rb +1 -0
  68. data/lib/puppet/util/windows/user.rb +0 -1
  69. data/lib/puppet/util.rb +4 -3
  70. data/lib/puppet/version.rb +1 -1
  71. data/lib/puppet.rb +2 -6
  72. data/man/man5/puppet.conf.5 +10 -2
  73. data/man/man8/puppet-agent.8 +4 -1
  74. data/man/man8/puppet-apply.8 +1 -1
  75. data/man/man8/puppet-catalog.8 +1 -1
  76. data/man/man8/puppet-config.8 +1 -1
  77. data/man/man8/puppet-describe.8 +1 -1
  78. data/man/man8/puppet-device.8 +1 -1
  79. data/man/man8/puppet-doc.8 +1 -1
  80. data/man/man8/puppet-epp.8 +1 -1
  81. data/man/man8/puppet-facts.8 +1 -1
  82. data/man/man8/puppet-filebucket.8 +1 -1
  83. data/man/man8/puppet-generate.8 +1 -1
  84. data/man/man8/puppet-help.8 +1 -1
  85. data/man/man8/puppet-lookup.8 +1 -1
  86. data/man/man8/puppet-module.8 +1 -1
  87. data/man/man8/puppet-node.8 +1 -1
  88. data/man/man8/puppet-parser.8 +1 -1
  89. data/man/man8/puppet-plugin.8 +1 -1
  90. data/man/man8/puppet-report.8 +1 -1
  91. data/man/man8/puppet-resource.8 +1 -1
  92. data/man/man8/puppet-script.8 +1 -1
  93. data/man/man8/puppet-ssl.8 +1 -1
  94. data/man/man8/puppet.8 +2 -2
  95. data/spec/integration/application/agent_spec.rb +16 -0
  96. data/spec/integration/configurer_spec.rb +1 -1
  97. data/spec/integration/indirector/facts/facter_spec.rb +3 -3
  98. data/spec/integration/transaction/report_spec.rb +1 -1
  99. data/spec/integration/type/file_spec.rb +2 -2
  100. data/spec/integration/type/package_spec.rb +6 -6
  101. data/spec/integration/util/rdoc/parser_spec.rb +1 -1
  102. data/spec/integration/util/windows/process_spec.rb +1 -9
  103. data/spec/unit/application/apply_spec.rb +76 -56
  104. data/spec/unit/application/resource_spec.rb +29 -0
  105. data/spec/unit/configurer_spec.rb +13 -3
  106. data/spec/unit/facter_impl_spec.rb +31 -0
  107. data/spec/unit/file_bucket/dipper_spec.rb +2 -2
  108. data/spec/unit/file_system_spec.rb +7 -0
  109. data/spec/unit/functions/lookup_spec.rb +64 -0
  110. data/spec/unit/indirector/indirection_spec.rb +10 -3
  111. data/spec/unit/pops/serialization/to_stringified_spec.rb +5 -0
  112. data/spec/unit/pops/types/type_calculator_spec.rb +6 -0
  113. data/spec/unit/provider/package/gem_spec.rb +1 -1
  114. data/spec/unit/provider/package/pip2_spec.rb +1 -1
  115. data/spec/unit/provider/package/pip3_spec.rb +1 -1
  116. data/spec/unit/provider/package/pip_spec.rb +1 -1
  117. data/spec/unit/provider/package/puppet_gem_spec.rb +1 -1
  118. data/spec/unit/provider/package/puppetserver_gem_spec.rb +1 -1
  119. data/spec/unit/provider/user/aix_spec.rb +100 -0
  120. data/spec/unit/provider/user/directoryservice_spec.rb +1 -1
  121. data/spec/unit/provider_spec.rb +4 -4
  122. data/spec/unit/puppet_spec.rb +12 -4
  123. data/spec/unit/settings/file_setting_spec.rb +10 -7
  124. data/spec/unit/type_spec.rb +2 -2
  125. data/spec/unit/util/logging_spec.rb +2 -0
  126. data/tasks/parallel.rake +3 -3
  127. metadata +5 -2
@@ -1142,7 +1142,7 @@ end
1142
1142
  provider.class.instance_variable_set(:@os_version, nil) if provider.class.instance_variable_defined? :@os_version
1143
1143
  end
1144
1144
 
1145
- it 'should call Facter.value(:macosx_productversion_major) ONLY ONCE no matter how ' +
1145
+ it 'should call Puppet.runtime[:facter].value(:macosx_productversion_major) ONLY ONCE no matter how ' +
1146
1146
  'many times get_os_version() is called' do
1147
1147
  expect(Facter).to receive(:value).with(:macosx_productversion_major).once.and_return('10.8')
1148
1148
  expect(provider.class.get_os_version).to eq('10.8')
@@ -222,18 +222,18 @@ describe Puppet::Provider do
222
222
  { :true => false } => false,
223
223
  { :false => false } => true,
224
224
  { :false => true } => false,
225
- { :operatingsystem => Facter.value(:operatingsystem) } => true,
225
+ { :operatingsystem => Puppet.runtime[:facter].value(:operatingsystem) } => true,
226
226
  { :operatingsystem => :yayness } => false,
227
227
  { :nothing => :yayness } => false,
228
228
  { :exists => Puppet::Util.which(existing_command) } => true,
229
229
  { :exists => "/this/file/does/not/exist" } => false,
230
230
  { :true => true, :exists => Puppet::Util.which(existing_command) } => true,
231
231
  { :true => true, :exists => "/this/file/does/not/exist" } => false,
232
- { :operatingsystem => Facter.value(:operatingsystem),
232
+ { :operatingsystem => Puppet.runtime[:facter].value(:operatingsystem),
233
233
  :exists => Puppet::Util.which(existing_command) } => true,
234
234
  { :operatingsystem => :yayness,
235
235
  :exists => Puppet::Util.which(existing_command) } => false,
236
- { :operatingsystem => Facter.value(:operatingsystem),
236
+ { :operatingsystem => Puppet.runtime[:facter].value(:operatingsystem),
237
237
  :exists => "/this/file/does/not/exist" } => false,
238
238
  { :operatingsystem => :yayness,
239
239
  :exists => "/this/file/does/not/exist" } => false,
@@ -269,7 +269,7 @@ describe Puppet::Provider do
269
269
  end
270
270
 
271
271
  context "default providers" do
272
- let :os do Facter.value(:operatingsystem) end
272
+ let :os do Puppet.runtime[:facter].value(:operatingsystem) end
273
273
 
274
274
  it { is_expected.to respond_to :specificity }
275
275
 
@@ -91,12 +91,20 @@ describe Puppet do
91
91
  expect(Puppet.runtime[:http]).to be_an_instance_of(Puppet::HTTP::Client)
92
92
  end
93
93
 
94
- it 'allows an implementation to be registered' do
95
- impl = double('http')
96
- Puppet.initialize_settings([], true, true, http: impl)
94
+ it 'allows a http implementation to be registered' do
95
+ http_impl = double('http')
96
+ Puppet.initialize_settings([], true, true, http: http_impl)
97
97
 
98
98
 
99
- expect(Puppet.runtime[:http]).to eq(impl)
99
+ expect(Puppet.runtime[:http]).to eq(http_impl)
100
+ end
101
+
102
+ it 'allows a facter implementation to be registered' do
103
+ facter_impl = double('facter')
104
+ Puppet.initialize_settings([], true, true, facter: facter_impl)
105
+
106
+
107
+ expect(Puppet.runtime[:facter]).to eq(facter_impl)
100
108
  end
101
109
  end
102
110
 
@@ -125,9 +125,10 @@ describe Puppet::Settings::FileSetting do
125
125
  describe "when being converted to a resource" do
126
126
  before do
127
127
  @basepath = make_absolute("/somepath")
128
+ allow(Puppet::FileSystem).to receive(:exist?).and_call_original
129
+ allow(Puppet::FileSystem).to receive(:exist?).with(@basepath).and_return(true)
128
130
  @settings = double('settings')
129
131
  @file = Puppet::Settings::FileSetting.new(:settings => @settings, :desc => "eh", :name => :myfile, :section => "mysect")
130
- allow(@file).to receive(:create_files?).and_return(true)
131
132
  allow(@settings).to receive(:value).with(:myfile, nil, false).and_return(@basepath)
132
133
  end
133
134
 
@@ -135,18 +136,19 @@ describe Puppet::Settings::FileSetting do
135
136
  expect(@file.type).to eq(:file)
136
137
  end
137
138
 
138
- it "should skip non-existent files if 'create_files' is not enabled" do
139
- expect(@file).to receive(:create_files?).and_return(false)
139
+ it "skips non-existent files" do
140
140
  expect(@file).to receive(:type).and_return(:file)
141
141
  expect(Puppet::FileSystem).to receive(:exist?).with(@basepath).and_return(false)
142
142
  expect(@file.to_resource).to be_nil
143
143
  end
144
144
 
145
- it "should manage existent files even if 'create_files' is not enabled" do
146
- expect(@file).to receive(:create_files?).and_return(false)
145
+ it "manages existing files" do
147
146
  expect(@file).to receive(:type).and_return(:file)
148
- allow(Puppet::FileSystem).to receive(:exist?)
149
- expect(Puppet::FileSystem).to receive(:exist?).with(@basepath).and_return(true)
147
+ expect(@file.to_resource).to be_instance_of(Puppet::Resource)
148
+ end
149
+
150
+ it "always manages directories" do
151
+ expect(@file).to receive(:type).and_return(:directory)
150
152
  expect(@file.to_resource).to be_instance_of(Puppet::Resource)
151
153
  end
152
154
 
@@ -177,6 +179,7 @@ describe Puppet::Settings::FileSetting do
177
179
  it "should fully qualified returned files if necessary (#795)" do
178
180
  allow(@settings).to receive(:value).with(:myfile, nil, false).and_return("myfile")
179
181
  path = File.expand_path('myfile')
182
+ allow(Puppet::FileSystem).to receive(:exist?).with(path).and_return(true)
180
183
  expect(@file.to_resource.title).to eq(path)
181
184
  end
182
185
 
@@ -1142,7 +1142,7 @@ describe Puppet::Type, :unless => Puppet::Util::Platform.windows? do
1142
1142
 
1143
1143
  before :each do
1144
1144
  type.provide(:default) do
1145
- defaultfor :operatingsystem => Facter.value(:operatingsystem)
1145
+ defaultfor :operatingsystem => Puppet.runtime[:facter].value(:operatingsystem)
1146
1146
  mk_resource_methods
1147
1147
  class << self
1148
1148
  attr_accessor :params
@@ -1172,7 +1172,7 @@ describe Puppet::Type, :unless => Puppet::Util::Platform.windows? do
1172
1172
  context "with a default provider" do
1173
1173
  before :each do
1174
1174
  type.provide(:default) do
1175
- defaultfor :operatingsystem => Facter.value(:operatingsystem)
1175
+ defaultfor :operatingsystem => Puppet.runtime[:facter].value(:operatingsystem)
1176
1176
  mk_resource_methods
1177
1177
  class << self
1178
1178
  attr_accessor :names
@@ -552,6 +552,7 @@ original
552
552
 
553
553
  describe 'does support debugging' do
554
554
  before :each do
555
+ allow(Facter).to receive(:respond_to?).with(:on_message).and_return(true)
555
556
  allow(Facter).to receive(:respond_to?).with(:debugging, any_args).and_return(true)
556
557
  end
557
558
 
@@ -568,6 +569,7 @@ original
568
569
 
569
570
  describe 'does support trace' do
570
571
  before :each do
572
+ allow(Facter).to receive(:respond_to?).with(:on_message)
571
573
  allow(Facter).to receive(:respond_to?).with(:trace, any_args).and_return(true)
572
574
  end
573
575
 
data/tasks/parallel.rake CHANGED
@@ -5,9 +5,9 @@ require 'thread'
5
5
  begin
6
6
  require 'rspec'
7
7
  require 'rspec/core/formatters/helpers'
8
- require 'facter'
8
+ require 'etc'
9
9
  rescue LoadError
10
- # Don't define the task if we don't have rspec or facter present
10
+ # Don't define the task if we don't have rspec present
11
11
  else
12
12
  module Parallel
13
13
  module RSpec
@@ -401,7 +401,7 @@ else
401
401
  # Default group size in rspec examples
402
402
  DEFAULT_GROUP_SIZE = 1000
403
403
 
404
- process_count = [(args[:process_count] || Facter.value("processorcount")).to_i, 1].max
404
+ process_count = [(args[:process_count] || Etc.nprocessors).to_i, 1].max
405
405
  group_size = [(args[:group_size] || DEFAULT_GROUP_SIZE).to_i, 1].max
406
406
 
407
407
  abort unless Parallel::RSpec::Parallelizer.new(process_count, group_size, color_output?, args.extras).run
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: 7.10.0
4
+ version: 7.11.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: 2021-08-16 00:00:00.000000000 Z
11
+ date: 2021-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: facter
@@ -317,6 +317,7 @@ files:
317
317
  - lib/puppet/face/plugin.rb
318
318
  - lib/puppet/face/report.rb
319
319
  - lib/puppet/face/resource.rb
320
+ - lib/puppet/facter_impl.rb
320
321
  - lib/puppet/feature/base.rb
321
322
  - lib/puppet/feature/bolt.rb
322
323
  - lib/puppet/feature/cfpropertylist.rb
@@ -1870,6 +1871,7 @@ files:
1870
1871
  - spec/unit/face/parser_spec.rb
1871
1872
  - spec/unit/face/plugin_spec.rb
1872
1873
  - spec/unit/face_spec.rb
1874
+ - spec/unit/facter_impl_spec.rb
1873
1875
  - spec/unit/file_bucket/dipper_spec.rb
1874
1876
  - spec/unit/file_bucket/file_spec.rb
1875
1877
  - spec/unit/file_serving/base_spec.rb
@@ -3126,6 +3128,7 @@ test_files:
3126
3128
  - spec/unit/face/parser_spec.rb
3127
3129
  - spec/unit/face/plugin_spec.rb
3128
3130
  - spec/unit/face_spec.rb
3131
+ - spec/unit/facter_impl_spec.rb
3129
3132
  - spec/unit/file_bucket/dipper_spec.rb
3130
3133
  - spec/unit/file_bucket/file_spec.rb
3131
3134
  - spec/unit/file_serving/base_spec.rb