puppet 7.23.0 → 7.24.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -2
  3. data/Gemfile.lock +36 -33
  4. data/lib/puppet/application/face_base.rb +2 -1
  5. data/lib/puppet/defaults.rb +13 -0
  6. data/lib/puppet/environments.rb +9 -0
  7. data/lib/puppet/functions/each.rb +11 -13
  8. data/lib/puppet/functions/filter.rb +5 -13
  9. data/lib/puppet/functions/map.rb +7 -8
  10. data/lib/puppet/interface/action.rb +3 -3
  11. data/lib/puppet/interface/documentation.rb +2 -2
  12. data/lib/puppet/interface/option.rb +3 -4
  13. data/lib/puppet/module/plan.rb +1 -1
  14. data/lib/puppet/module/task.rb +1 -1
  15. data/lib/puppet/module.rb +1 -1
  16. data/lib/puppet/network/http/api/indirected_routes.rb +5 -4
  17. data/lib/puppet/node/environment.rb +38 -0
  18. data/lib/puppet/node.rb +2 -2
  19. data/lib/puppet/pops/evaluator/relationship_operator.rb +1 -1
  20. data/lib/puppet/pops/functions/function.rb +1 -3
  21. data/lib/puppet/pops/loader/dependency_loader.rb +1 -4
  22. data/lib/puppet/pops/loader/loader_paths.rb +1 -3
  23. data/lib/puppet/pops/loader/module_loaders.rb +1 -1
  24. data/lib/puppet/pops/loaders.rb +6 -2
  25. data/lib/puppet/pops/lookup/context.rb +3 -4
  26. data/lib/puppet/pops/lookup/hiera_config.rb +1 -1
  27. data/lib/puppet/resource.rb +4 -0
  28. data/lib/puppet/settings/base_setting.rb +3 -2
  29. data/lib/puppet/settings.rb +0 -1
  30. data/lib/puppet/type/file/ctime.rb +1 -1
  31. data/lib/puppet/type/file/mtime.rb +1 -1
  32. data/lib/puppet/util/log.rb +2 -2
  33. data/lib/puppet/version.rb +1 -1
  34. data/man/man5/puppet.conf.5 +13 -2
  35. data/man/man8/puppet-agent.8 +1 -1
  36. data/man/man8/puppet-apply.8 +1 -1
  37. data/man/man8/puppet-catalog.8 +1 -1
  38. data/man/man8/puppet-config.8 +1 -1
  39. data/man/man8/puppet-describe.8 +1 -1
  40. data/man/man8/puppet-device.8 +1 -1
  41. data/man/man8/puppet-doc.8 +1 -1
  42. data/man/man8/puppet-epp.8 +1 -1
  43. data/man/man8/puppet-facts.8 +1 -1
  44. data/man/man8/puppet-filebucket.8 +1 -1
  45. data/man/man8/puppet-generate.8 +1 -1
  46. data/man/man8/puppet-help.8 +1 -1
  47. data/man/man8/puppet-lookup.8 +1 -1
  48. data/man/man8/puppet-module.8 +1 -1
  49. data/man/man8/puppet-node.8 +1 -1
  50. data/man/man8/puppet-parser.8 +1 -1
  51. data/man/man8/puppet-plugin.8 +1 -1
  52. data/man/man8/puppet-report.8 +1 -1
  53. data/man/man8/puppet-resource.8 +1 -1
  54. data/man/man8/puppet-script.8 +1 -1
  55. data/man/man8/puppet-ssl.8 +1 -1
  56. data/man/man8/puppet.8 +2 -2
  57. data/spec/fixtures/integration/application/module/environments/direnv/modules/nginx/README +3 -0
  58. data/spec/fixtures/integration/application/module/environments/direnv/modules/nginx/manifests/init.pp +17 -0
  59. data/spec/fixtures/integration/application/module/environments/direnv/modules/nginx/metadata.json +20 -0
  60. data/spec/integration/application/module_spec.rb +141 -0
  61. data/spec/unit/environments_spec.rb +9 -0
  62. data/spec/unit/network/http/api/indirected_routes_spec.rb +2 -0
  63. data/spec/unit/node/environment_spec.rb +41 -0
  64. data/spec/unit/parser/resource_spec.rb +9 -0
  65. data/spec/unit/type/file/ctime_spec.rb +1 -1
  66. data/spec/unit/type/file/mtime_spec.rb +1 -1
  67. metadata +8 -2
