puppet 7.8.0 → 7.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (146) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +5 -5
  3. data/Gemfile.lock +9 -9
  4. data/README.md +4 -4
  5. data/ext/project_data.yaml +1 -0
  6. data/install.rb +0 -4
  7. data/lib/puppet.rb +3 -3
  8. data/lib/puppet/application/filebucket.rb +1 -0
  9. data/lib/puppet/application/resource.rb +15 -2
  10. data/lib/puppet/application/ssl.rb +1 -0
  11. data/lib/puppet/defaults.rb +7 -0
  12. data/lib/puppet/environments.rb +10 -0
  13. data/lib/puppet/face/help/action.erb +1 -0
  14. data/lib/puppet/face/help/face.erb +1 -0
  15. data/lib/puppet/face/node/clean.rb +1 -1
  16. data/lib/puppet/file_system/file_impl.rb +1 -1
  17. data/lib/puppet/file_system/windows.rb +2 -2
  18. data/lib/puppet/forge.rb +3 -3
  19. data/lib/puppet/forge/cache.rb +1 -1
  20. data/lib/puppet/functions/empty.rb +8 -0
  21. data/lib/puppet/functions/strftime.rb +1 -0
  22. data/lib/puppet/functions/unwrap.rb +17 -2
  23. data/lib/puppet/indirector/resource/ral.rb +6 -1
  24. data/lib/puppet/interface/documentation.rb +1 -0
  25. data/lib/puppet/module_tool/applications/installer.rb +4 -0
  26. data/lib/puppet/module_tool/errors/shared.rb +17 -0
  27. data/lib/puppet/module_tool/tar/mini.rb +1 -1
  28. data/lib/puppet/pops/types/type_mismatch_describer.rb +1 -1
  29. data/lib/puppet/provider/exec/posix.rb +16 -4
  30. data/lib/puppet/provider/package/pip.rb +15 -3
  31. data/lib/puppet/provider/package/windows.rb +14 -1
  32. data/lib/puppet/provider/package/windows/exe_package.rb +30 -1
  33. data/lib/puppet/provider/package/windows/package.rb +2 -1
  34. data/lib/puppet/provider/parsedfile.rb +3 -0
  35. data/lib/puppet/resource/type_collection.rb +2 -0
  36. data/lib/puppet/settings.rb +30 -7
  37. data/lib/puppet/settings/config_file.rb +1 -8
  38. data/lib/puppet/settings/value_translator.rb +0 -1
  39. data/lib/puppet/type/exec.rb +16 -3
  40. data/lib/puppet/type/file/mode.rb +6 -0
  41. data/lib/puppet/type/tidy.rb +1 -1
  42. data/lib/puppet/type/user.rb +1 -1
  43. data/lib/puppet/util/monkey_patches.rb +2 -17
  44. data/lib/puppet/util/symbolic_file_mode.rb +29 -17
  45. data/lib/puppet/util/windows/sid.rb +3 -1
  46. data/lib/puppet/version.rb +1 -1
  47. data/lib/puppet/x509/cert_provider.rb +3 -21
  48. data/locales/puppet.pot +207 -171
  49. data/man/man5/puppet.conf.5 +2 -2
  50. data/man/man8/puppet-agent.8 +1 -1
  51. data/man/man8/puppet-apply.8 +1 -1
  52. data/man/man8/puppet-catalog.8 +9 -9
  53. data/man/man8/puppet-config.8 +1 -1
  54. data/man/man8/puppet-describe.8 +1 -1
  55. data/man/man8/puppet-device.8 +1 -1
  56. data/man/man8/puppet-doc.8 +1 -1
  57. data/man/man8/puppet-epp.8 +1 -1
  58. data/man/man8/puppet-facts.8 +7 -7
  59. data/man/man8/puppet-filebucket.8 +1 -1
  60. data/man/man8/puppet-generate.8 +1 -1
  61. data/man/man8/puppet-help.8 +1 -1
  62. data/man/man8/puppet-lookup.8 +1 -1
  63. data/man/man8/puppet-module.8 +1 -1
  64. data/man/man8/puppet-node.8 +5 -5
  65. data/man/man8/puppet-parser.8 +1 -1
  66. data/man/man8/puppet-plugin.8 +1 -1
  67. data/man/man8/puppet-report.8 +5 -5
  68. data/man/man8/puppet-resource.8 +1 -1
  69. data/man/man8/puppet-script.8 +1 -1
  70. data/man/man8/puppet-ssl.8 +1 -1
  71. data/man/man8/puppet.8 +2 -2
  72. data/spec/fixtures/ssl/127.0.0.1-key.pem +106 -106
  73. data/spec/fixtures/ssl/127.0.0.1.pem +48 -48
  74. data/spec/fixtures/ssl/bad-basic-constraints.pem +54 -54
  75. data/spec/fixtures/ssl/bad-int-basic-constraints.pem +51 -51
  76. data/spec/fixtures/ssl/ca.pem +52 -52
  77. data/spec/fixtures/ssl/crl.pem +25 -25
  78. data/spec/fixtures/ssl/ec-key-openssl.pem +8 -0
  79. data/spec/fixtures/ssl/ec-key-pk8.pem +5 -0
  80. data/spec/fixtures/ssl/ec-key.pem +11 -11
  81. data/spec/fixtures/ssl/ec.pem +32 -32
  82. data/spec/fixtures/ssl/encrypted-ec-key.pem +12 -12
  83. data/spec/fixtures/ssl/encrypted-key.pem +107 -107
  84. data/spec/fixtures/ssl/intermediate-agent-crl.pem +25 -25
  85. data/spec/fixtures/ssl/intermediate-agent.pem +54 -54
  86. data/spec/fixtures/ssl/intermediate-crl.pem +28 -28
  87. data/spec/fixtures/ssl/intermediate.pem +51 -51
  88. data/spec/fixtures/ssl/oid-key.pem +117 -0
  89. data/spec/fixtures/ssl/oid.pem +69 -0
  90. data/spec/fixtures/ssl/pluto-key.pem +106 -106
  91. data/spec/fixtures/ssl/pluto.pem +50 -50
  92. data/spec/fixtures/ssl/request-key.pem +106 -106
  93. data/spec/fixtures/ssl/request.pem +45 -45
  94. data/spec/fixtures/ssl/revoked-key.pem +106 -106
  95. data/spec/fixtures/ssl/revoked.pem +49 -49
  96. data/spec/fixtures/ssl/signed-key.pem +106 -106
  97. data/spec/fixtures/ssl/signed.pem +47 -47
  98. data/spec/fixtures/ssl/tampered-cert.pem +49 -49
  99. data/spec/fixtures/ssl/tampered-csr.pem +45 -45
  100. data/spec/fixtures/ssl/trusted_oid_mapping.yaml +5 -0
  101. data/spec/fixtures/ssl/unknown-127.0.0.1-key.pem +106 -106
  102. data/spec/fixtures/ssl/unknown-127.0.0.1.pem +48 -48
  103. data/spec/fixtures/ssl/unknown-ca-key.pem +106 -106
  104. data/spec/fixtures/ssl/unknown-ca.pem +52 -52
  105. data/spec/integration/application/filebucket_spec.rb +11 -0
  106. data/spec/integration/application/module_spec.rb +21 -0
  107. data/spec/integration/application/resource_spec.rb +35 -1
  108. data/spec/integration/application/ssl_spec.rb +20 -0
  109. data/spec/integration/defaults_spec.rb +5 -0
  110. data/spec/integration/environments/settings_interpolation_spec.rb +0 -4
  111. data/spec/integration/indirector/facts/facter_spec.rb +90 -36
  112. data/spec/integration/type/exec_spec.rb +70 -45
  113. data/spec/lib/puppet/test_ca.rb +5 -0
  114. data/spec/lib/puppet_spec/settings.rb +1 -0
  115. data/spec/unit/environments_spec.rb +35 -0
  116. data/spec/unit/file_system_spec.rb +6 -0
  117. data/spec/unit/functions/assert_type_spec.rb +1 -1
  118. data/spec/unit/functions/empty_spec.rb +10 -0
  119. data/spec/unit/functions/lookup_spec.rb +23 -0
  120. data/spec/unit/functions/unwrap_spec.rb +8 -0
  121. data/spec/unit/functions4_spec.rb +2 -2
  122. data/spec/unit/indirector/resource/ral_spec.rb +40 -75
  123. data/spec/unit/module_tool/applications/installer_spec.rb +13 -2
  124. data/spec/unit/parser/compiler_spec.rb +29 -0
  125. data/spec/unit/parser/templatewrapper_spec.rb +12 -2
  126. data/spec/unit/pops/loaders/dependency_loader_spec.rb +0 -9
  127. data/spec/unit/pops/parser/lexer2_spec.rb +0 -4
  128. data/spec/unit/provider/package/pip_spec.rb +37 -0
  129. data/spec/unit/provider/package/windows/exe_package_spec.rb +17 -0
  130. data/spec/unit/provider/parsedfile_spec.rb +10 -0
  131. data/spec/unit/resource/type_collection_spec.rb +16 -0
  132. data/spec/unit/resource/type_spec.rb +2 -2
  133. data/spec/unit/settings/config_file_spec.rb +1 -11
  134. data/spec/unit/settings/value_translator_spec.rb +4 -5
  135. data/spec/unit/settings_spec.rb +120 -79
  136. data/spec/unit/ssl/ssl_provider_spec.rb +18 -16
  137. data/spec/unit/type/exec_spec.rb +76 -29
  138. data/spec/unit/type/file/source_spec.rb +4 -4
  139. data/spec/unit/type/tidy_spec.rb +7 -0
  140. data/spec/unit/util/ldap/connection_spec.rb +10 -10
  141. data/spec/unit/util/ldap/manager_spec.rb +2 -2
  142. data/spec/unit/util/windows/sid_spec.rb +39 -4
  143. data/spec/unit/util_spec.rb +1 -3
  144. data/spec/unit/x509/cert_provider_spec.rb +9 -1
  145. data/tasks/generate_cert_fixtures.rake +10 -1
  146. metadata +16 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: acea3dc4fe14113e0ff4cacd327dda518e52ef5b69705573d538d417c677a6ac
