puppet 6.12.0-x86-mingw32 → 6.13.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 (144) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +12 -12
  3. data/README.md +1 -1
  4. data/ext/project_data.yaml +1 -1
  5. data/lib/puppet.rb +22 -7
  6. data/lib/puppet/application/resource.rb +1 -1
  7. data/lib/puppet/configurer.rb +8 -13
  8. data/lib/puppet/defaults.rb +83 -49
  9. data/lib/puppet/environments.rb +26 -18
  10. data/lib/puppet/face/facts.rb +8 -5
  11. data/lib/puppet/file_system/memory_file.rb +6 -0
  12. data/lib/puppet/file_system/memory_impl.rb +13 -0
  13. data/lib/puppet/file_system/windows.rb +7 -10
  14. data/lib/puppet/http.rb +2 -0
  15. data/lib/puppet/http/client.rb +30 -0
  16. data/lib/puppet/http/errors.rb +2 -0
  17. data/lib/puppet/http/service.rb +61 -2
  18. data/lib/puppet/http/service/compiler.rb +86 -0
  19. data/lib/puppet/http/service/file_server.rb +85 -0
  20. data/lib/puppet/http/service/report.rb +4 -8
  21. data/lib/puppet/http/session.rb +8 -1
  22. data/lib/puppet/indirector/catalog/compiler.rb +10 -0
  23. data/lib/puppet/indirector/file_bucket_file/file.rb +1 -1
  24. data/lib/puppet/indirector/json.rb +1 -1
  25. data/lib/puppet/indirector/msgpack.rb +1 -1
  26. data/lib/puppet/network/http/connection.rb +4 -0
  27. data/lib/puppet/network/http/nocache_pool.rb +1 -0
  28. data/lib/puppet/network/http/pool.rb +5 -1
  29. data/lib/puppet/parser/ast/pops_bridge.rb +6 -11
  30. data/lib/puppet/pops/evaluator/access_operator.rb +2 -2
  31. data/lib/puppet/pops/evaluator/evaluator_impl.rb +1 -1
  32. data/lib/puppet/pops/loader/puppet_plan_instantiator.rb +12 -3
  33. data/lib/puppet/pops/parser/evaluating_parser.rb +5 -7
  34. data/lib/puppet/pops/types/p_object_type_extension.rb +10 -0
  35. data/lib/puppet/pops/types/type_calculator.rb +24 -0
  36. data/lib/puppet/pops/validation/checker4_0.rb +1 -1
  37. data/lib/puppet/pops/validation/tasks_checker.rb +5 -1
  38. data/lib/puppet/provider/aix_object.rb +4 -2
  39. data/lib/puppet/provider/group/aix.rb +1 -0
  40. data/lib/puppet/provider/group/groupadd.rb +52 -24
  41. data/lib/puppet/provider/package/apt.rb +14 -3
  42. data/lib/puppet/provider/package/dnfmodule.rb +9 -2
  43. data/lib/puppet/provider/package/dpkg.rb +14 -7
  44. data/lib/puppet/provider/package/fink.rb +20 -3
  45. data/lib/puppet/provider/package/openbsd.rb +13 -1
  46. data/lib/puppet/provider/package/pkg.rb +18 -5
  47. data/lib/puppet/provider/package/yum.rb +9 -5
  48. data/lib/puppet/provider/user/aix.rb +1 -0
  49. data/lib/puppet/provider/user/directoryservice.rb +30 -5
  50. data/lib/puppet/provider/user/useradd.rb +6 -7
  51. data/lib/puppet/reports/store.rb +1 -1
  52. data/lib/puppet/settings.rb +2 -0
  53. data/lib/puppet/ssl/certificate.rb +2 -1
  54. data/lib/puppet/test/test_helper.rb +4 -0
  55. data/lib/puppet/transaction/resource_harness.rb +1 -1
  56. data/lib/puppet/type/group.rb +2 -2
  57. data/lib/puppet/type/package.rb +63 -9
  58. data/lib/puppet/type/user.rb +2 -2
  59. data/lib/puppet/util/log/destinations.rb +1 -1
  60. data/lib/puppet/util/pidlock.rb +26 -6
  61. data/lib/puppet/util/plist.rb +6 -0
  62. data/lib/puppet/util/storage.rb +0 -1
  63. data/lib/puppet/util/yaml.rb +1 -1
  64. data/lib/puppet/version.rb +1 -1
  65. data/locales/puppet.pot +127 -115
  66. data/man/man5/puppet.conf.5 +21 -7
  67. data/man/man8/puppet-agent.8 +1 -1
  68. data/man/man8/puppet-apply.8 +1 -1
  69. data/man/man8/puppet-catalog.8 +1 -1
  70. data/man/man8/puppet-config.8 +1 -1
  71. data/man/man8/puppet-describe.8 +1 -1
  72. data/man/man8/puppet-device.8 +1 -1
  73. data/man/man8/puppet-doc.8 +1 -1
  74. data/man/man8/puppet-epp.8 +1 -1
  75. data/man/man8/puppet-facts.8 +1 -1
  76. data/man/man8/puppet-filebucket.8 +1 -1
  77. data/man/man8/puppet-generate.8 +1 -1
  78. data/man/man8/puppet-help.8 +1 -1
  79. data/man/man8/puppet-key.8 +1 -1
  80. data/man/man8/puppet-lookup.8 +1 -1
  81. data/man/man8/puppet-man.8 +1 -1
  82. data/man/man8/puppet-module.8 +1 -1
  83. data/man/man8/puppet-node.8 +1 -1
  84. data/man/man8/puppet-parser.8 +1 -1
  85. data/man/man8/puppet-plugin.8 +1 -1
  86. data/man/man8/puppet-report.8 +1 -1
  87. data/man/man8/puppet-resource.8 +1 -1
  88. data/man/man8/puppet-script.8 +1 -1
  89. data/man/man8/puppet-ssl.8 +1 -1
  90. data/man/man8/puppet-status.8 +1 -1
  91. data/man/man8/puppet.8 +2 -2
  92. data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_md5/should_fetch_if_not_on_the_local_disk.yml +0 -35
  93. data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_md5/should_not_update_if_content_on_disk_is_up-to-date.yml +0 -37
  94. data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_md5/should_update_if_content_differs_on_disk.yml +0 -37
  95. data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_mtime/should_fetch_if_mtime_is_older_on_disk.yml +0 -35
  96. data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_mtime/should_fetch_if_no_header_specified.yml +0 -33
  97. data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_mtime/should_fetch_if_not_on_the_local_disk.yml +0 -35
  98. data/spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_mtime/should_not_update_if_mtime_is_newer_on_disk.yml +0 -35
  99. data/spec/integration/configurer_spec.rb +26 -7
  100. data/spec/integration/indirector/facts/facter_spec.rb +4 -0
  101. data/spec/unit/application/apply_spec.rb +2 -12
  102. data/spec/unit/application/resource_spec.rb +2 -2
  103. data/spec/unit/configurer/fact_handler_spec.rb +0 -4
  104. data/spec/unit/configurer_spec.rb +0 -3
  105. data/spec/unit/defaults_spec.rb +1 -1
  106. data/spec/unit/environments_spec.rb +57 -28
  107. data/spec/unit/face/facts_spec.rb +24 -20
  108. data/spec/unit/file_system_spec.rb +16 -2
  109. data/spec/unit/http/client_spec.rb +6 -0
  110. data/spec/unit/http/service/compiler_spec.rb +322 -0
  111. data/spec/unit/http/service/file_server_spec.rb +219 -0
  112. data/spec/unit/http/service/report_spec.rb +8 -1
  113. data/spec/unit/http/service_spec.rb +4 -0
  114. data/spec/unit/http/session_spec.rb +31 -0
  115. data/spec/unit/indirector/catalog/compiler_spec.rb +46 -29
  116. data/spec/unit/network/http/connection_spec.rb +23 -1
  117. data/spec/unit/network/http/nocache_pool_spec.rb +3 -3
  118. data/spec/unit/network/http/pool_spec.rb +32 -0
  119. data/spec/unit/node/facts_spec.rb +2 -1
  120. data/spec/unit/node_spec.rb +7 -4
  121. data/spec/unit/pops/serialization/to_from_hr_spec.rb +6 -1
  122. data/spec/unit/pops/validator/validator_spec.rb +7 -2
  123. data/spec/unit/provider/aix_object_spec.rb +16 -2
  124. data/spec/unit/provider/group/groupadd_spec.rb +167 -56
  125. data/spec/unit/provider/package/apt_spec.rb +13 -2
  126. data/spec/unit/provider/package/aptitude_spec.rb +1 -0
  127. data/spec/unit/provider/package/dnfmodule_spec.rb +22 -0
  128. data/spec/unit/provider/package/dpkg_spec.rb +28 -6
  129. data/spec/unit/provider/package/openbsd_spec.rb +17 -0
  130. data/spec/unit/provider/package/pkg_spec.rb +15 -1
  131. data/spec/unit/provider/package/yum_spec.rb +50 -0
  132. data/spec/unit/provider/user/directoryservice_spec.rb +41 -0
  133. data/spec/unit/provider/user/useradd_spec.rb +13 -8
  134. data/spec/unit/puppet_pal_2pec.rb +3 -0
  135. data/spec/unit/puppet_pal_catalog_spec.rb +3 -0
  136. data/spec/unit/puppet_spec.rb +14 -0
  137. data/spec/unit/ssl/certificate_spec.rb +7 -0
  138. data/spec/unit/transaction/persistence_spec.rb +1 -10
  139. data/spec/unit/type/package_spec.rb +8 -0
  140. data/spec/unit/type/user_spec.rb +0 -1
  141. data/spec/unit/util/pidlock_spec.rb +38 -16
  142. data/spec/unit/util/plist_spec.rb +20 -0
  143. data/spec/unit/util/storage_spec.rb +1 -8
  144. metadata +10 -4