@@ -11,8 +11,12 @@ module Puppet::Pops
11
11
  class Loaders
12
12
  class LoaderError < Puppet::Error; end
13
13
 
14
- attr_reader :static_loader
15
- attr_reader :puppet_system_loader
14
+ # Commented out the :static_loader and :puppet_system_loader
15
+ # because of rubocop offenses with duplicated definitions of
16
+ # these generated methods, but keeping them here for visibility
17
+ # on how the loaders are stacked.
18
+ # attr_reader :static_loader
19
+ # attr_reader :puppet_system_loader
16
20
  attr_reader :puppet_cache_loader
17
21
  attr_reader :public_environment_loader
18
22
  attr_reader :private_environment_loader
@@ -92,12 +92,11 @@ class FunctionContext
92
92
 
93
93
  def cached_entries(&block)
94
94
  if block_given?
95
- enumerator = @cache.each_pair
96
- @cache.size.times do
95
+ @cache.each_pair do |pair|
97
96
  if block.arity == 2
98
- yield(*enumerator.next)
97
+ yield(*pair)
99
98
  else
100
- yield(enumerator.next)
99
+ yield(pair)
101
100
  end
102
101
  end
103
102
  nil
@@ -166,7 +166,7 @@ class HieraConfig
166
166
  end
167
167
  end
168
168
 
169
- attr_reader :config_path, :version
169
+ attr_reader :config_path
170
170
 
171
171
  # Creates a new HieraConfig from the given _config_root_. This is where the 'lookup.yaml' is expected to be found
172
172
  # and is also the base location used when resolving relative paths.
@@ -323,6 +323,10 @@ class Puppet::Resource
323
323
  send(attr.to_s + "=", value)
324
324
  end
325
325
 
326
+ if environment.is_a?(Puppet::Node::Environment) && environment != Puppet::Node::Environment::NONE
327
+ self.file = environment.externalize_path(attributes[:file])
328
+ end
329
+
326
330
  @type, @title = self.class.type_and_title(type, title)
327
331
 
328
332
  rt = resource_type
@@ -3,8 +3,9 @@ require_relative '../../puppet/settings/errors'
3
3
 
4
4
  # The base setting type
5
5
  class Puppet::Settings::BaseSetting
6
- attr_accessor :name, :desc, :section, :default, :call_hook
7
- attr_reader :short, :deprecated
6
+ attr_writer :default
7
+ attr_accessor :name, :desc, :section
8
+ attr_reader :short, :deprecated, :call_hook
8
9
 
9
10
  # Hooks are called during different parts of the settings lifecycle:
10
11
  #
@@ -40,7 +40,6 @@ class Puppet::Settings
40
40
  # local reference for convenience
41
41
  PuppetOptionParser = Puppet::Util::CommandLine::PuppetOptionParser
42
42
 
43
- attr_accessor :files
44
43
  attr_reader :timer
45
44
 
46
45
  # These are the settings that every app is required to specify; there are
@@ -10,7 +10,7 @@ module Puppet
10
10
  if stat
11
11
  current_value = stat.ctime
12
12
  end
13
- current_value
13
+ current_value.to_s
14
14
  end
15
15
 
16
16
  validate do |val|
@@ -9,7 +9,7 @@ module Puppet
9
9
  if stat
10
10
  current_value = stat.mtime
11
11
  end
12
- current_value
12
+ current_value.to_s
13
13
  end
14
14
 
15
15
  validate do |val|
@@ -294,8 +294,8 @@ class Puppet::Util::Log
294
294
  end
295
295
 
296
296
 
297
- attr_accessor :time, :remote, :file, :line, :pos, :source, :issue_code, :environment, :node, :backtrace
298
- attr_reader :level, :message
297
+ attr_accessor :time, :remote, :file, :line, :pos, :issue_code, :environment, :node, :backtrace
298
+ attr_reader :level, :message, :source
299
299
 
300
300
  def initialize(args)
301
301
  self.level = args[:level]
@@ -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.23.0'
9
+ PUPPETVERSION = '7.24.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" "February 2023" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPETCONF" "5" "March 2023" "Puppet, Inc." "Puppet manual"
5
5
  \fBThis page is autogenerated; any changes will get overwritten\fR
