puppet 7.0.0-x86-mingw32 → 7.1.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.

Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/CODEOWNERS +2 -16
  3. data/Gemfile +2 -3
  4. data/Gemfile.lock +13 -9
  5. data/ext/project_data.yaml +1 -0
  6. data/lib/puppet/application_support.rb +7 -0
  7. data/lib/puppet/defaults.rb +1 -27
  8. data/lib/puppet/environments.rb +38 -54
  9. data/lib/puppet/face/node/clean.rb +8 -0
  10. data/lib/puppet/ffi/posix.rb +10 -0
  11. data/lib/puppet/ffi/posix/constants.rb +14 -0
  12. data/lib/puppet/ffi/posix/functions.rb +24 -0
  13. data/lib/puppet/parser/templatewrapper.rb +1 -1
  14. data/lib/puppet/provider/user/aix.rb +2 -2
  15. data/lib/puppet/type/user.rb +1 -1
  16. data/lib/puppet/util/posix.rb +53 -4
  17. data/lib/puppet/version.rb +1 -1
  18. data/man/man5/puppet.conf.5 +2 -2
  19. data/man/man8/puppet-agent.8 +1 -1
  20. data/man/man8/puppet-apply.8 +1 -1
  21. data/man/man8/puppet-catalog.8 +1 -1
  22. data/man/man8/puppet-config.8 +1 -1
  23. data/man/man8/puppet-describe.8 +1 -1
  24. data/man/man8/puppet-device.8 +1 -1
  25. data/man/man8/puppet-doc.8 +1 -1
  26. data/man/man8/puppet-epp.8 +1 -1
  27. data/man/man8/puppet-facts.8 +1 -1
  28. data/man/man8/puppet-filebucket.8 +1 -1
  29. data/man/man8/puppet-generate.8 +1 -1
  30. data/man/man8/puppet-help.8 +1 -1
  31. data/man/man8/puppet-lookup.8 +1 -1
  32. data/man/man8/puppet-module.8 +1 -1
  33. data/man/man8/puppet-node.8 +1 -1
  34. data/man/man8/puppet-parser.8 +1 -1
  35. data/man/man8/puppet-plugin.8 +1 -1
  36. data/man/man8/puppet-report.8 +1 -1
  37. data/man/man8/puppet-resource.8 +1 -1
  38. data/man/man8/puppet-script.8 +1 -1
  39. data/man/man8/puppet-ssl.8 +1 -1
  40. data/man/man8/puppet.8 +2 -2
  41. data/spec/fixtures/unit/provider/user/aix/aix_passwd_file.out +4 -0
  42. data/spec/unit/application_spec.rb +34 -0
  43. data/spec/unit/defaults_spec.rb +1 -56
  44. data/spec/unit/environments_spec.rb +96 -19
  45. data/spec/unit/face/node_spec.rb +14 -2
  46. data/spec/unit/parser/templatewrapper_spec.rb +4 -3
  47. data/spec/unit/provider/user/aix_spec.rb +5 -0
  48. data/spec/unit/provider/user/pw_spec.rb +2 -0
  49. data/spec/unit/provider/user/useradd_spec.rb +1 -0
  50. data/spec/unit/util/posix_spec.rb +357 -15
  51. data/spec/unit/util/storage_spec.rb +3 -1
  52. metadata +19 -2
@@ -50,7 +50,7 @@ class Puppet::Parser::TemplateWrapper
50
50
  # @return [Array<String>] The tags defined in the current scope
51
51
  # @api public
52
52
  def tags
53
- scope.tags
53
+ raise NotImplementedError, "Call 'all_tags' instead."
54
54
  end
55
55
 
56
56
  # @return [Array<String>] All the defined tags
@@ -178,7 +178,7 @@ Puppet::Type.type(:user).provide :aix, :parent => Puppet::Provider::AixObject do
178
178
  # does not have a password.
179
179
  break if line =~ /^\S+:$/
180
180
 