@@ -132,41 +132,6 @@ http_interactions:
132
132
  string: ''
133
133
  http_version:
134
134
  recorded_at: Sun, 22 Mar 2015 22:57:44 GMT
135
- - request:
136
- method: head
137
- uri: http://my-server/file/
138
- body:
139
- encoding: US-ASCII
140
- string: ''
141
- headers:
142
- Accept:
143
- - ! '*/*'
144
- User-Agent:
145
- - Ruby
146
- response:
147
- status:
148
- code: 200
149
- message: ! 'OK '
150
- headers:
151
- Etag:
152
- - 62e0b-184a-550f415e
153
- Content-Type:
154
- - text/html
155
- Content-Length:
156
- - '6218'
157
- Last-Modified:
158
- - Sun, 22 Mar 2015 22:25:34 GMT
159
- Server:
160
- - WEBrick/1.3.1 (Ruby/1.9.3/2013-11-22)
161
- Date:
162
- - Sun, 22 Mar 2015 22:57:44 GMT
163
- Connection:
164
- - Keep-Alive
165
- body:
166
- encoding: US-ASCII
167
- string: ''
168
- http_version:
169
- recorded_at: Sun, 22 Mar 2015 22:57:44 GMT
170
135
  - request:
171
136
  method: get
172
137
  uri: http://my-server/file/