6
6
  .
7
7
  .SH "Configuration settings"
@@ -937,7 +937,7 @@ The time to wait for data to be read from an HTTP connection\. If nothing is rea
937
937
  The HTTP User\-Agent string to send when making network requests\.
938
938
  .
939
939
  .IP "\(bu" 4
940
- \fIDefault\fR: \fBPuppet/7\.23\.0 Ruby/2\.7\.5\-p203 (x86_64\-linux)\fR
940
+ \fIDefault\fR: \fBPuppet/7\.24\.0 Ruby/2\.7\.5\-p203 (x86_64\-linux)\fR
941
941
  .
942
942
  .IP "" 0
943
943
  .
@@ -1599,6 +1599,17 @@ Whether to send reports after every transaction\.
1599
1599
  .
1600
1600
  .IP "" 0
1601
1601
  .
1602
+ .SS "report_configured_environmentpath"
1603
+ When versioned_environment_dirs is \fBtrue\fR Puppet will readlink the environmentpath when constructing the environment\'s modulepath\. The full readlinked path is referred to as the "resolved path" and the configured path potentially containing symlinks is the "configured path"\. When reporting where resources come from users may choose between the configured or resolved path\.
1604
+ .
1605
+ .P
1606
+ When set to false, the resolved paths are reported instead of the configured paths\.
1607
+ .
1608
+ .IP "\(bu" 4
1609
+ \fIDefault\fR: \fBtrue\fR
1610
+ .
1611
+ .IP "" 0
1612
+ .
1602
1613
  .SS "report_include_system_store"
1603
1614
  Whether the \'http\' report processor should include the system certificate store when submitting reports to HTTPS URLs\. If false, then the \'http\' processor will only trust HTTPS report servers whose certificates are issued by the puppet CA or one of its intermediate CAs\. If true, the processor will additionally trust CA certificates in the system\'s certificate store\.
1604
1615
  .
@@ -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" "February 2023" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-AGENT" "8" "March 2023" "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" "February 2023" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-APPLY" "8" "March 2023" "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" "February 2023" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-CATALOG" "8" "March 2023" "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" "February 2023" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-CONFIG" "8" "March 2023" "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" "February 2023" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-DESCRIBE" "8" "March 2023" "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" "February 2023" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-DEVICE" "8" "March 2023" "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" "February 2023" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-DOC" "8" "March 2023" "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" "February 2023" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-EPP" "8" "March 2023" "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" "February 2023" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-FACTS" "8" "March 2023" "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" "February 2023" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-FILEBUCKET" "8" "March 2023" "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" "February 2023" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-GENERATE" "8" "March 2023" "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" "February 2023" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-HELP" "8" "March 2023" "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" "February 2023" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-LOOKUP" "8" "March 2023" "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" "February 2023" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-MODULE" "8" "March 2023" "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" "February 2023" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-NODE" "8" "March 2023" "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" "February 2023" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-PARSER" "8" "March 2023" "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" "February 2023" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-PLUGIN" "8" "March 2023" "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" "February 2023" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-REPORT" "8" "March 2023" "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" "February 2023" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-RESOURCE" "8" "March 2023" "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" "February 2023" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-SCRIPT" "8" "March 2023" "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" "February 2023" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-SSL" "8" "March 2023" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-ssl\fR \- Manage SSL keys and certificates for puppet SSL clients
data/man/man8/puppet.8 CHANGED
@@ -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" "February 2023" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET" "8" "March 2023" "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\.23\.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\.24\.0
@@ -0,0 +1,3 @@
1
+ nginx
2
+
3
+ This is the nginx module.
@@ -0,0 +1,17 @@
1
+ # Class: nginx
2
+ #
3
+ # This module manages nginx
4
+ #
5
+ # Parameters:
6
+ #
7
+ # Actions:
8
+ #
9
+ # Requires:
10
+ #
11
+ # Sample Usage:
12
+ #
13
+ # [Remember: No empty lines between comments and class definition]
14
+ class nginx {
15
+
16
+
17
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "pmtacceptance/nginx",
3
+ "version": "0.0.1",
4
+ "source": "UNKNOWN",
5
+ "author": "pmtacceptance",
6
+ "license": "UNKNOWN",
7
+ "summary": "UNKNOWN",
8
+ "description": "UNKNOWN",
9
+ "project_page": "UNKNOWN",
10
+ "dependencies": [
11
+
12
+ ],
13
+ "types": [
14
+
15
+ ],
16
+ "checksums": {
17
+ "README": "5c4fbf4812d8a4d4b0fe1c13ad640b0e",
18
+ "manifests/init.pp": "3a8ab171fd609a527ae0b293ced9a014"
19
+ }
20
+ }
@@ -86,4 +86,145 @@ describe 'puppet module', unless: Puppet::Util::Platform.jruby? do
86
86
  end