181
- match_obj = /password = (\S+)/.match(line)
181
+ match_obj = /password\s+=\s+(\S+)/.match(line)
182
182
  end
183
183
  return :absent unless match_obj
184
184
 
@@ -211,7 +211,7 @@ Puppet::Type.type(:user).provide :aix, :parent => Puppet::Provider::AixObject do
211
211
  tempfile = Tempfile.new("puppet_#{user}_pw", :encoding => Encoding::ASCII)
212
212
  tempfile << "#{user}:#{value}\n"
213
213
  tempfile.close()
214
-
214
+
215
215
  # Options '-e', '-c', use encrypted password and clear flags
216
216
  # Must receive "user:enc_password" as input
217
217
  # command, arguments = {:failonfail => true, :combine => true}
@@ -465,7 +465,7 @@ module Puppet
465
465
  groups = obj.shouldorig if obj
466
466
  if groups
467
467
  groups = groups.collect { |group|
468
- if group =~ /^\d+$/
468
+ if group.is_a?(String) && group =~/^\d+$/
469
469
  Integer(group)
470
470
  else
471
471
  group
@@ -12,9 +12,16 @@ module Puppet::Util::POSIX
12
12
  class << self
13
13
  # Returns an array of all the groups that the user's a member of.
14
14
  def groups_of(user)
15
- groups = []
16
- Puppet::Etc.group do |group|
17
- groups << group.name if group.mem.include?(user)
15
+ begin
16
+ require 'puppet/ffi/posix'
17
+ groups = get_groups_list(user)
18
+ rescue StandardError, LoadError => e
19
+ Puppet.debug("Falling back to Puppet::Etc.group: #{e.message}")
20
+
21
+ groups = []
22
+ Puppet::Etc.group do |group|
23
+ groups << group.name if group.mem.include?(user)
24
+ end
18
25
  end
19
26
 
20
27
  uniq_groups = groups.uniq
@@ -24,6 +31,39 @@ module Puppet::Util::POSIX
24
31
 
25
32
  uniq_groups
26
33
  end
34
+
35
+ private
36
+ def get_groups_list(user)
37
+ raise LoadError, "The 'getgrouplist' method is not available" unless Puppet::FFI::POSIX::Functions.respond_to?(:getgrouplist)
38
+
39
+ user_gid = Puppet::Etc.getpwnam(user).gid
40
+ ngroups = Puppet::FFI::POSIX::Constants::MAXIMUM_NUMBER_OF_GROUPS
41
+
42
+ while true do # rubocop:disable Lint/LiteralInCondition
43
+ FFI::MemoryPointer.new(:int) do |ngroups_ptr|
44
+ FFI::MemoryPointer.new(:uint, ngroups) do |groups_ptr|
45
+ old_ngroups = ngroups
46
+ ngroups_ptr.write_int(ngroups)
47
+
48
+ if Puppet::FFI::POSIX::Functions::getgrouplist(user, user_gid, groups_ptr, ngroups_ptr) != -1
49
+ groups_gids = groups_ptr.get_array_of_uint(0, ngroups_ptr.read_int)
50
+
51
+ result = []
52
+ groups_gids.each do |group_gid|
53
+ group_info = Puppet::Etc.getgrgid(group_gid)
54
+ result |= [group_info.name] if group_info.mem.include?(user)
55
+ end
56
+ return result
57
+ end
58
+
59
+ ngroups = ngroups_ptr.read_int
60
+ if ngroups <= old_ngroups
61
+ ngroups *= 2
62
+ end
63
+ end
64
+ end
65
+ end
66
+ end
27
67
  end
28
68
 
29
69
  # Retrieve a field from a POSIX Etc object. The id can be either an integer
@@ -144,8 +184,17 @@ module Puppet::Util::POSIX
144
184
  name = get_posix_field(location, :name, id)
145
185
  check_value = name
146
186
  end
187
+
147
188
  if check_value != field
148
- return search_posix_field(location, id_field, field)
189
+ check_value_id = get_posix_field(location, id_field, check_value) if check_value
190
+
191
+ if id == check_value_id
192
+ Puppet.debug("Multiple entries found for resource: '#{location}' with #{id_field}: #{id}")
193
+ return id
194
+ else
195
+ Puppet.debug("The value retrieved: '#{check_value}' is different than the required state: '#{field}', searching in all entries")
196
+ return search_posix_field(location, id_field, field)
197
+ end
149
198
  else
150
199
  return id
151
200
  end
@@ -6,7 +6,7 @@
6
6
  # Raketasks and such to set the version based on the output of `git describe`
7
7
 
8
8
  module Puppet
9
- PUPPETVERSION = '7.0.0'
9
+ PUPPETVERSION = '7.1.0'
10
10
 
11
11
  ##
12
12
  # version is a public API method intended to always provide a fast and
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPETCONF" "5" "November 2020" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPETCONF" "5" "December 2020" "Puppet, Inc." "Puppet manual"
5
5
  \fBThis page is autogenerated; any changes will get overwritten\fR
6
6
  .
7
7
  .SH "Configuration settings"
@@ -899,7 +899,7 @@ The time to wait for data to be read from an HTTP connection\. If nothing is rea
899
899
  The HTTP User\-Agent string to send when making network requests\.
900
900
  .
901
901
  .IP "\(bu" 4
902
- \fIDefault\fR: Puppet/7\.0\.0 Ruby/2\.5\.1\-p57 (x86_64\-linux)
902
+ \fIDefault\fR: Puppet/7\.1\.0 Ruby/2\.5\.1\-p57 (x86_64\-linux)
903
903
  .
904
904
  .IP "" 0
905
905
  .
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-AGENT" "8" "November 2020" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-AGENT" "8" "December 2020" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-agent\fR \- The puppet agent daemon
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-APPLY" "8" "November 2020" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-APPLY" "8" "December 2020" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-apply\fR \- Apply Puppet manifests locally
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-CATALOG" "8" "November 2020" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-CATALOG" "8" "December 2020" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-catalog\fR \- Compile, save, view, and convert catalogs\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-CONFIG" "8" "November 2020" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-CONFIG" "8" "December 2020" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-config\fR \- Interact with Puppet\'s settings\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-DESCRIBE" "8" "November 2020" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-DESCRIBE" "8" "December 2020" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-describe\fR \- Display help about resource types
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-DEVICE" "8" "November 2020" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-DEVICE" "8" "December 2020" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-device\fR \- Manage remote network devices
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-DOC" "8" "November 2020" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-DOC" "8" "December 2020" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-doc\fR \- Generate Puppet references
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-EPP" "8" "November 2020" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-EPP" "8" "December 2020" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-epp\fR \- Interact directly with the EPP template parser/renderer\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-FACTS" "8" "November 2020" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-FACTS" "8" "December 2020" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-facts\fR \- Retrieve and store facts\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-FILEBUCKET" "8" "November 2020" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-FILEBUCKET" "8" "December 2020" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-filebucket\fR \- Store and retrieve files in a filebucket
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-GENERATE" "8" "November 2020" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-GENERATE" "8" "December 2020" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-generate\fR \- Generates Puppet code from Ruby definitions\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-HELP" "8" "November 2020" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-HELP" "8" "December 2020" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-help\fR \- Display Puppet help\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-LOOKUP" "8" "November 2020" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-LOOKUP" "8" "December 2020" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-lookup\fR \- Interactive Hiera lookup
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-MODULE" "8" "November 2020" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-MODULE" "8" "December 2020" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-module\fR \- Creates, installs and searches for modules on the Puppet Forge\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-NODE" "8" "November 2020" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-NODE" "8" "December 2020" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-node\fR \- View and manage node definitions\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-PARSER" "8" "November 2020" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-PARSER" "8" "December 2020" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-parser\fR \- Interact directly with the parser\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-PLUGIN" "8" "November 2020" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-PLUGIN" "8" "December 2020" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-plugin\fR \- Interact with the Puppet plugin system\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-REPORT" "8" "November 2020" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-REPORT" "8" "December 2020" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-report\fR \- Create, display, and submit reports\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-RESOURCE" "8" "November 2020" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-RESOURCE" "8" "December 2020" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-resource\fR \- The resource abstraction layer shell
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-SCRIPT" "8" "November 2020" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-SCRIPT" "8" "December 2020" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-script\fR \- Run a puppet manifests as a script without compiling a catalog
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-SSL" "8" "November 2020" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-SSL" "8" "December 2020" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-ssl\fR \- Manage SSL keys and certificates for puppet SSL clients
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET" "8" "November 2020" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET" "8" "December 2020" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\fR
@@ -25,4 +25,4 @@ Specialized:
25
25
  catalog Compile, save, view, and convert catalogs\. describe Display help about resource types device Manage remote network devices doc Generate Puppet references epp Interact directly with the EPP template parser/renderer\. facts Retrieve and store facts\. filebucket Store and retrieve files in a filebucket generate Generates Puppet code from Ruby definitions\. node View and manage node definitions\. parser Interact directly with the parser\. plugin Interact with the Puppet plugin system\. script Run a puppet manifests as a script without compiling a catalog ssl Manage SSL keys and certificates for puppet SSL clients
26
26
  .
27
27
  .P
28
- See \'puppet help \fIsubcommand\fR \fIaction\fR\' for help on a specific subcommand action\. See \'puppet help \fIsubcommand\fR\' for help on a specific subcommand\. Puppet v7\.0\.0
28
+ See \'puppet help \fIsubcommand\fR \fIaction\fR\' for help on a specific subcommand action\. See \'puppet help \fIsubcommand\fR\' for help on a specific subcommand\. Puppet v7\.1\.0
@@ -6,6 +6,10 @@ test_aix_user:
6
6
  no_password_user:
7
7
  lastupdate = another_last_update
8
8
 
9
+ tab_password_user:
10
+ password = some_password
11
+ lastupdate = another_last_update
12
+
9
13
  daemon:
10
14
  password = *
11
15
 
@@ -511,6 +511,40 @@ describe Puppet::Application do
511
511
 
512
512
  expect { @app.configure_indirector_routes }.to raise_error(Puppet::Error, /mapping values are not allowed/)
513
513
  end
514
+
515
+ it "should treat master routes on server application" do
516
+ allow(@app).to receive(:name).and_return("server")
517
+
518
+ Puppet[:route_file] = tmpfile('routes')
519
+ File.open(Puppet[:route_file], 'w') do |f|
520
+ f.print <<-ROUTES
521
+ master:
522
+ node:
523
+ terminus: exec
524
+ ROUTES
525
+ end
526
+
527
+ @app.configure_indirector_routes
528
+
529
+ expect(Puppet::Node.indirection.terminus_class).to eq('exec')
530
+ end
531
+
532
+ it "should treat server routes on master application" do
533
+ allow(@app).to receive(:name).and_return("master")
534
+
535
+ Puppet[:route_file] = tmpfile('routes')
536
+ File.open(Puppet[:route_file], 'w') do |f|
537
+ f.print <<-ROUTES
538
+ server:
539
+ node:
540
+ terminus: exec
541
+ ROUTES
542
+ end
543
+
544
+ @app.configure_indirector_routes
545
+
546
+ expect(Puppet::Node.indirection.terminus_class).to eq('exec')
547
+ end
514
548
  end
515
549
 
516
550
  describe "when running" do
@@ -190,39 +190,8 @@ describe "Defaults" do
190
190
  end
191
191
  end
192
192
 
193
- describe "the call hook for the cadir setting", unless: Puppet::Util::Platform.windows? do
194
- it 'does not warn when the cadir is outside the puppet ssldir' do
195
- FileUtils.mkdir_p(Puppet[:confdir])
196
- # This is fun; in order to get the confdir setting from the spec_helper to
197
- # not be deleted by the #unsafe_clear in Puppet::Settings#parse_config,
198
- # we can code it into the confdir itself, and thus we can avoid getting
199
- # that setting wiped out during Puppet.initialize_settings.
200
- File.write(File.join(Puppet[:confdir], 'puppet.conf'),
201
- "cadir = /my/cool/path/for/my/cadir\n
202
- confdir = #{Puppet[:confdir]}")
203
- expect(Puppet).to_not receive(:log_ca_migration_warning)
204
- Puppet.initialize_settings
205
- expect(Puppet[:cadir]).to eq("/my/cool/path/for/my/cadir")
206
- end
207
-
208
- it 'does warn when the cadir is inside the puppet ssldir' do
209
- FileUtils.mkdir_p(Puppet[:confdir])
210
- cadir_location = File.join(Puppet[:ssldir], 'still_inside_ssldir')
211
- # This is fun; in order to get the confdir setting from the spec_helper to
212
- # not be deleted by the #unsafe_clear in Puppet::Settings#parse_config,
213
- # we can code it into the confdir itself, and thus we can avoid getting
214
- # that setting wiped out during Puppet.initialize_settings.
215
- File.write(File.join(Puppet[:confdir], 'puppet.conf'),
216
- "cadir = #{cadir_location}\n
217
- confdir = #{Puppet[:confdir]}")
218
- expect(Puppet).to receive(:log_ca_migration_warning).twice
219
- Puppet.initialize_settings
220
- expect(Puppet[:cadir]).to eq(cadir_location)
221
- end
222
- end
223
-
224
193
  describe "the default cadir", :unless => Puppet::Util::Platform.windows? do
225
- it 'defaults to the puppetserver confdir' do
194
+ it 'defaults to the puppetserver confdir when no cadir is found' do
226
195
  Puppet.initialize_settings
227
196
  expect(Puppet[:cadir]).to eq('/etc/puppetlabs/puppetserver/ca')
228
197
  end
@@ -234,34 +203,10 @@ describe "Defaults" do
234
203
  end
235
204
 
236
205
  describe '#default_cadir', :unless => Puppet::Util::Platform.windows? do
237
- it 'returns the new puppetserver directory when no ca dir is present' do
238
- expect(Puppet).to_not receive(:log_ca_migration_warning)
239
- expect(Puppet.default_cadir).to eq('/etc/puppetlabs/puppetserver/ca')
240
- end
241
-
242
206
  it 'warns when a CA dir exists in the current ssldir' do
243
207
  cadir = File.join(Puppet[:ssldir], 'ca')
244
208
  FileUtils.mkdir_p(cadir)
245
- expect(Puppet).to receive(:log_ca_migration_warning)
246
209
  expect(Puppet.default_cadir).to eq(cadir)
247
210
  end
248
-
249
- it 'warns when the cadir is a symlink still inside the ssldir' do
250
- another_dir = File.join(Puppet[:ssldir], 'another_dir')
251
- cadir = File.join(Puppet[:ssldir], 'ca')
252
- FileUtils.mkdir_p(another_dir)
253
- File.symlink(another_dir, cadir)
254
- expect(Puppet).to receive(:log_ca_migration_warning)
255
- expect(Puppet.default_cadir).to eq(another_dir)
256
- end
257
-
258
- it 'does not warn when the cadir is a symlink targeted outside the ssldir' do
259
- another_dir = Dir.mktmpdir
260
- cadir = File.join(Puppet[:ssldir], 'ca')
261
- FileUtils.mkdir_p(Puppet[:ssldir])
262
- File.symlink(another_dir, cadir)
263
- expect(Puppet).to_not receive(:log_ca_migration_warning)
264
- expect(Puppet.default_cadir).to eq(another_dir)
265
- end
266
211
  end
267
212
  end