@@ -128,39 +128,6 @@ http_interactions:
128
128
  string: ''
129
129
  http_version:
130
130
  recorded_at: Sun, 22 Mar 2015 22:57:44 GMT
131
- - request:
132
- method: head
133
- uri: http://my-server/file/
134
- body:
135
- encoding: US-ASCII
136
- string: ''
137
- headers:
138
- Accept:
139
- - ! '*/*'
140
- User-Agent:
141
- - Ruby
142
- response:
143
- status:
144
- code: 200
145
- message: ! 'OK '
146
- headers:
147
- Etag:
148
- - 62e0b-184a-550f415e
149
- Content-Type:
150
- - text/html
151
- Content-Length:
152
- - '6218'
153
- Server:
154
- - WEBrick/1.3.1 (Ruby/1.9.3/2013-11-22)
155
- Date:
156
- - Sun, 22 Mar 2015 22:57:44 GMT
157
- Connection:
158
- - Keep-Alive
159
- body:
160
- encoding: US-ASCII
161
- string: ''
162
- http_version:
163
- recorded_at: Sun, 22 Mar 2015 22:57:44 GMT
164
131
  - request:
165
132
  method: get
166
133
  uri: http://my-server/file/
@@ -132,41 +132,6 @@ http_interactions:
132
132
  string: ''
