puppet 6.18.0-x86-mingw32 → 6.19.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 +8 -10
  3. data/README.md +1 -2
  4. data/Rakefile +4 -12
  5. data/lib/puppet/agent/locker.rb +0 -7
  6. data/lib/puppet/application/agent.rb +8 -3
  7. data/lib/puppet/application/doc.rb +1 -1
  8. data/lib/puppet/application/lookup.rb +5 -5
  9. data/lib/puppet/configurer.rb +39 -7
  10. data/lib/puppet/defaults.rb +55 -29
  11. data/lib/puppet/environments.rb +51 -10
  12. data/lib/puppet/face/catalog.rb +1 -1
  13. data/lib/puppet/face/config.rb +46 -16
  14. data/lib/puppet/face/node.rb +3 -3
  15. data/lib/puppet/face/node/clean.rb +2 -2
  16. data/lib/puppet/face/status.rb +1 -1
  17. data/lib/puppet/file_bucket/dipper.rb +1 -1
  18. data/lib/puppet/functions/new.rb +8 -3
  19. data/lib/puppet/http.rb +1 -0
  20. data/lib/puppet/http/client.rb +1 -1
  21. data/lib/puppet/http/resolver.rb +5 -8
  22. data/lib/puppet/http/resolver/server_list.rb +18 -36
  23. data/lib/puppet/http/resolver/settings.rb +4 -4
  24. data/lib/puppet/http/resolver/srv.rb +5 -5
  25. data/lib/puppet/http/service.rb +3 -1
  26. data/lib/puppet/http/service/compiler.rb +1 -1
  27. data/lib/puppet/http/service/file_server.rb +1 -1
  28. data/lib/puppet/http/service/puppetserver.rb +39 -0
  29. data/lib/puppet/http/session.rb +5 -4
  30. data/lib/puppet/indirector/catalog/compiler.rb +1 -1
  31. data/lib/puppet/indirector/facts/yaml.rb +1 -1
  32. data/lib/puppet/indirector/json.rb +1 -1
  33. data/lib/puppet/indirector/msgpack.rb +1 -1
  34. data/lib/puppet/indirector/request.rb +4 -4
  35. data/lib/puppet/indirector/yaml.rb +1 -1
  36. data/lib/puppet/network/http/api/master/v3/environments.rb +0 -1
  37. data/lib/puppet/node/facts.rb +17 -0
  38. data/lib/puppet/pops/evaluator/collectors/abstract_collector.rb +1 -3
  39. data/lib/puppet/pops/evaluator/runtime3_converter.rb +2 -2
  40. data/lib/puppet/pops/types/p_meta_type.rb +1 -1
  41. data/lib/puppet/pops/types/p_type_set_type.rb +4 -0
  42. data/lib/puppet/provider/package/dpkg.rb +1 -1
  43. data/lib/puppet/provider/package/pip2.rb +17 -0
  44. data/lib/puppet/provider/package/puppetserver_gem.rb +180 -0
  45. data/lib/puppet/provider/package/yum.rb +1 -0
  46. data/lib/puppet/resource/type.rb +2 -1
  47. data/lib/puppet/rest/route.rb +2 -2
  48. data/lib/puppet/settings.rb +19 -5
  49. data/lib/puppet/transaction/report.rb +11 -7
  50. data/lib/puppet/type/file/source.rb +1 -1
  51. data/lib/puppet/type/filebucket.rb +1 -1
  52. data/lib/puppet/util/connection.rb +8 -8
  53. data/lib/puppet/util/run_mode.rb +5 -1
  54. data/lib/puppet/version.rb +1 -1
  55. data/locales/puppet.pot +153 -156
  56. data/man/man5/puppet.conf.5 +29 -13
  57. data/man/man8/puppet-agent.8 +6 -3
  58. data/man/man8/puppet-apply.8 +1 -1
  59. data/man/man8/puppet-catalog.8 +1 -1
  60. data/man/man8/puppet-config.8 +6 -6
  61. data/man/man8/puppet-describe.8 +1 -1
  62. data/man/man8/puppet-device.8 +1 -1
  63. data/man/man8/puppet-doc.8 +1 -1
  64. data/man/man8/puppet-epp.8 +1 -1
  65. data/man/man8/puppet-facts.8 +1 -1
  66. data/man/man8/puppet-filebucket.8 +1 -1
  67. data/man/man8/puppet-generate.8 +1 -1
  68. data/man/man8/puppet-help.8 +1 -1
  69. data/man/man8/puppet-key.8 +1 -1
  70. data/man/man8/puppet-lookup.8 +1 -1
  71. data/man/man8/puppet-man.8 +1 -1
  72. data/man/man8/puppet-module.8 +1 -1
  73. data/man/man8/puppet-node.8 +4 -4
  74. data/man/man8/puppet-parser.8 +1 -1
  75. data/man/man8/puppet-plugin.8 +1 -1
  76. data/man/man8/puppet-report.8 +1 -1
  77. data/man/man8/puppet-resource.8 +1 -1
  78. data/man/man8/puppet-script.8 +1 -1
  79. data/man/man8/puppet-ssl.8 +1 -1
  80. data/man/man8/puppet-status.8 +2 -2
  81. data/man/man8/puppet.8 +2 -2
  82. data/spec/fixtures/unit/provider/package/puppetserver_gem/gem-list-local-packages +30 -0
  83. data/spec/integration/application/agent_spec.rb +23 -19
  84. data/spec/integration/application/filebucket_spec.rb +7 -7
  85. data/spec/integration/application/plugin_spec.rb +3 -3
  86. data/spec/integration/configurer_spec.rb +14 -0
  87. data/spec/integration/defaults_spec.rb +26 -1
  88. data/spec/integration/util/windows/adsi_spec.rb +2 -2
  89. data/spec/shared_contexts/types_setup.rb +2 -0
  90. data/spec/unit/application/doc_spec.rb +2 -2
  91. data/spec/unit/application/facts_spec.rb +3 -1
  92. data/spec/unit/application_spec.rb +9 -4
  93. data/spec/unit/configurer_spec.rb +39 -6
  94. data/spec/unit/environments_spec.rb +99 -32
  95. data/spec/unit/face/config_spec.rb +56 -0
  96. data/spec/unit/face/node_spec.rb +2 -2
  97. data/spec/unit/file_system_spec.rb +1 -2
  98. data/spec/unit/http/resolver_spec.rb +24 -4
  99. data/spec/unit/http/service/ca_spec.rb +2 -2
  100. data/spec/unit/http/service/compiler_spec.rb +2 -2
  101. data/spec/unit/http/service/file_server_spec.rb +2 -2
  102. data/spec/unit/http/service/puppetserver_spec.rb +82 -0
  103. data/spec/unit/http/service/report_spec.rb +2 -2
  104. data/spec/unit/http/session_spec.rb +8 -20
  105. data/spec/unit/indirector/catalog/json_spec.rb +1 -1
  106. data/spec/unit/indirector/catalog/rest_spec.rb +1 -1
  107. data/spec/unit/indirector/facts/rest_spec.rb +1 -1
  108. data/spec/unit/indirector/json_spec.rb +8 -8
  109. data/spec/unit/indirector/msgpack_spec.rb +8 -8
  110. data/spec/unit/indirector/node/rest_spec.rb +1 -1
  111. data/spec/unit/indirector/request_spec.rb +4 -4
  112. data/spec/unit/indirector/rest_spec.rb +1 -1
  113. data/spec/unit/indirector/status/rest_spec.rb +1 -1
  114. data/spec/unit/indirector/yaml_spec.rb +7 -7
  115. data/spec/unit/network/http/api/master/v3/environments_spec.rb +12 -23
  116. data/spec/unit/provider/exec_spec.rb +4 -3
  117. data/spec/unit/provider/package/dpkg_spec.rb +22 -7
  118. data/spec/unit/provider/package/openbsd_spec.rb +2 -0
  119. data/spec/unit/provider/package/pip2_spec.rb +36 -0
  120. data/spec/unit/provider/package/puppetserver_gem_spec.rb +137 -0
  121. data/spec/unit/provider/package/yum_spec.rb +31 -0
  122. data/spec/unit/provider/service/base_spec.rb +2 -4
  123. data/spec/unit/provider/service/bsd_spec.rb +5 -1
  124. data/spec/unit/provider/service/daemontools_spec.rb +1 -1
  125. data/spec/unit/provider/service/debian_spec.rb +3 -5
  126. data/spec/unit/provider/service/freebsd_spec.rb +1 -1
  127. data/spec/unit/provider/service/gentoo_spec.rb +4 -5
  128. data/spec/unit/provider/service/init_spec.rb +4 -5
  129. data/spec/unit/provider/service/launchd_spec.rb +5 -6
  130. data/spec/unit/provider/service/openrc_spec.rb +4 -5
  131. data/spec/unit/provider/service/openwrt_spec.rb +1 -1
  132. data/spec/unit/provider/service/redhat_spec.rb +1 -1
  133. data/spec/unit/provider/service/runit_spec.rb +2 -1
  134. data/spec/unit/provider/service/smf_spec.rb +1 -1
  135. data/spec/unit/provider/service/src_spec.rb +3 -5
  136. data/spec/unit/provider/service/systemd_spec.rb +3 -1
  137. data/spec/unit/provider/service/upstart_spec.rb +4 -5
  138. data/spec/unit/rest/route_spec.rb +4 -4
  139. data/spec/unit/settings_spec.rb +44 -22
  140. data/spec/unit/transaction/report_spec.rb +2 -0
  141. data/spec/unit/type/file/source_spec.rb +1 -1
  142. data/spec/unit/type/filebucket_spec.rb +1 -1
  143. data/spec/unit/util/run_mode_spec.rb +6 -6
  144. metadata +13 -2
