puppet 7.23.0-x64-mingw32 → 7.24.0-x64-mingw32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
@@ -40,6 +40,47 @@ describe Puppet::Node::Environment do
40
40
  expect(e.inspect).to match(%r{<Puppet::Node::Environment:\w* @name="test" @manifest="#{File.expand_path('/manifests/path')}" @modulepath="#{File.expand_path('/modules/path')}:#{File.expand_path('/other/modules')}" >})
41
41
  end
42
42
 
43
+ describe "externalizing filepaths" do
44
+ before(:each) do
45
+ env.resolved_path = "/opt/puppetlabs/envs/prod_123"
46
+ env.configured_path = "/etc/puppetlabs/envs/prod"
47
+
48
+ @vendored_manifest = "/opt/puppetlabs/vendored/modules/foo/manifests/init.pp"
49
+ @production_manifest = "/opt/puppetlabs/envs/prod_123/modules/foo/manifests/init.pp"
50
+ end
51
+
52
+ it "leaves paths alone if they do not match the resolved path" do
53
+ expect(env.externalize_path(@vendored_manifest)).to eq(@vendored_manifest)
54
+ end
55
+
56
+ it "leaves paths alone if resolved or configured paths are not set" do
57
+ env.resolved_path = nil
58
+ env.configured_path = nil
59
+ expect(env.externalize_path(@production_manifest)).to eq(@production_manifest)
60
+ end
61
+
62
+ it "replaces resolved paths with configured paths" do
63
+ externalized_path = env.externalize_path(@production_manifest)
64
+ expect(externalized_path).to eq("/etc/puppetlabs/envs/prod/modules/foo/manifests/init.pp")
65
+ end
66
+
67
+ it "handles nil" do
68
+ externalized_path = env.externalize_path(nil)
69
+ expect(externalized_path).to eq(nil)
70
+ end
71
+
72
+ it "appropriately handles mismatched trailing slashes" do
73
+ env.resolved_path = "/opt/puppetlabs/envs/prod_123/"
74
+ externalized_path = env.externalize_path(@production_manifest)
75
+ expect(externalized_path).to eq("/etc/puppetlabs/envs/prod/modules/foo/manifests/init.pp")
76
+ end
77
+
78
+ it "can be disabled with the `report_configured_environmentpath` setting" do
79
+ Puppet[:report_configured_environmentpath] = false
80
+ expect(env.externalize_path(@production_manifest)).to eq(@production_manifest)
81
+ end
82
+ end
83
+
43
84
  describe "equality" do
44
85
  it "works as a hash key" do
45
86
  base = Puppet::Node::Environment.create(:first, ["modules"], "manifests")
@@ -108,6 +108,15 @@ describe Puppet::Parser::Resource do
108
108
  }.to raise_error(ArgumentError, /Resources require a hash as last argument/)
109
109
  end
110
110
 
111
+ it "should attempt to externalize filepaths via the environment" do
112
+ environment = Puppet::Node::Environment.create(:testing, [])
113
+ expect(environment).to receive(:externalize_path).at_least(:once).and_return("foo")
114
+ Puppet[:code] = "notify { 'hello': }"
115
+ catalog = Puppet::Parser::Compiler.compile(Puppet::Node.new 'anyone', environment: environment)
116
+ notify = catalog.resource('Notify[hello]')
117
+ expect(notify.file).to eq("foo")
118
+ end
119
+
111
120
  it "should set the reference correctly" do
112
121
  res = Puppet::Parser::Resource.new("resource", "testing", @arguments)
113
122
  expect(res.ref).to eq("Resource[testing]")
@@ -15,7 +15,7 @@ describe Puppet::Type.type(:file).attrclass(:ctime) do
15
15
  @resource[:audit] = [:ctime]
16
16
 
17
17
  # this .to_resource audit behavior is magical :-(
18
- expect(@resource.to_resource[:ctime]).to eq(Puppet::FileSystem.stat(@filename).ctime)
18
+ expect(@resource.to_resource[:ctime]).to eq(Puppet::FileSystem.stat(@filename).ctime.to_s)
19
19
  end
20
20
 
21
21
  it "should return absent if auditing an absent file" do
@@ -15,7 +15,7 @@ describe Puppet::Type.type(:file).attrclass(:mtime) do
15
15
  @resource[:audit] = [:mtime]
16
16
 
17
17
  # this .to_resource audit behavior is magical :-(
18
- expect(@resource.to_resource[:mtime]).to eq(Puppet::FileSystem.stat(@filename).mtime)
18
+ expect(@resource.to_resource[:mtime]).to eq(Puppet::FileSystem.stat(@filename).mtime.to_s)
19
19
  end
20
20
 
21
21
  it "should return absent if auditing an absent file" do
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.23.0
4
+ version: 7.24.0
5
5
  platform: x64-mingw32
6
6
  authors:
7
7
  - Puppet Labs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-07 00:00:00.000000000 Z
11
+ date: 2023-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: facter
@@ -1329,6 +1329,9 @@ files:
1329
1329
  - spec/fixtures/integration/application/agent/lib/facter/agent_spec_role.rb
1330
1330
  - spec/fixtures/integration/application/apply/environments/spec/modules/amod/lib/puppet/provider/applytest/applytest.rb
1331
1331
  - spec/fixtures/integration/application/apply/environments/spec/modules/amod/lib/puppet/type/applytest.rb
1332
+ - spec/fixtures/integration/application/module/environments/direnv/modules/nginx/README
1333
+ - spec/fixtures/integration/application/module/environments/direnv/modules/nginx/manifests/init.pp
1334
+ - spec/fixtures/integration/application/module/environments/direnv/modules/nginx/metadata.json
1332
1335
  - spec/fixtures/integration/l10n/envs/prod/modules/demo/Gemfile
1333
1336
  - spec/fixtures/integration/l10n/envs/prod/modules/demo/Rakefile
1334
1337
  - spec/fixtures/integration/l10n/envs/prod/modules/demo/lib/puppet/functions/l10n.rb
@@ -2589,6 +2592,9 @@ test_files:
2589
2592
  - spec/fixtures/integration/application/agent/lib/facter/agent_spec_role.rb
2590
2593
  - spec/fixtures/integration/application/apply/environments/spec/modules/amod/lib/puppet/provider/applytest/applytest.rb
2591
2594
  - spec/fixtures/integration/application/apply/environments/spec/modules/amod/lib/puppet/type/applytest.rb
2595
+ - spec/fixtures/integration/application/module/environments/direnv/modules/nginx/README
2596
+ - spec/fixtures/integration/application/module/environments/direnv/modules/nginx/manifests/init.pp
2597
+ - spec/fixtures/integration/application/module/environments/direnv/modules/nginx/metadata.json
2592
2598
  - spec/fixtures/integration/l10n/envs/prod/modules/demo/Gemfile
2593
2599
  - spec/fixtures/integration/l10n/envs/prod/modules/demo/Rakefile
2594
2600
  - spec/fixtures/integration/l10n/envs/prod/modules/demo/lib/puppet/functions/l10n.rb