133
133
  http_version:
134
134
  recorded_at: Sun, 22 Mar 2015 22:57:44 GMT
135
- - request:
136
- method: head
137
- uri: http://my-server/file/
138
- body:
139
- encoding: US-ASCII
140
- string: ''
141
- headers:
142
- Accept:
143
- - ! '*/*'
144
- User-Agent:
145
- - Ruby
146
- response:
147
- status:
148
- code: 200
149
- message: ! 'OK '
150
- headers:
151
- Etag:
152
- - 62e0b-184a-550f415e
153
- Content-Type:
154
- - text/html
155
- Content-Length:
156
- - '6218'
157
- Last-Modified:
158
- - Sun, 22 Mar 2015 22:25:34 GMT
159
- Server:
160
- - WEBrick/1.3.1 (Ruby/1.9.3/2013-11-22)
161
- Date:
162
- - Sun, 22 Mar 2015 22:57:44 GMT
163
- Connection:
164
- - Keep-Alive
165
- body:
166
- encoding: US-ASCII
167
- string: ''
168
- http_version:
169
- recorded_at: Sun, 22 Mar 2015 22:57:44 GMT
170
135
  - request:
171
136
  method: get
172
137
  uri: http://my-server/file/
@@ -132,41 +132,6 @@ http_interactions:
132
132
  string: ''
133
133
  http_version:
134
134
  recorded_at: Sun, 22 Mar 2015 22:57:44 GMT
135
- - request:
136
- method: head
137
- uri: http://my-server/file/
138
- body:
139
- encoding: US-ASCII
140
- string: ''
141
- headers:
142
- Accept:
143
- - ! '*/*'
144
- User-Agent:
145
- - Ruby
146
- response:
147
- status:
148
- code: 200
149
- message: ! 'OK '
150
- headers:
151
- Etag:
152
- - 62e0b-184a-550f415e
153
- Content-Type:
154
- - text/html
155
- Content-Length:
156
- - '6218'
157
- Last-Modified:
158
- - Sun, 22 Mar 2015 22:25:34 GMT
159
- Server:
160
- - WEBrick/1.3.1 (Ruby/1.9.3/2013-11-22)
161
- Date:
162
- - Sun, 22 Mar 2015 22:57:44 GMT
163
- Connection:
164
- - Keep-Alive
165
- body:
166
- encoding: US-ASCII
167
- string: ''
168
- http_version:
169
- recorded_at: Sun, 22 Mar 2015 22:57:44 GMT
170
135
  - request:
171
136
  method: get
172
137
  uri: http://my-server/file/
@@ -70,18 +70,26 @@ describe Puppet::Configurer do
70
70
  end
71
71
 
72
72
  context 'when resubmit_facts is set to true' do
73
- let(:test_facts) { Puppet::Node::Facts.new('configurer.test') }
74
- let(:fact_rest_terminus) { Puppet::Node::Facts.indirection.terminus(:rest) }
73
+ let(:test_facts) { Puppet::Node::Facts.new('configurer.test', {test_fact: 'test value'}) }
75
74
 
76
75
  before(:each) do
77
76
  Puppet[:resubmit_facts] = true
78
77
 
79
78
  allow(@configurer).to receive(:find_facts).and_return(test_facts)
80
- allow(fact_rest_terminus).to receive(:save)
81
79
  end
82
80
 