@@ -0,0 +1,137 @@
1
+ require 'spec_helper'
2
+
3
+ describe Puppet::Type.type(:package).provider(:puppetserver_gem) do
4
+ let(:resource) do
5
+ Puppet::Type.type(:package).new(
6
+ name: 'myresource',
7
+ ensure: :installed
8
+ )
9
+ end
10
+
11
+ let(:provider) do
12
+ provider = described_class.new
13
+ provider.resource = resource
14
+ provider
15
+ end
16
+
17
+ let(:provider_gem_cmd) { '/opt/puppetlabs/bin/puppetserver' }
18
+
19
+ custom_environment = { HOME: ENV['HOME'] }
20
+
21
+ let(:execute_options) { { failonfail: true, combine: true, custom_environment: custom_environment } }
22
+
23
+ before :each do
24
+ resource.provider = provider
25
+ allow(Puppet::Util).to receive(:which).with(provider_gem_cmd).and_return(provider_gem_cmd)
26
+ end
27
+
28
+ describe "#install" do
29
+ it "uses the path to the gem command" do
30
+ allow(described_class).to receive(:validate_command).with(provider_gem_cmd)
31
+ expect(Puppet::Util::Execution).to receive(:execute).with(be_a(Array), execute_options) { |args| expect(args[0]).to eq(provider_gem_cmd) }.and_return('')
32
+ provider.install
33
+ end
34
+
35
+ it "appends version if given" do
36
+ resource[:ensure] = ['1.2.1']
37
+ expect(described_class).to receive(:puppetservercmd).with(%w{gem install -v 1.2.1 --no-document myresource}).and_return('')
38
+ provider.install
39
+ end
40
+
41
+ context "with install_options" do
42
+ it "does not append the parameter by default" do
43
+ expect(described_class).to receive(:puppetservercmd).with(%w{gem install --no-document myresource}).and_return('')
44
+ provider.install
45
+ end
46
+
47
+ it "allows setting the parameter" do
48
+ resource[:install_options] = [ '--force', {'--bindir' => '/usr/bin' } ]
49
+ expect(described_class).to receive(:puppetservercmd).with(%w{gem install --force --bindir=/usr/bin --no-document myresource}).and_return('')
50
+ provider.install
51
+ end
52
+ end
53
+
54
+ context "with source" do
55
+ it "correctly sets http source" do
56
+ resource[:source] = 'http://rubygems.com'
57
+ expect(described_class).to receive(:puppetservercmd).with(%w{gem install --no-document --source http://rubygems.com myresource}).and_return('')
58
+ provider.install
59
+ end
60
+
61
+ it "correctly sets local file source" do
62
+ resource[:source] = 'paint-2.2.0.gem'
63
+ expect(described_class).to receive(:puppetservercmd).with(%w{gem install --no-document paint-2.2.0.gem}).and_return('')
64
+ provider.install
65
+ end
66
+
67
+ it "correctly sets local file source with URI scheme" do
68
+ resource[:source] = 'file:///root/paint-2.2.0.gem'
69
+ expect(described_class).to receive(:puppetservercmd).with(%w{gem install --no-document /root/paint-2.2.0.gem}).and_return('')
70
+ provider.install
71
+ end
72
+
73
+ it "raises if given a puppet URI scheme" do
74
+ resource[:source] = 'puppet:///paint-2.2.0.gem'
75
+ expect { provider.install }.to raise_error(Puppet::Error, 'puppet:// URLs are not supported as gem sources')
76
+ end
77
+
78
+ it "raises if given an invalid URI" do
79
+ resource[:source] = 'h;ttp://rubygems.com'
80
+ expect { provider.install }.to raise_error(Puppet::Error, /Invalid source '': bad URI\(is not URI\?\)/)
81
+ end
82
+ end
83
+ end
84
+
85
+ describe "#uninstall" do
86
+ it "uses the path to the gem command" do
87
+ allow(described_class).to receive(:validate_command).with(provider_gem_cmd)
88
+ expect(Puppet::Util::Execution).to receive(:execute).with(be_a(Array), execute_options) { |args| expect(args[0]).to eq(provider_gem_cmd) }.and_return('')
89
+ provider.uninstall
90
+ end
91
+
92
+ context "with uninstall_options" do
93
+ it "does not append the parameter by default" do
94
+ expect(described_class).to receive(:puppetservercmd).with(%w{gem uninstall --executables --all myresource}).and_return('')
95
+ provider.uninstall
96
+ end
97
+
98
+ it "allows setting the parameter" do
99
+ resource[:uninstall_options] = [ '--force', {'--bindir' => '/usr/bin' } ]
100
+ expect(described_class).to receive(:puppetservercmd).with(%w{gem uninstall --executables --all myresource --force --bindir=/usr/bin}).and_return('')
101
+ provider.uninstall
102
+ end
103
+ end
104
+ end
105
+
106
+ describe ".gemlist" do
107
+ context "listing installed packages" do
108
+ it "uses the puppet rubygems library to list local gems" do
109
+ expected = { name: 'world_airports', provider: :puppetserver_gem, ensure: ['1.1.3'] }
110
+ expect(described_class).to receive(:execute_rubygems_list_command).with(nil).and_return(File.read(my_fixture('gem-list-local-packages')))
111
+ expect(described_class.gemlist({ local: true })).to include(expected)
112
+ end
113
+ end
114
+
115
+ it "appends the gem source if given" do
116
+ expect(described_class).to receive(:puppetservercmd).with(%w{gem list --remote --source https://rubygems.com}).and_return('')
117
+ described_class.gemlist({ source: 'https://rubygems.com' })
118
+ end
119
+ end
120
+
121
+ context 'calculated specificity' do
122
+ context 'when is not defaultfor' do
123
+ subject { described_class.specificity }
124
+ it { is_expected.to eql 1 }
125
+ end
126
+
127
+ context 'when is defaultfor' do
128
+ let(:os) { Facter.value(:operatingsystem) }
129
+ subject do
130
+ described_class.defaultfor(operatingsystem: os)
131
+ described_class.specificity
132
+ end
133
+ it { is_expected.to be > 100 }
134
+ end
135
+ end
136
+
137
+ end
@@ -158,6 +158,37 @@ describe Puppet::Type.type(:package).provider(:yum) do
158
158
  end
159
159
  end
160
160
 
161
+ context "latest" do
162
+ let(:name) { 'baz' }
163
+
164
+ let(:resource) do
165
+ Puppet::Type.type(:package).new(
166
+ :name => name,
167
+ :provider => 'yum',
168
+ )
169
+ end
170
+
171
+ let(:provider) do
172
+ provider = described_class.new
173
+ provider.resource = resource
174
+ provider
175
+ end
176
+
177
+ before {
178
+ allow(described_class).to receive(:command).with(:cmd).and_return("/usr/bin/yum")
179
+ Puppet[:log_level] = 'debug'
180
+ }
181
+
182
+ it "should print a debug message with the current version if newer package is not available" do
183
+ expect(provider).to receive(:query).and_return({:ensure => "1.2.3"})
184
+ expect(described_class).to receive(:latest_package_version).and_return(nil)
185
+ resource[:ensure] = :present
186
+
187
+ provider.latest
188
+ expect(@logs).to include(an_object_having_attributes(level: :debug, message: "Yum didn't find updates, current version (1.2.3) is the latest"))
189
+ end
190
+ end
191
+
161
192
  context "parsing the output of check-update" do
162
193
  context "with no multiline entries" do
163
194
  let(:check_update) { File.read(my_fixture("yum-check-update-simple.txt")) }
@@ -14,10 +14,8 @@ describe "base service provider" do
14
14
 
15
15
  subject { provider }
16
16
 
17
- if Puppet::Util::Platform.windows?
18
- # Get a pid for $CHILD_STATUS to latch on to
19
- cmd = "cmd.exe /c \"exit 0\""
20
- Puppet::Util::Execution.execute(cmd, {:failonfail => false})
17
+ before(:all) do
18
+ `exit 0`
21
19
  end
22
20
 
23
21
  context "basic operations" do
@@ -1,9 +1,13 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe 'Puppet::Type::Service::Provider::Bsd',
4
- :unless => Puppet::Util::Platform.windows? || Puppet::Util::Platform.jruby? do
4
+ unless: Puppet::Util::Platform.windows? || Puppet::Util::Platform.jruby? do
5
5
  let(:provider_class) { Puppet::Type.type(:service).provider(:bsd) }
6
6
 
7
+ before(:all) do
8
+ `exit 0`
9
+ end
10
+
7
11
  before :each do
8
12
  allow(Puppet::Type.type(:service)).to receive(:defaultprovider).and_return(provider_class)
9
13
  allow(Facter).to receive(:value).with(:operatingsystem).and_return(:netbsd)
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe 'Puppet::Type::Service::Provider::Daemontools',
4
- unless: Puppet::Util::Platform.jruby? do
4
+ unless: Puppet::Util::Platform.windows? || Puppet::Util::Platform.jruby? do
5
5
  let(:provider_class) { Puppet::Type.type(:service).provider(:daemontools) }
6
6
 
7
7
  before(:each) do
@@ -1,13 +1,11 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe 'Puppet::Type::Service::Provider::Debian',
4
- unless: Puppet::Util::Platform.jruby? do
4
+ unless: Puppet::Util::Platform.jruby? || Puppet::Util::Platform.windows? do
5
5
  let(:provider_class) { Puppet::Type.type(:service).provider(:debian) }
6
6
 
7
- if Puppet::Util::Platform.windows?
8
- # Get a pid for $CHILD_STATUS to latch on to
9
- command = "cmd.exe /c \"exit 0\""
10
- Puppet::Util::Execution.execute(command, {:failonfail => false})
7
+ before(:all) do
8
+ `exit 0`
11
9
  end
12
10
 
13
11
  before(:each) do
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe 'Puppet::Type::Service::Provider::Freebsd',
4
- unless: Puppet::Util::Platform.jruby? do
4
+ unless: Puppet::Util::Platform.windows? || Puppet::Util::Platform.jruby? do
5
5
  let(:provider_class) { Puppet::Type.type(:service).provider(:freebsd) }
6
6
 
7
7
  before :each do
@@ -1,12 +1,11 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe 'Puppet::Type::Service::Provider::Gentoo', unless: Puppet::Util::Platform.jruby? do
3
+ describe 'Puppet::Type::Service::Provider::Gentoo',
4
+ unless: Puppet::Util::Platform.windows? || Puppet::Util::Platform.jruby? do
4
5
  let(:provider_class) { Puppet::Type.type(:service).provider(:gentoo) }
5
6
 
6
- if Puppet::Util::Platform.windows?
7
- # Get a pid for $CHILD_STATUS to latch on to
8
- command = "cmd.exe /c \"exit 0\""
9
- Puppet::Util::Execution.execute(command, {:failonfail => false})
7
+ before(:all) do
8
+ `exit 0`
10
9
  end
11
10
 
12
11
  before :each do
@@ -1,12 +1,11 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe 'Puppet::Type::Service::Provider::Init', unless: Puppet::Util::Platform.jruby? do
3
+ describe 'Puppet::Type::Service::Provider::Init',
4
+ unless: Puppet::Util::Platform.windows? || Puppet::Util::Platform.jruby? do
4
5
  let(:provider_class) { Puppet::Type.type(:service).provider(:init) }
5
6
 
6
- if Puppet::Util::Platform.windows?
7
- # Get a pid for $CHILD_STATUS to latch on to
8
- cmd = "cmd.exe /c \"exit 0\""
9
- Puppet::Util::Execution.execute(cmd, {:failonfail => false})
7
+ before :all do
8
+ `exit 0`
10
9
  end
11
10
 
12
11
  before do
@@ -1,20 +1,19 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe 'Puppet::Type::Service::Provider::Launchd', unless: Puppet::Util::Platform.jruby? do
3
+ describe 'Puppet::Type::Service::Provider::Launchd',
4
+ unless: Puppet::Util::Platform.windows? || Puppet::Util::Platform.jruby? do
4
5
  let(:provider_class) { Puppet::Type.type(:service).provider(:launchd) }
5
-
6
6
  let (:plistlib) { Puppet::Util::Plist }
7
7
  let (:joblabel) { "com.foo.food" }
8
8
  let (:provider) { subject.class }
9
9
  let (:resource) { Puppet::Type.type(:service).new(:name => joblabel, :provider => :launchd) }
10
10
  let (:launchd_overrides_6_9) { '/var/db/launchd.db/com.apple.launchd/overrides.plist' }
11
11
  let (:launchd_overrides_10_) { '/var/db/com.apple.xpc.launchd/disabled.plist' }
12
+
12
13
  subject { resource.provider }
13
14
 
14
- if Puppet::Util::Platform.windows?
15
- # Get a pid for $CHILD_STATUS to latch on to
16
- command = "cmd.exe /c \"exit 0\""
17
- Puppet::Util::Execution.execute(command, {:failonfail => false})
15
+ before :all do
16
+ `exit 0`
18
17
  end
19
18
 
20
19
  describe "the type interface" do
@@ -1,12 +1,11 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe 'Puppet::Type::Service::Provider::Openrc', unless: Puppet::Util::Platform.jruby? do
3
+ describe 'Puppet::Type::Service::Provider::Openrc',
4
+ unless: Puppet::Util::Platform.windows? || Puppet::Util::Platform.jruby? do
4
5
  let(:provider_class) { Puppet::Type.type(:service).provider(:openrc) }
5
6
 
6
- if Puppet::Util::Platform.windows?
7
- # Get a pid for $CHILD_STATUS to latch on to
8
- cmd = "cmd.exe /c \"exit 0\""
9
- Puppet::Util::Execution.execute(cmd, {:failonfail => false})
7
+ before :all do
8
+ `exit 0`
10
9
  end
11
10
 
12
11
  before :each do
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe 'Puppet::Type::Service::Provider::Openwrt',
4
- :if => Puppet.features.posix? && !Puppet::Util::Platform.jruby? do
4
+ unless: Puppet::Util::Platform.windows? || Puppet::Util::Platform.jruby? do
5
5
  let(:provider_class) { Puppet::Type.type(:service).provider(:openwrt) }
6
6
 
7
7
  let(:resource) do
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe 'Puppet::Type::Service::Provider::Redhat',
4
- if: Puppet.features.posix? && !Puppet::Util::Platform.jruby?do
4
+ unless: Puppet::Util::Platform.windows? || Puppet::Util::Platform.jruby? do
5
5
  let(:provider_class) { Puppet::Type.type(:service).provider(:redhat) }
6
6
 
7
7
  # `execute` and `texecute` start a new process, consequently setting $CHILD_STATUS to a Process::Status instance,
@@ -1,6 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe 'Puppet::Type::Service::Provider::Runit', unless: Puppet::Util::Platform.jruby? do
3
+ describe 'Puppet::Type::Service::Provider::Runit',
4
+ unless: Puppet::Util::Platform.windows? || Puppet::Util::Platform.jruby? do
4
5
  let(:provider_class) { Puppet::Type.type(:service).provider(:runit) }
5
6
 
6
7
  before(:each) do
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe 'Puppet::Type::Service::Provider::Smf',
4
- if: Puppet.features.posix? && !Puppet::Util::Platform.jruby? do
4
+ unless: Puppet::Util::Platform.windows? || Puppet::Util::Platform.jruby? do
5
5
  let(:provider_class) { Puppet::Type.type(:service).provider(:smf) }
6
6
 
7
7
  before(:each) do
@@ -1,13 +1,11 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe 'Puppet::Type::Service::Provider::Src',
4
- unless: Puppet::Util::Platform.jruby? do
4
+ unless: Puppet::Util::Platform.windows? || Puppet::Util::Platform.jruby? do
5
5
  let(:provider_class) { Puppet::Type.type(:service).provider(:src) }
6
6
 
7
- if Puppet::Util::Platform.windows?
8
- # Get a pid for $CHILD_STATUS to latch on to
9
- command = "cmd.exe /c \"exit 0\""
10
- Puppet::Util::Execution.execute(command, {:failonfail => false})
7
+ before :all do
8
+ `exit 0`
11
9
  end
12
10
 
13
11
  before :each do
@@ -1,6 +1,8 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe 'Puppet::Type::Service::Provider::Systemd', unless: Puppet::Util::Platform.jruby? || Puppet::Util::Platform.windows? do
3
+ describe 'Puppet::Type::Service::Provider::Systemd',
4
+ unless: Puppet::Util::Platform.windows? || Puppet::Util::Platform.jruby? do
5
+
4
6
  let(:provider_class) { Puppet::Type.type(:service).provider(:systemd) }
5
7
 
6
8
  before :each do
@@ -1,14 +1,13 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe 'Puppet::Type::Service::Provider::Upstart', unless: Puppet::Util::Platform.jruby? do
3
+ describe 'Puppet::Type::Service::Provider::Upstart',
4
+ unless: Puppet::Util::Platform.windows? || Puppet::Util::Platform.jruby? do
4
5
  let(:manual) { "\nmanual" }
5
6
  let(:start_on_default_runlevels) { "\nstart on runlevel [2,3,4,5]" }
6
7
  let!(:provider_class) { Puppet::Type.type(:service).provider(:upstart) }
7
8
 
8
- if Puppet::Util::Platform.windows?
9
- # Get a pid for $CHILD_STATUS to latch on to
10
- command = "cmd.exe /c \"exit 0\""
11
- Puppet::Util::Execution.execute(command, {:failonfail => false})
9
+ before :each do
10
+ `exit 0`
12
11
  end
13
12
 
14
13
  def given_contents_of(file, content)
@@ -30,7 +30,7 @@ describe Puppet::Rest::Route do
30
30
 
31
31
  it "yields a base URL with Puppet's configured server and port when no defaults are specified" do
32
32
  Puppet[:server] = 'configured.net'
33
- Puppet[:masterport] = 8140
33
+ Puppet[:serverport] = 8140
34
34
  fallback_route = Puppet::Rest::Route.new(api: '/fakeapi/v1/')
35
35
  count = 0
36
36
  rval = fallback_route.with_base_url(dns_resolver) do |url|
@@ -55,9 +55,9 @@ describe Puppet::Rest::Route do
55
55
  expect(rval).to eq('Block return value')
56
56
  end
57
57
 
58
- it 'falls back to :server and :masterport if nil is passed' do
58
+ it 'falls back to :server and :serverport if nil is passed' do
59
59
  Puppet[:server] = 'one.net'
60
- Puppet[:masterport] = 111
60
+ Puppet[:serverport] = 111
61
61
  nil_route = Puppet::Rest::Route.new(api: '/fakeapi/v1/',
62
62
  server_setting: nil,
63
63
  port_setting: nil)
@@ -109,7 +109,7 @@ describe Puppet::Rest::Route do
109
109
 
110
110
  it "should fall back to the default server when the block raises a SystemCallError" do
111
111
  Puppet[:server] = "testserver"
112
- Puppet[:masterport] = 555
112
+ Puppet[:serverport] = 555
113
113
 
114
114
  count = 0
115
115
  rval = route.with_base_url(Puppet::Network::Resolver.new) do |url|
@@ -9,7 +9,7 @@ describe Puppet::Settings do
9
9
  include Matchers::Resource
10
10
 
11
11
  let(:main_config_file_default_location) do
12
- File.join(Puppet::Util::RunMode[:master].conf_dir, "puppet.conf")
12
+ File.join(Puppet::Util::RunMode[:server].conf_dir, "puppet.conf")
13
13
  end
14
14
 
15
15
  let(:user_config_file_default_location) do
@@ -112,9 +112,9 @@ describe Puppet::Settings do
112
112
  # case behaviors / uses. However, until that time... we need to make sure that our private run_mode=
113
113
  # setter method gets properly called during app initialization.
114
114
  it "sets the preferred run mode when initializing the app defaults" do
115
- @settings.initialize_app_defaults(default_values.merge(:run_mode => :master))
115
+ @settings.initialize_app_defaults(default_values.merge(:run_mode => :server))
116
116
 
117
- expect(@settings.preferred_run_mode).to eq(:master)
117
+ expect(@settings.preferred_run_mode).to eq(:server)
118
118
  end
119
119
 
120
120
  it "creates ancestor directories for all required app settings" do
@@ -326,7 +326,7 @@ describe Puppet::Settings do
326
326
  end
327
327
 
328
328
  it "should identify configured settings from the specified run mode" do
329
- user_config_text = "[master]\nmyval = foo"
329
+ user_config_text = "[server]\nmyval = foo"
330
330
 
331
331
  allow(Puppet.features).to receive(:root?).and_return(false)
332
332
  expect(Puppet::FileSystem).to receive(:exist?).
@@ -337,7 +337,7 @@ describe Puppet::Settings do
337
337
  and_return(user_config_text).ordered
338
338
 
339
339
  @settings.send(:parse_config_files)
340
- expect(@settings.set_by_config?(:myval, nil, :master)).to be_truthy
340
+ expect(@settings.set_by_config?(:myval, nil, :server)).to be_truthy
341
341
  end
342
342
 
343
343
  it "should not identify configured settings from an unspecified run mode" do
@@ -382,7 +382,7 @@ describe Puppet::Settings do
382
382
 
383
383
  it "should clear the cache when the preferred_run_mode is changed" do
384
384
  expect(@settings).to receive(:flush_cache)
385
- @settings.preferred_run_mode = :master
385
+ @settings.preferred_run_mode = :server
386
386
  end
387
387
 
388
388
  it "should not clear other values when setting getopt-specific values" do
@@ -658,6 +658,28 @@ describe Puppet::Settings do
658
658
  expect(@settings[:one]).to eq("modeval")
659
659
  end
660
660
 
661
+ [:master, :server].each do |run_mode|
662
+ describe "when run mode is '#{run_mode}'" do
663
+ before(:each) { @settings.preferred_run_mode = run_mode }
664
+
665
+ it "returns values set in the 'master' section if the 'server' section does not exist" do
666
+ text = "[main]\none = mainval\n[master]\none = modeval\n"
667
+ allow(@settings).to receive(:read_file).and_return(text)
668
+ @settings.send(:parse_config_files)
669
+
670
+ expect(@settings[:one]).to eq("modeval")
671
+ end
672
+
673
+ it "prioritizes values set in the 'server' section if set" do
674
+ text = "[main]\none = mainval\n[server]\none = serverval\n[master]\none = masterval\n"
675
+ allow(@settings).to receive(:read_file).and_return(text)
676
+ @settings.send(:parse_config_files)
677
+
678
+ expect(@settings[:one]).to eq("serverval")
679
+ end
680
+ end
681
+ end
682
+
661
683
  it "should not return values outside of its search path" do
662
684
  text = "[other]\none = oval\n"
663
685
  allow(@settings).to receive(:read_file).and_return(text)
@@ -854,10 +876,10 @@ describe Puppet::Settings do
854
876
  default_values[key] = 'default value'
855
877
  end
856
878
  @settings.define_settings :main, PuppetSpec::Settings::TEST_APP_DEFAULT_DEFINITIONS
857
- @settings.define_settings :master, :myfile => { :type => :file, :default => make_absolute("/myfile"), :desc => "a" }
879
+ @settings.define_settings :server, :myfile => { :type => :file, :default => make_absolute("/myfile"), :desc => "a" }
858
880
 
859
881
  otherfile = make_absolute("/other/file")
860
- text = "[master]
882
+ text = "[server]
861
883
  myfile = #{otherfile} {mode = 664}
862
884
  "
863
885
  expect(@settings).to receive(:read_file).and_return(text)
@@ -866,9 +888,9 @@ describe Puppet::Settings do
866
888
  expect(@settings.preferred_run_mode).to eq(:user)
867
889
  @settings.send(:parse_config_files)
868
890
 
869
- # change app run_mode to master
870
- @settings.initialize_app_defaults(default_values.merge(:run_mode => :master))
871
- expect(@settings.preferred_run_mode).to eq(:master)
891
+ # change app run_mode to server
892
+ @settings.initialize_app_defaults(default_values.merge(:run_mode => :server))
893
+ expect(@settings.preferred_run_mode).to eq(:server)
872
894
 
873
895
  # initializing the app should have reloaded the metadata based on run_mode
874
896
  expect(@settings[:myfile]).to eq(otherfile)
@@ -884,9 +906,9 @@ describe Puppet::Settings do
884
906
  file = make_absolute("/file")
885
907
  default_mode = "0600"
886
908
  @settings.define_settings :main, PuppetSpec::Settings::TEST_APP_DEFAULT_DEFINITIONS
887
- @settings.define_settings :master, :myfile => { :type => :file, :default => file, :desc => "a", :mode => default_mode }
909
+ @settings.define_settings :server, :myfile => { :type => :file, :default => file, :desc => "a", :mode => default_mode }
888
910
 
889
- text = "[master]
911
+ text = "[server]
890
912
  myfile = #{file}/foo
891
913
  [agent]
892
914
  myfile = #{file} {mode = 664}
@@ -897,9 +919,9 @@ describe Puppet::Settings do
897
919
  expect(@settings.preferred_run_mode).to eq(:user)
898
920
  @settings.send(:parse_config_files)
899
921
 
900
- # change app run_mode to master
901
- @settings.initialize_app_defaults(default_values.merge(:run_mode => :master))
902
- expect(@settings.preferred_run_mode).to eq(:master)
922
+ # change app run_mode to server
923
+ @settings.initialize_app_defaults(default_values.merge(:run_mode => :server))
924
+ expect(@settings.preferred_run_mode).to eq(:server)
903
925
 
904
926
  # initializing the app should have reloaded the metadata based on run_mode
905
927
  expect(@settings[:myfile]).to eq("#{file}/foo")
@@ -1900,18 +1922,18 @@ describe Puppet::Settings do
1900
1922
  end
1901
1923
 
1902
1924
  it "should set preferred run mode from --run_mode <foo> string without error" do
1903
- args = ["--run_mode", "master"]
1904
- expect(settings).not_to receive(:handlearg).with("--run_mode", "master")
1925
+ args = ["--run_mode", "server"]
1926
+ expect(settings).not_to receive(:handlearg).with("--run_mode", "server")
1905
1927
  expect { settings.send(:parse_global_options, args) } .to_not raise_error
1906
- expect(Puppet.settings.preferred_run_mode).to eq(:master)
1928
+ expect(Puppet.settings.preferred_run_mode).to eq(:server)
1907
1929
  expect(args.empty?).to eq(true)
1908
1930
  end
1909
1931
 
1910
1932
  it "should set preferred run mode from --run_mode=<foo> string without error" do
1911
- args = ["--run_mode=master"]
1912
- expect(settings).not_to receive(:handlearg).with("--run_mode", "master")
1933
+ args = ["--run_mode=server"]
1934
+ expect(settings).not_to receive(:handlearg).with("--run_mode", "server")
1913
1935
  expect { settings.send(:parse_global_options, args) }.to_not raise_error
1914
- expect(Puppet.settings.preferred_run_mode).to eq(:master)
1936
+ expect(Puppet.settings.preferred_run_mode).to eq(:server)
1915
1937
  expect(args.empty?).to eq(true)
1916
1938
  end
1917
1939
  end