4
- data.tar.gz: 0c5d176a6c15d1850ec8a0579360dca046818cb3a89622444f93a717d6b3c519
3
+ metadata.gz: a3a94d69b4fdb82daece239f631857956cb724f3f4582f50ecbec6a79dc83082
4
+ data.tar.gz: 3deb923bf30984f5543826b11c49d03d8b055c2135790447729e914e58840344
5
5
  SHA512:
6
- metadata.gz: 1f3f289599b56be4ec50fec65af00d84f767eb4551c73d58c5fc325cf69aaf0368827c110b00115245c71c91aec1bfeafe11660d9386db3635dc0ce376065d49
7
- data.tar.gz: 9ab440f65ee22b93546023166f22f65fb9c8d562c4d0adf037fce02312d6cb08bbc7b8897adcc865c20b99ced83043a4dba28754354211bb10a5d6cba9c063f3
6
+ metadata.gz: 9bcd1f23664896b430462ffc78a1fc63621017f76a96681f89e625685e58a2cc85ab06907b55320298864102c87f3bb621af73a057c63da8204927a6d7cabf84
7
+ data.tar.gz: a6f338d559652ebe22d656af5c6b4623a22bf69dea46bda83f676580b06595b5ed5fa02addb7b97bd1bafb4b332a53f4295d78ff02c2b08f593677055f9403dc
data/CONTRIBUTING.md CHANGED
@@ -38,12 +38,12 @@ the [puppet-dev mailing list](https://groups.google.com/forum/#!forum/puppet-dev
38
38
  ## Making Changes
39
39
 
40
40
  * Create a topic branch from where you want to base your work.
41
- * This is usually the master branch.
41
+ * This is usually the main branch.
42
42
  * Only target release branches if you are certain your fix must be on that
43
43
  branch.
44
- * To quickly create a topic branch based on master, run `git checkout -b
45
- fix/master/my_contribution master`. Please avoid working directly on the
46
- `master` branch.
44
+ * To quickly create a topic branch based on main, run `git checkout -b
45
+ fix/main/my_contribution main`. Please avoid working directly on the
46
+ `main` branch.
47
47
  * Make commits of logical and atomic units.
48
48
  * Check for unnecessary whitespace with `git diff --check` before committing.
49
49
  * Make sure your commit messages are in the proper format. If the commit
@@ -65,7 +65,7 @@ the [puppet-dev mailing list](https://groups.google.com/forum/#!forum/puppet-dev
65
65
  why this is a problem, and how the patch fixes the problem when applied.
66
66
  ```
67
67
  * Make sure you have added the necessary tests for your changes.
68
- * For details on how to run tests, please see [the quickstart guide](https://github.com/puppetlabs/puppet/blob/master/docs/quickstart.md)
68
+ * For details on how to run tests, please see [the quickstart guide](https://github.com/puppetlabs/puppet/blob/main/docs/quickstart.md)
69
69
 
70
70
  ## Writing Translatable Code
71
71
 
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  GIT
2
2
  remote: git://github.com/puppetlabs/packaging
3
- revision: 56b3c7db09d6cafe878ff4a9dfc048b5a5bea89c
3
+ revision: 4d6d51947f44bfa2fc282658836c15f69672e757
4
4
  branch: 1.0.x
5
5
  specs:
6
- packaging (0.99.77.2.g56b3c7d)
6
+ packaging (0.99.78.4.g4d6d519)
7
7
  artifactory (~> 2)
8
8
  csv (= 3.1.5)
9
9
  rake (>= 12.3)
@@ -12,7 +12,7 @@ GIT
12
12
  PATH
13
13
  remote: .
14
14
  specs:
15
- puppet (7.8.0)
15
+ puppet (7.9.0)
16
16
  CFPropertyList (~> 2.2)
17
17
  concurrent-ruby (~> 1.0)
18
18
  deep_merge (~> 1.0)
@@ -28,7 +28,7 @@ GEM
28
28
  remote: https://artifactory.delivery.puppetlabs.net/artifactory/api/gems/rubygems/
29
29
  specs:
30
30
  CFPropertyList (2.3.6)
31
- addressable (2.7.0)
31
+ addressable (2.8.0)
32
32
  public_suffix (>= 2.0.2, < 5.0)
33
33
  artifactory (2.8.2)
34
34
  ast (2.4.2)
@@ -40,11 +40,11 @@ GEM
40
40
  deep_merge (1.2.1)
41
41
  diff-lcs (1.4.4)
42
42
  docopt (0.6.1)
43
- facter (4.2.1)
43
+ facter (4.2.2)
44
44
  hocon (~> 1.3)
45
45
  thor (>= 1.0.1, < 2.0)
46
46
  fast_gettext (1.1.2)
47
- ffi (1.15.1)
47
+ ffi (1.15.3)
48
48
  gettext (3.2.9)
49
49
  locale (>= 2.0.5)
50
50
  text (>= 1.3.0)
@@ -80,14 +80,14 @@ GEM
80
80
  public_suffix (4.0.6)
81
81
  puppet-resource_api (1.8.14)
82
82
  hocon (>= 1.0)
83
- puppetserver-ca (2.1.0)
83
+ puppetserver-ca (2.2.0)
84
84
  facter (>= 2.0.1, < 5)
85
85
  racc (1.4.9)
86
86
  rainbow (2.2.2)
87
87
  rake
88
- rake (13.0.3)
88
+ rake (13.0.6)
89
89
  rdiscount (2.2.0.2)
90
- rdoc (6.3.1)
90
+ rdoc (6.3.2)
91
91
  release-metrics (1.1.0)
92
92
  csv
93
93
  docopt
data/README.md CHANGED
@@ -33,16 +33,16 @@ see the [Quick Start to Developing on Puppet](docs/quickstart.md) guide.
33
33
 
34
34
  We'd love to get contributions from you! For a quick guide to getting your
35
35
  system setup for developing, take a look at our [Quickstart
36
- Guide](https://github.com/puppetlabs/puppet/blob/master/docs/quickstart.md). Once you are up and running, take a look at the
37
- [Contribution Documents](https://github.com/puppetlabs/puppet/blob/master/CONTRIBUTING.md) to see how to get your changes merged
36
+ Guide](https://github.com/puppetlabs/puppet/blob/main/docs/quickstart.md). Once you are up and running, take a look at the
37
+ [Contribution Documents](https://github.com/puppetlabs/puppet/blob/main/CONTRIBUTING.md) to see how to get your changes merged
38
38
  in.
39
39
 
40
40
  For more complete docs on developing with Puppet, take a look at the
41
- rest of the [developer documents](https://github.com/puppetlabs/puppet/blob/master/docs/index.md).
41
+ rest of the [developer documents](https://github.com/puppetlabs/puppet/blob/main/docs/index.md).
42
42
 
43
43
  ## Licensing
44
44
 
45
- See [LICENSE](https://github.com/puppetlabs/puppet/blob/master/LICENSE) file. Puppet is licensed by Puppet, Inc. under the Apache license. Puppet, Inc. can be contacted at: info@puppet.com
45
+ See [LICENSE](https://github.com/puppetlabs/puppet/blob/main/LICENSE) file. Puppet is licensed by Puppet, Inc. under the Apache license. Puppet, Inc. can be contacted at: info@puppet.com
46
46
 
47
47
  ## Support
48
48
 
@@ -13,6 +13,7 @@ gem_files: '[A-Z]* install.rb bin lib conf man examples ext tasks spec locales'
13
13
  gem_test_files: 'spec/**/*'
14
14
  gem_executables: 'puppet'
15
15
  gem_default_executables: 'puppet'
16
+ gem_license: 'Apache-2.0'
16
17
  gem_forge_project: 'puppet'
17
18
  gem_required_ruby_version: '>= 2.5.0'
18
19
  gem_required_rubygems_version: '> 1.3.1'
data/install.rb CHANGED
@@ -159,10 +159,6 @@ def prepare_installation
159
159
  opts.on('--[no-]ri', 'Prevents the creation of RI output.', 'Default off on mswin32.') do |onri|
160
160
  InstallOptions.ri = onri
161
161
  end
162
- opts.on('--[no-]tests', 'Prevents the execution of unit tests.', 'Default off.') do |ontest|
163
- InstallOptions.tests = ontest
164
- warn "The tests flag is no longer functional in Puppet and is deprecated as of Dec 19, 2012. It will be removed in a future version of Puppet."
165
- end
166
162
  opts.on('--[no-]configs', 'Prevents the installation of config files', 'Default off.') do |ontest|
167
163
  InstallOptions.configs = ontest
168
164
  end
data/lib/puppet.rb CHANGED
@@ -199,9 +199,9 @@ module Puppet
199
199
 
200
200
  Facter.add(:agent_specified_environment) do
201
201
  setcode do
202
- if Puppet.settings.set_by_config?(:environment)
203
- Puppet[:environment]
204
- end
202
+ Puppet.settings.set_by_cli(:environment) ||
203
+ Puppet.settings.set_in_section(:environment, :agent) ||
204
+ Puppet.settings.set_in_section(:environment, :main)
205
205
  end
206
206
  end
207
207
  end
@@ -1,6 +1,7 @@
1
1
  require_relative '../../puppet/application'
2
2
 
3
3
  class Puppet::Application::Filebucket < Puppet::Application
4
+ environment_mode :not_required
4
5
 
5
6
  option("--bucket BUCKET","-b")
6
7
  option("--debug","-d")
@@ -1,6 +1,7 @@
1
1
  require_relative '../../puppet/application'
2
2
 
3
3
  class Puppet::Application::Resource < Puppet::Application
4
+ environment_mode :not_required
4
5
 
5
6
  attr_accessor :host, :extra_params
6
7
 
@@ -14,8 +15,9 @@ class Puppet::Application::Resource < Puppet::Application
14
15
  option("--to_yaml","-y")
15
16
 
16
17
  option("--types", "-t") do |arg|
18
+ env = Puppet.lookup(:environments).get(Puppet[:environment]) || create_default_environment
17
19
  types = []
18
- Puppet::Type.loadall
20
+ Puppet::Type.typeloader.loadall(env)
19
21
  Puppet::Type.eachtype do |t|
20
22
  next if t.name == :component
21
23
  types << t.name.to_s
@@ -134,7 +136,9 @@ Copyright (c) 2011 Puppet Inc., LLC Licensed under the Apache 2.0 License
134
136
  end
135
137
 
136
138
  def main
137
- env = Puppet.lookup(:environments).get(Puppet[:environment])
139
+ # If the specified environment does not exist locally, fall back to the default (production) environment
140
+ env = Puppet.lookup(:environments).get(Puppet[:environment]) || create_default_environment
141
+
138
142
  Puppet.override(:current_environment => env, :loaders => Puppet::Pops::Loaders.new(env)) do
139
143
  type, name, params = parse_args(command_line.args)
140
144
 
@@ -209,6 +213,15 @@ Copyright (c) 2011 Puppet Inc., LLC Licensed under the Apache 2.0 License
209
213
  [type, name, params]
210
214
  end
211
215
 
216
+ def create_default_environment
217
+ Puppet.debug("Specified environment '#{Puppet[:environment]}' does not exist on the filesystem, defaulting to 'production'")
218
+ Puppet[:environment] = :production
219
+ basemodulepath = Puppet::Node::Environment.split_path(Puppet[:basemodulepath])
220
+ modulepath = Puppet[:modulepath]
221
+ modulepath = (modulepath.nil? || modulepath.empty?) ? basemodulepath : Puppet::Node::Environment.split_path(modulepath)
222
+ Puppet::Node::Environment.create(Puppet[:environment], modulepath, Puppet::Node::Environment::NO_MANIFEST)
223
+ end
224
+
212
225
  def find_or_save_resources(type, name, params)
213
226
  key = local_key(type, name)
214
227
 
@@ -117,6 +117,7 @@ HELP
117
117
  end
118
118
 
119
119
  Puppet::SSL::Oids.register_puppet_oids
120
+ Puppet::SSL::Oids.load_custom_oid_file(Puppet[:trusted_oid_mapping_file])
120
121
 
121
122
  certname = Puppet[:certname]
122
123
  action = command_line.args.first
@@ -478,6 +478,7 @@ module Puppet
478
478
  },
479
479
  :maximum_uid => {
480
480
  :default => 4294967290,
481
+ :type => :integer,
481
482
  :desc => "The maximum allowed UID. Some platforms use negative UIDs
482
483
  but then ship with tools that do not know how to handle signed ints,
483
484
  so the UIDs show up as huge numbers that can then not be fed back into
@@ -615,6 +616,7 @@ module Puppet
615
616
  },
616
617
  :http_proxy_port => {
617
618
  :default => 3128,
619
+ :type => :port,
618
620
  :desc => "The HTTP proxy port to use for outgoing connections",
619
621
  },
620
622
  :http_proxy_user => {
@@ -1197,6 +1199,7 @@ EOT
1197
1199
  },
1198
1200
  :keylength => {
1199
1201
  :default => 4096,
1202
+ :type => :integer,
1200
1203
  :desc => "The bit length of keys.",
1201
1204
  },
1202
1205
  :cert_inventory => {
@@ -2023,6 +2026,7 @@ EOT
2023
2026
  },
2024
2027
  :ldapport => {
2025
2028
  :default => 389,
2029
+ :type => :port,
2026
2030
  :desc => "The LDAP port.",
2027
2031
  },
2028
2032
 
@@ -2106,6 +2110,7 @@ EOT
2106
2110
  settings.define_settings(:parser,
2107
2111
  :max_errors => {
2108
2112
  :default => 10,
2113
+ :type => :integer,
2109
2114
  :desc => <<-'EOT'
2110
2115
  Sets the max number of logged/displayed parser validation errors in case
2111
2116
  multiple errors have been detected. A value of 0 is the same as a value of 1; a
@@ -2114,6 +2119,7 @@ EOT
2114
2119
  },
2115
2120
  :max_warnings => {
2116
2121
  :default => 10,
2122
+ :type => :integer,
2117
2123
  :desc => <<-'EOT'
2118
2124
  Sets the max number of logged/displayed parser validation warnings in
2119
2125
  case multiple warnings have been detected. A value of 0 blocks logging of
@@ -2122,6 +2128,7 @@ EOT
2122
2128
  },
2123
2129
  :max_deprecations => {
2124
2130
  :default => 10,
2131
+ :type => :integer,
2125
2132
  :desc => <<-'EOT'
2126
2133
  Sets the max number of logged/displayed parser validation deprecation
2127
2134
  warnings in case multiple deprecation warnings have been detected. A value of 0
@@ -356,6 +356,16 @@ module Puppet::Environments
356
356
  # Evict all that have expired, in the same way as `get`
357
357
  clear_all_expired
358
358
 
359
+ # Evict all that was removed from diks
360
+ cached_envs = @cache.keys.map!(&:to_sym)
361
+ loader_envs = @loader.list.map!(&:name)
362
+ removed_envs = cached_envs - loader_envs
363
+
364
+ removed_envs.each do |env_name|
365
+ Puppet.debug { "Environment no longer exists '#{env_name}'"}
366
+ clear(env_name)
367
+ end
368
+
359
369
  @loader.list.map do |env|
360
370
  name = env.name
361
371
  old_entry = @cache[name]
@@ -54,6 +54,7 @@ undocumented option
54
54
  end
55
55
  unless action.options.empty?
56
56
  action.options.sort.each do |name|
57
+ next if name == :extra
57
58
  option = action.get_option name -%>
58
59
  <%= " " + option.optparse.join(" | ")[0,(optionroom - 1)].ljust(optionroom) + ' - ' -%>
59
60
  <% if !(option.summary) -%>
@@ -49,6 +49,7 @@ undocumented option
49
49
  end
50
50
  unless face.options.empty?
51
51
  face.options.sort.each do |name|
52
+ next if name == :extra
52
53
  option = face.get_option name -%>
53
54
  <%= " " + option.optparse.join(" | ")[0,(optionroom - 1)].ljust(optionroom) + ' - ' -%>
54
55
  <% if !(option.summary) -%>
@@ -52,7 +52,7 @@ Puppet::Face.define(:node, '0.0.1') do
52
52
  end
53
53
 
54
54
  def warn(message)
55
- Puppet.warning(message)
55
+ Puppet.warning(message) unless message =~ /cadir is currently configured to be inside/
56
56
  end
57
57
 
58
58
  def err(message)
@@ -84,7 +84,7 @@ class Puppet::FileSystem::FileImpl
84
84
  end
85
85
 
86
86
  def read_preserve_line_endings(path)
87
- read(path)
87
+ read(path, encoding: "bom|#{Encoding.default_external.name}")
88
88
  end
89
89
 
90
90
  def binread(path)
@@ -109,8 +109,8 @@ class Puppet::FileSystem::Windows < Puppet::FileSystem::Posix
109
109
  end
110
110
 
111
111
  def read_preserve_line_endings(path)
112
- contents = path.read( :mode => 'rb', :encoding => Encoding::UTF_8)
113
- contents = path.read( :mode => 'rb', :encoding => Encoding::default_external) unless contents.valid_encoding?
112
+ contents = path.read( :mode => 'rb', :encoding => 'bom|utf-8')
113
+ contents = path.read( :mode => 'rb', :encoding => "bom|#{Encoding::default_external.name}") unless contents.valid_encoding?
114
114
  contents = path.read unless contents.valid_encoding?
115
115
 
116
116
  contents
data/lib/puppet/forge.rb CHANGED
@@ -70,7 +70,7 @@ class Puppet::Forge < SemanticPuppet::Dependency::Source
70
70
  uri = decode_uri(result['pagination']['next'])
71
71
  matches.concat result['results']
72
72
  else
73
- raise ResponseError.new(:uri => URI.parse(@host).merge(uri), :response => response)
73
+ raise ResponseError.new(:uri => response.url, :response => response)
74
74
  end
75
75
  end
76
76
 
@@ -105,7 +105,7 @@ class Puppet::Forge < SemanticPuppet::Dependency::Source
105
105
  if response.code == 200
106
106
  response = Puppet::Util::Json.load(response.body)
107
107
  else
108
- raise ResponseError.new(:uri => URI.parse(@host).merge(uri), :response => response)
108
+ raise ResponseError.new(:uri => response.url, :response => response)
109
109
  end
110
110
 
111
111
  releases.concat(process(response['results']))
@@ -208,7 +208,7 @@ class Puppet::Forge < SemanticPuppet::Dependency::Source
208
208
  response = @source.make_http_request(uri, destination)
209
209
  destination.flush and destination.close
210
210
  unless response.code == 200
211
- raise Puppet::Forge::Errors::ResponseError.new(:uri => uri, :response => response)
211
+ raise Puppet::Forge::Errors::ResponseError.new(:uri => response.url, :response => response)
212
212
  end
213
213
  end
214
214
 
@@ -47,7 +47,7 @@ class Puppet::Forge
47
47
 
48
48
  # Return the base Pathname for all the caches.
49
49
  def self.base_path
50
- (Pathname(Puppet.settings[:module_working_dir]) + 'cache').tap do |o|
50
+ (Pathname(Puppet.settings[:module_working_dir]) + 'cache').cleanpath.tap do |o|
51
51
  o.mkpath unless o.exist?
52
52
  end
53
53
  end
@@ -26,6 +26,10 @@ Puppet::Functions.create_function(:empty) do
26
26
  param 'Collection', :coll
27
27
  end
28
28
 
29
+ dispatch :sensitive_string_empty do
30
+ param 'Sensitive[String]', :str
31
+ end
32
+
29
33
  dispatch :string_empty do
30
34
  param 'String', :str
31
35
  end
@@ -46,6 +50,10 @@ Puppet::Functions.create_function(:empty) do
46
50
  coll.empty?
47
51
  end
48
52
 
53
+ def sensitive_string_empty(str)
54
+ str.unwrap.empty?
55
+ end
56
+
49
57
  def string_empty(str)
50
58
  str.empty?
51
59
  end
@@ -105,6 +105,7 @@
105
105
  # **Seconds since the Epoch:**
106
106
  #
107
107
  # | Format | Meaning |
108
+ # | ------ | ------- |
108
109
  # | s | Number of seconds since 1970-01-01 00:00:00 UTC. |
109
110
  #
110
111
  # **Literal string:**
@@ -1,4 +1,5 @@
1
1
  # Unwraps a Sensitive value and returns the wrapped object.
2
+ # Returns the Value itself, if it is not Sensitive.
2
3
  #
3
4
  # @example Usage of unwrap
4
5
  #
@@ -28,12 +29,17 @@
28
29
  # @since 4.0.0
29
30
  #
30
31
  Puppet::Functions.create_function(:unwrap) do
31
- dispatch :unwrap do
32
+ dispatch :from_sensitive do
32
33
  param 'Sensitive', :arg
33
34
  optional_block_param
34
35
  end
35
36
 
36
- def unwrap(arg)
37
+ dispatch :from_any do
38
+ param 'Any', :arg
39
+ optional_block_param
40
+ end
41
+
42
+ def from_sensitive(arg)
37
43
  unwrapped = arg.unwrap
38
44
  if block_given?
39
45
  yield(unwrapped)
@@ -41,4 +47,13 @@ Puppet::Functions.create_function(:unwrap) do
41
47
  unwrapped
42
48
  end
43
49
  end
50
+
51
+ def from_any(arg)
52
+ unwrapped = arg
53
+ if block_given?
54
+ yield(unwrapped)
55
+ else
56
+ unwrapped
57
+ end
58
+ end
44
59
  end