83
- it 'sends fact data using the rest terminus' do
84
- expect(fact_rest_terminus).to receive(:save)
81
+ it 'uploads facts as application/json' do
82
+ stub_request(:put, "https://puppet:8140/puppet/v3/facts/configurer.test?environment=production").
83
+ with(
84
+ body: hash_including(
85
+ {
86
+ "name" => "configurer.test",
87
+ "values" => {"test_fact" => 'test value',},
88
+ }),
89
+ headers: {
90
+ 'Accept'=>'application/json, application/x-msgpack, text/pson',
91
+ 'Content-Type'=>'application/json',
92
+ })
85
93
 
86
94
  @configurer.run(catalog: @catalog)
87
95
  end
@@ -95,8 +103,8 @@ describe Puppet::Configurer do
95
103
  end
96
104
 
97
105
  it 'logs errors that occur during fact submission' do
98
- allow(fact_rest_terminus).to receive(:save).and_raise('error sending facts')
99
- expect(Puppet).to receive(:log_exception).with(instance_of(RuntimeError),
106
+ stub_request(:put, "https://puppet:8140/puppet/v3/facts/configurer.test?environment=production").to_return(status: 502)
107
+ expect(Puppet).to receive(:log_exception).with(Puppet::HTTP::ResponseError,
100
108
  /^Failed to submit facts/)
101
109
 
102
110
  @configurer.run(catalog: @catalog)
@@ -105,6 +113,17 @@ describe Puppet::Configurer do
105
113
  it 'records time spent resubmitting facts' do
106
114
  report = Puppet::Transaction::Report.new
107
115
 
116
+ stub_request(:put, "https://puppet:8140/puppet/v3/facts/configurer.test?environment=production").
117
+ with(
118
+ body: hash_including({
119
+ "name" => "configurer.test",
120
+ "values" => {"test_fact": "test value"},
121
+ }),
122
+ headers: {
123
+ 'Accept'=>'application/json, application/x-msgpack, text/pson',
124
+ 'Content-Type'=>'application/json',
125
+ }).to_return(status: 200)
126
+
108
127
  @configurer.run(catalog: @catalog, report: report)
109
128
 
110
129
  expect(report.metrics['time'].values).to include(["resubmit_facts", anything, Numeric])
@@ -7,6 +7,10 @@ describe Puppet::Node::Facts::Facter do
7
7
  include PuppetSpec::Files
8
8
  include PuppetSpec::Compiler
9
9
 
10
+ before :each do
11
+ Puppet::Node::Facts.indirection.terminus_class = :facter
12
+ end
13
+
10
14
  it "preserves case in fact values" do
11
15
  Facter.add(:downcase_test) do
12
16
  setcode do
@@ -14,14 +14,6 @@ describe Puppet::Application::Apply do
14
14
  Puppet[:reports] = "none"
15
15
  end
16
16
 
17
- after :each do
18
- Puppet::Node::Facts.indirection.reset_terminus_class
19
- Puppet::Node::Facts.indirection.cache_class = nil
20
-
21
- Puppet::Node.indirection.reset_terminus_class
22
- Puppet::Node.indirection.cache_class = nil
23
- end
24
-
25
17
  [:debug,:loadclasses,:test,:verbose,:use_nodes,:detailed_exitcodes,:catalog, :write_catalog_summary].each do |option|
26
18
  it "should declare handle_#{option} method" do
27
19
  expect(@apply).to respond_to("handle_#{option}".to_sym)
@@ -182,13 +174,11 @@ describe Puppet::Application::Apply do
182
174
  Puppet[:prerun_command] = ''
183
175
  Puppet[:postrun_command] = ''
184
176
 
185
- Puppet::Node::Facts.indirection.terminus_class = :memory
186
- Puppet::Node::Facts.indirection.cache_class = :memory
187
177
  Puppet::Node.indirection.terminus_class = :memory
188
178
  Puppet::Node.indirection.cache_class = :memory
189
179
 
190
- @facts = Puppet::Node::Facts.new(Puppet[:node_name_value])
191
- Puppet::Node::Facts.indirection.save(@facts)
180
+ facts = Puppet::Node::Facts.new(Puppet[:node_name_value])
181
+ Puppet::Node::Facts.indirection.save(facts)
192
182
 
193
183
  @node = Puppet::Node.new(Puppet[:node_name_value])
194
184
  Puppet::Node.indirection.save(@node)
@@ -12,9 +12,9 @@ describe Puppet::Application::Resource do
12
12
  end
13
13
 
14
14
  describe "in preinit" do
15
- it "should init extra_params to empty array" do
15
+ it "should include provider parameter by default" do
16
16
  @resource_app.preinit
17
- expect(@resource_app.extra_params).to eq([])
17
+ expect(@resource_app.extra_params).to eq([:provider])
18
18
  end
19
19
  end
20
20
 
@@ -22,10 +22,6 @@ describe Puppet::Configurer::FactHandler do
22
22
 
23
23
  let(:facthandler) { FactHandlerTester.new('production') }
24
24
 
25
- before :each do
26
- Puppet::Node::Facts.indirection.terminus_class = :memory
27
- end
28
-
29
25
  describe "when finding facts" do
30
26
  it "should use the node name value to retrieve the facts" do
31
27
  foo_facts = Puppet::Node::Facts.new('foo')
@@ -4,9 +4,6 @@ require 'webmock/rspec'
4
4
 
5
5
  describe Puppet::Configurer do
6
6
  before do
7
- Puppet::Node::Facts.indirection.terminus_class = :memory
8
- Puppet::Node::Facts.indirection.save(facts)
9
-
10
7
  Puppet[:server] = "puppetmaster"
11
8
  Puppet[:report] = true
12
9
 
@@ -182,7 +182,7 @@ describe "Defaults" do
182
182
  end
183
183
  end
184
184
 
185
- describe "facterng", :if => Puppet::Util::Platform.windows? do
185
+ describe "facterng" do
186
186
  it "defaults to false" do
187
187
  expect(Puppet[:facterng]).to be_falsey
188
188
  end
@@ -13,20 +13,28 @@ describe Puppet::Environments do
13
13
  before(:each) do
14
14
  Puppet.settings.initialize_global_settings
15
15
  Puppet[:environment_timeout] = "unlimited"
16
+ Puppet[:versioned_environment_dirs] = true
16
17
  end
17
18
 
18
19
  let(:directory_tree) do
19
- FS::MemoryFile.a_directory(File.expand_path("envdir"), [
20
- FS::MemoryFile.a_regular_file_containing("ignored_file", ''),
21
- FS::MemoryFile.a_directory("an_environment", [
22
- FS::MemoryFile.a_missing_file("environment.conf"),
20
+ FS::MemoryFile.a_directory(File.expand_path("top_level_dir"), [
21
+ FS::MemoryFile.a_directory("envdir", [
22
+ FS::MemoryFile.a_regular_file_containing("ignored_file", ''),
23
+ FS::MemoryFile.a_directory("an_environment", [
24
+ FS::MemoryFile.a_missing_file("environment.conf"),
25
+ FS::MemoryFile.a_directory("modules"),
26
+ FS::MemoryFile.a_directory("manifests"),
27
+ ]),
28
+ FS::MemoryFile.a_directory("another_environment", [
29
+ FS::MemoryFile.a_missing_file("environment.conf"),
30
+ ]),
31
+ FS::MemoryFile.a_missing_file("doesnotexist"),
32
+ FS::MemoryFile.a_symlink("symlinked_environment", File.expand_path(File.join("top_level_dir", "versioned_env")))]),
33
+ FS::MemoryFile.a_directory("versioned_env", [
34
+ FS::MemoryFile.a_regular_file_containing("environment.conf", ''),
23
35
  FS::MemoryFile.a_directory("modules"),
24
36
  FS::MemoryFile.a_directory("manifests"),
25
37
  ]),
26
- FS::MemoryFile.a_directory("another_environment", [
27
- FS::MemoryFile.a_missing_file("environment.conf"),
28
- ]),
29
- FS::MemoryFile.a_missing_file("doesnotexist"),
30
38
  ])
31
39
  end
32
40
 
@@ -38,22 +46,27 @@ describe Puppet::Environments do
38
46
  global_path_2 = FS::MemoryFile.a_directory(global_path_2_location)
39
47
 
40
48
  loader_from(:filesystem => [directory_tree, global_path_1, global_path_2],
41
- :directory => directory_tree,
49
+ :directory => directory_tree.children.first,
42
50
  :modulepath => [global_path_1_location, global_path_2_location]) do |loader|
43
51
  expect(loader.list).to include_in_any_order(
44
52
  environment(:an_environment).
45
- with_manifest("#{FS.path_string(directory_tree)}/an_environment/manifests").
46
- with_modulepath(["#{FS.path_string(directory_tree)}/an_environment/modules",
53
+ with_manifest("#{FS.path_string(directory_tree)}/envdir/an_environment/manifests").
54
+ with_modulepath(["#{FS.path_string(directory_tree)}/envdir/an_environment/modules",
47
55
  global_path_1_location,
48
56
  global_path_2_location]),
49
- environment(:another_environment))
57
+ environment(:another_environment),
58
+ environment(:symlinked_environment).
59
+ with_manifest("#{FS.path_string(directory_tree)}/versioned_env/manifests").
60
+ with_modulepath(["#{FS.path_string(directory_tree)}/versioned_env/modules",
61
+ global_path_1_location,
62
+ global_path_2_location]))
50
63
  end
51
64
  end
52
65
 
53
66
  it "has search_paths" do
54
67
  loader_from(:filesystem => [directory_tree],
55
- :directory => directory_tree) do |loader|
56
- expect(loader.search_paths).to eq(["file://#{directory_tree}"])
68
+ :directory => directory_tree.children.first) do |loader|
69
+ expect(loader.search_paths).to eq(["file://#{directory_tree.children.first}"])
57
70
  end
58
71
  end
59
72
 
@@ -79,14 +92,29 @@ describe Puppet::Environments do
79
92
 
80
93
  it "gets a particular environment" do
81
94
  loader_from(:filesystem => [directory_tree],
82
- :directory => directory_tree) do |loader|
95
+ :directory => directory_tree.children.first) do |loader|
83
96
  expect(loader.get("an_environment")).to environment(:an_environment)
84
97
  end
85
98
  end
86
99
 
100
+ it "gets a symlinked environment" do
101
+ loader_from(:filesystem => [directory_tree],
102
+ :directory => directory_tree.children.first) do |loader|
103
+ expect(loader.get("symlinked_environment")).to environment(:symlinked_environment)
104
+ end
105
+ end
106
+
107
+ it "ignores symlinked environments when `:versioned_environment_dirs` is false" do
108
+ Puppet[:versioned_environment_dirs] = false
109
+ loader_from(:filesystem => [directory_tree],
110
+ :directory => directory_tree.children.first) do |loader|
111
+ expect(loader.get("symlinked_environment")).to be_nil
112
+ end
113
+ end
114
+
87
115
  it "raises error when environment not found" do
88
116
  loader_from(:filesystem => [directory_tree],
89
- :directory => directory_tree) do |loader|
117
+ :directory => directory_tree.children.first) do |loader|
90
118
  expect do
91
119
  loader.get!("doesnotexist")
92
120
  end.to raise_error(Puppet::Environments::EnvironmentNotFound)
@@ -95,7 +123,7 @@ describe Puppet::Environments do
95
123
 
96
124
  it "returns nil if an environment can't be found" do
97
125
  loader_from(:filesystem => [directory_tree],
98
- :directory => directory_tree) do |loader|
126
+ :directory => directory_tree.children.first) do |loader|
99
127
  expect(loader.get("doesnotexist")).to be_nil
100
128
  end
101
129
  end
@@ -404,7 +432,7 @@ config_version=$vardir/random/scripts
404
432
  context "custom cache expiration service" do
405
433
  it "consults the custom service to expire the cache" do
406
434
  loader_from(:filesystem => [directory_tree],
407
- :directory => directory_tree) do |loader|
435
+ :directory => directory_tree.children.first) do |loader|
408
436
  service = ReplayExpirationService.new([true])
409
437
  using_expiration_service(service) do
410
438
 
@@ -541,22 +569,23 @@ config_version=$vardir/random/scripts
541
569
 
542
570
  describe "cached loaders" do
543
571
  it "lists environments" do
544
- loader_from(:filesystem => [directory_tree], :directory => directory_tree) do |loader|
572
+ loader_from(:filesystem => [directory_tree], :directory => directory_tree.children.first) do |loader|
545
573
  expect(Puppet::Environments::Cached.new(loader).list).to include_in_any_order(
546
574
  environment(:an_environment),
547
- environment(:another_environment))
575
+ environment(:another_environment),
576
+ environment(:symlinked_environment))
548
577
  end