87
87
  end
88
88
  end
89
+
90
+ context 'install' do
91
+ it 'lists a module in a non-default directory environment' do
92
+ Puppet.initialize_settings(['-E', 'direnv'])
93
+ Puppet[:color] = false
94
+ Puppet[:environmentpath] = File.join(my_fixture_dir, 'environments')
95
+
96
+ expect {
97
+ app.command_line.args = ['list']
98
+ app.run
99
+ }.to exit_with(0)
100
+ .and output(Regexp.new("└── pmtacceptance-nginx".encode(Encoding.default_external), Regexp::MULTILINE)).to_stdout
101
+ end
102
+ end
103
+
104
+ context 'changes' do
105
+ let(:tmp) { tmpdir('module_changes') }
106
+
107
+ before :each do
108
+ Puppet.initialize_settings(['-E', 'direnv'])
109
+ Puppet[:color] = false
110
+ end
111
+
112
+ def use_local_fixture
113
+ Puppet[:environmentpath] = File.join(my_fixture_dir, 'environments')
114
+ end
115
+
116
+ def create_working_copy
117
+ Puppet[:environmentpath] = File.join(tmp, 'environments')
118
+ FileUtils.cp_r(File.join(my_fixture_dir, 'environments'), tmp)
119
+ end
120
+
121
+ it 'reports an error when the install path is invalid' do
122
+ use_local_fixture
123
+
124
+ pattern = Regexp.new([
125
+ %Q{.*Error: Could not find a valid module at "#{tmp}/nginx".*},
126
+ %Q{.*Error: Try 'puppet help module changes' for usage.*},
127
+ ].join("\n"), Regexp::MULTILINE)
128
+
129
+ expect {
130
+ app.command_line.args = ['changes', File.join(tmp, 'nginx')]
131
+ app.run
132
+ }.to exit_with(1)
133
+ .and output(pattern).to_stderr
134
+ end
135
+
136
+ it 'reports when checksums are missing from metadata.json' do
137
+ create_working_copy
138
+
139
+ # overwrite checksums in metadata.json
140
+ nginx_dir = File.join(tmp, 'environments', 'direnv', 'modules', 'nginx')
141
+ File.write(File.join(nginx_dir, 'metadata.json'), <<~END)
142
+ {
143
+ "name": "pmtacceptance/nginx",
144
+ "version": "0.0.1"
145
+ }
146
+ END
147
+
148
+ pattern = Regexp.new([
149
+ %Q{.*Error: No file containing checksums found.*},
150
+ %Q{.*Error: Try 'puppet help module changes' for usage.*},
151
+ ].join("\n"), Regexp::MULTILINE)
152
+
153
+ expect {
154
+ app.command_line.args = ['changes', nginx_dir]
155
+ app.run
156
+ }.to exit_with(1)
157
+ .and output(pattern).to_stderr
158
+ end
159
+
160
+ it 'reports module not found when metadata.json is missing' do
161
+ create_working_copy
162
+
163
+ # overwrite checksums in metadata.json
164
+ nginx_dir = File.join(tmp, 'environments', 'direnv', 'modules', 'nginx')
165
+ File.unlink(File.join(nginx_dir, 'metadata.json'))
166
+
167
+ pattern = Regexp.new([
168
+ %Q{.*Error: Could not find a valid module at.*},
169
+ %Q{.*Error: Try 'puppet help module changes' for usage.*},
170
+ ].join("\n"), Regexp::MULTILINE)
171
+
172
+ expect {
173
+ app.command_line.args = ['changes', nginx_dir]
174
+ app.run
175
+ }.to exit_with(1)
176
+ .and output(pattern).to_stderr
177
+ end
178
+
179
+ it 'reports when a file is modified' do
180
+ create_working_copy
181
+
182
+ # overwrite README so checksum doesn't match
183
+ nginx_dir = File.join(tmp, 'environments', 'direnv', 'modules', 'nginx')
184
+ File.write(File.join(nginx_dir, 'README'), '')
185
+
186
+ pattern = Regexp.new([
187
+ %Q{.*Warning: 1 files modified.*},
188
+ ].join("\n"), Regexp::MULTILINE)
189
+
190
+ expect {
191
+ app.command_line.args = ['changes', nginx_dir]
192
+ app.run
193
+ }.to exit_with(0)
194
+ .and output(%r{README}).to_stdout
195
+ .and output(pattern).to_stderr
196
+ end
197
+
198
+ it 'reports when a file is missing' do
199
+ create_working_copy
200
+
201
+ # delete README so checksum doesn't match
202
+ nginx_dir = File.join(tmp, 'environments', 'direnv', 'modules', 'nginx')
203
+ File.unlink(File.join(nginx_dir, 'README'))
204
+
205
+ # odd that it says modified
206
+ pattern = Regexp.new([
207
+ %Q{.*Warning: 1 files modified.*},
208
+ ].join("\n"), Regexp::MULTILINE)
209
+
210
+ expect {
211
+ app.command_line.args = ['changes', nginx_dir]
212
+ app.run
213
+ }.to exit_with(0)
214
+ .and output(%r{README}).to_stdout
215
+ .and output(pattern).to_stderr
216
+ end
217
+
218
+ it 'reports when there are no changes' do
219
+ use_local_fixture
220
+
221
+ nginx_dir = File.join(Puppet[:environmentpath], 'direnv', 'modules', 'nginx')
222
+
223
+ expect {
224
+ app.command_line.args = ['changes', nginx_dir]
225
+ app.run
226
+ }.to exit_with(0)
227
+ .and output(/No modified files/).to_stdout
228
+ end
229
+ end
89
230
  end