549
578
  end
550
579
 
551
580
  it "has search_paths" do
552
- loader_from(:filesystem => [directory_tree], :directory => directory_tree) do |loader|
553
- expect(Puppet::Environments::Cached.new(loader).search_paths).to eq(["file://#{directory_tree}"])
581
+ loader_from(:filesystem => [directory_tree], :directory => directory_tree.children.first) do |loader|
582
+ expect(Puppet::Environments::Cached.new(loader).search_paths).to eq(["file://#{directory_tree.children.first}"])
554
583
  end
555
584
  end
556
585
 
557
586
  context "#get" do
558
587
  it "gets an environment" do
559
- loader_from(:filesystem => [directory_tree], :directory => directory_tree) do |loader|
588
+ loader_from(:filesystem => [directory_tree], :directory => directory_tree.children.first) do |loader|
560
589
  expect(Puppet::Environments::Cached.new(loader).get(:an_environment)).to environment(:an_environment)
561
590
  end
562
591
  end
@@ -574,7 +603,7 @@ config_version=$vardir/random/scripts
574
603
  end
575
604
 
576
605
  it "returns nil if env not found" do
577
- loader_from(:filesystem => [directory_tree], :directory => directory_tree) do |loader|
606
+ loader_from(:filesystem => [directory_tree], :directory => directory_tree.children.first) do |loader|
578
607
  expect(Puppet::Environments::Cached.new(loader).get(:doesnotexist)).to be_nil
579
608
  end
580
609
  end
@@ -582,7 +611,7 @@ config_version=$vardir/random/scripts
582
611
 
583
612
  context "#get!" do
584
613
  it "gets an environment" do
585
- loader_from(:filesystem => [directory_tree], :directory => directory_tree) do |loader|
614
+ loader_from(:filesystem => [directory_tree], :directory => directory_tree.children.first) do |loader|
586
615
  expect(Puppet::Environments::Cached.new(loader).get!(:an_environment)).to environment(:an_environment)
587
616
  end
588
617
  end
@@ -600,7 +629,7 @@ config_version=$vardir/random/scripts
600
629
  end
601
630
 
602
631
  it "raises error if environment is not found" do
603
- loader_from(:filesystem => [directory_tree], :directory => directory_tree) do |loader|
632
+ loader_from(:filesystem => [directory_tree], :directory => directory_tree.children.first) do |loader|
604
633
  expect do
605
634
  Puppet::Environments::Cached.new(loader).get!(:doesnotexist)
606
635
  end.to raise_error(Puppet::Environments::EnvironmentNotFound)
@@ -609,9 +638,9 @@ config_version=$vardir/random/scripts
609
638
  end
610
639
 
611
640
  it "gets an environment.conf" do
612
- loader_from(:filesystem => [directory_tree], :directory => directory_tree) do |loader|
641
+ loader_from(:filesystem => [directory_tree], :directory => directory_tree.children.first) do |loader|
613
642
  expect(Puppet::Environments::Cached.new(loader).get_conf(:an_environment)).to match_environment_conf(:an_environment).
614
- with_env_path(directory_tree).
643
+ with_env_path(directory_tree.children.first).
615
644
  with_global_module_path([])
616
645
  end
617
646
  end