@@ -115,6 +115,15 @@ describe Puppet::Environments do
115
115
  end
116
116
  end
117
117
 
118
+ it "sets the environment's configured and resolved paths set when symlinked" do
119
+ loader_from(:filesystem => [directory_tree],
120
+ :directory => directory_tree.children.first) do |loader|
121
+ env = loader.get("symlinked_environment")
122
+ expect(env.resolved_path).to eq("#{FS.path_string(directory_tree)}/versioned_env")
123
+ expect(env.configured_path).to eq("#{FS.path_string(directory_tree)}/envdir/symlinked_environment")
124
+ end
125
+ end
126
+
118
127
  it "ignores symlinked environments when `:versioned_environment_dirs` is false" do
119
128
  Puppet[:versioned_environment_dirs] = false
120
129
  loader_from(:filesystem => [directory_tree],
@@ -182,6 +182,7 @@ describe Puppet::Network::HTTP::API::IndirectedRoutes do
182
182
  indirection.save(data, "my data")
183
183
  request = a_request_that_finds(data, :accept_header => "application/json, text/pson")
184
184
  allow(data).to receive(:to_json).and_raise(Puppet::Network::FormatHandler::FormatError, 'Could not render to Puppet::Network::Format[json]: source sequence is illegal/malformed utf-8')
185
+ expect(Puppet).to receive(:warning).with(/Failed to serialize Puppet::IndirectorTesting for 'my data': Could not render to Puppet::Network::Format\[json\]/)
185
186
 
186
187
  handler.call(request, response)
187
188
 
@@ -228,6 +229,7 @@ describe Puppet::Network::HTTP::API::IndirectedRoutes do
228
229
  indirection.save(data, "my data")
229
230
  request = a_request_that_searches(Puppet::IndirectorTesting.new("my"), :accept_header => "application/json, text/pson")
230
231
  allow(data).to receive(:to_json).and_raise(Puppet::Network::FormatHandler::FormatError, 'Could not render to Puppet::Network::Format[json]: source sequence is illegal/malformed utf-8')
232
+ expect(Puppet).to receive(:warning).with(/Failed to serialize Puppet::IndirectorTesting for 'my': Could not render_multiple to Puppet::Network::Format\[json\]/)
231
233
 
232
234
  handler.call(request, response)
233
235