poise-service 1.2.1 → 1.3.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +2 -0
- data/chef/templates/default/inittab.sh.erb +1 -1
- data/lib/poise_service/service_providers/sysvinit.rb +1 -1
- data/lib/poise_service/version.rb +1 -1
- data/test/spec/resources/poise_service_spec.rb +1 -0
- data/test/spec/service_providers/sysvinit_spec.rb +42 -0
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e78d99c983b8bbd140f02e127362f21d5016354b
|
|
4
|
+
data.tar.gz: 35322dfdbc04cbeac6b81f3e8c7b2a73c23cf045
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5e97a66effe71fc090420174f0bb3224866fc83ff6e42b49019db07bd7b82bcafd7605f592b1b023e7c2fbe9ad90232ad68a50ae73d743b70f5d2efe1a2a4774
|
|
7
|
+
data.tar.gz: 84331025327a5ecfe30874991f13e918c93a05af914637d4c3214c6583123b1b943d43561eb5aed868debbc394ead51e31789099506df61cb5a327738329216f
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Poise-Service Changelog
|
|
2
2
|
|
|
3
|
+
## v1.3.0
|
|
4
|
+
|
|
5
|
+
* Allow setting `pid_file_external false` as a provider option for the `sysvinit`
|
|
6
|
+
provider to have non-standard path but keep the internal handling.
|
|
7
|
+
* Improved quoting for environment variables in the `inittab` provider.
|
|
8
|
+
|
|
3
9
|
## v1.2.1
|
|
4
10
|
|
|
5
11
|
* [#23](https://github.com/poise/poise-service/pull/23) Fix service templates on AIX and FreeBSD to use the correct root group.
|
data/README.md
CHANGED
|
@@ -245,6 +245,8 @@ process creating a PID file in the given path.
|
|
|
245
245
|
#### Options
|
|
246
246
|
|
|
247
247
|
* `pid_file` – Path to PID file that the service command will create.
|
|
248
|
+
* `pid_file_external` – If true, assume the service will create the PID file
|
|
249
|
+
itself. *(default: true if `pid_file` option is set)*
|
|
248
250
|
* `template` – Override the default script template. If you want to use a
|
|
249
251
|
template in a different cookbook use `'cookbook:template'`.
|
|
250
252
|
* `command` – Override the service command.
|
|
@@ -10,6 +10,6 @@ if Process.euid != ent.uid || Process.egid != ent.gid
|
|
|
10
10
|
Process::UID.change_privilege(ent.uid) if Process.euid != ent.uid
|
|
11
11
|
end
|
|
12
12
|
(ENV["HOME"] = Dir.home("<%= @user %>")) rescue nil
|
|
13
|
-
<%= @environment.map {|key, value| "ENV[
|
|
13
|
+
<%= @environment.map {|key, value| "ENV[#{key.to_s.inspect}] = #{value.to_s.inspect}" }.join("; ") %>
|
|
14
14
|
exec(*<%= Shellwords.split(@command).inspect %>)
|
|
15
15
|
EOH
|
|
@@ -69,7 +69,7 @@ module PoiseService
|
|
|
69
69
|
daemon: daemon,
|
|
70
70
|
daemon_options: parts[1].to_s,
|
|
71
71
|
pid_file: pid_file_,
|
|
72
|
-
pid_file_external: !!options['pid_file'],
|
|
72
|
+
pid_file_external: options['pid_file_external'].nil? ? !!options['pid_file'] : options['pid_file_external'],
|
|
73
73
|
platform_family: node['platform_family'],
|
|
74
74
|
)
|
|
75
75
|
end
|
|
@@ -152,6 +152,7 @@ describe PoiseService::Resources::PoiseService::Resource do
|
|
|
152
152
|
|
|
153
153
|
context 'on Windows' do
|
|
154
154
|
let(:chefspec_options) { {platform: 'windows', version: '2012R2'} }
|
|
155
|
+
before { allow(Poise::Utils::Win32).to receive(:admin_user).and_return('Administrator') } if defined?(Poise::Utils::Win32)
|
|
155
156
|
it { is_expected.to eq 'C:\\' }
|
|
156
157
|
end # /context on Windows
|
|
157
158
|
end # /context with root
|
|
@@ -48,6 +48,22 @@ EOH
|
|
|
48
48
|
--exec "myapp" -- --serve
|
|
49
49
|
EOH
|
|
50
50
|
end # /context with an external PID file
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
context 'with a non-default internal PID file' do
|
|
54
|
+
before do
|
|
55
|
+
override_attributes['poise-service']['test'] ||= {}
|
|
56
|
+
override_attributes['poise-service']['test']['pid_file'] = '/tmp/pid'
|
|
57
|
+
override_attributes['poise-service']['test']['pid_file_external'] = false
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
it { is_expected.to render_file('/etc/init.d/test').with_content(<<-EOH) }
|
|
61
|
+
start-stop-daemon --start --quiet --background \\
|
|
62
|
+
--pidfile "/tmp/pid" --make-pidfile \\
|
|
63
|
+
--chuid "root" --chdir "/" \\
|
|
64
|
+
--exec "myapp" -- --serve
|
|
65
|
+
EOH
|
|
66
|
+
end # /context with a non-default internal PID file
|
|
51
67
|
end # /context on Ubuntu
|
|
52
68
|
|
|
53
69
|
context 'on CentOS' do
|
|
@@ -82,6 +98,32 @@ EOH
|
|
|
82
98
|
Kernel.exec(*["myapp", "--serve"])
|
|
83
99
|
EOH
|
|
84
100
|
end # /context with an external PID file
|
|
101
|
+
|
|
102
|
+
context 'with a non-default internal PID file' do
|
|
103
|
+
before do
|
|
104
|
+
override_attributes['poise-service']['test'] ||= {}
|
|
105
|
+
override_attributes['poise-service']['test']['pid_file'] = '/tmp/pid'
|
|
106
|
+
override_attributes['poise-service']['test']['pid_file_external'] = false
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
it { is_expected.to render_file('/etc/init.d/test').with_content(<<-EOH) }
|
|
110
|
+
pid_file = "/tmp/pid"
|
|
111
|
+
File.unlink(pid_file) if File.exist?(pid_file)
|
|
112
|
+
if Process.fork
|
|
113
|
+
sleep(1) until File.exist?(pid_file)
|
|
114
|
+
else
|
|
115
|
+
Process.daemon(true)
|
|
116
|
+
Dir.chdir("/")
|
|
117
|
+
IO.write(pid_file, Process.pid)
|
|
118
|
+
ent = Etc.getpwnam("root")
|
|
119
|
+
if Process.euid != ent.uid || Process.egid != ent.gid
|
|
120
|
+
Process.initgroups(ent.name, ent.gid)
|
|
121
|
+
Process::GID.change_privilege(ent.gid) if Process.egid != ent.gid
|
|
122
|
+
Process::UID.change_privilege(ent.uid) if Process.euid != ent.uid
|
|
123
|
+
end
|
|
124
|
+
Kernel.exec(*["myapp", "--serve"])
|
|
125
|
+
EOH
|
|
126
|
+
end # /context with a non-default internal PID file
|
|
85
127
|
end # /context on CentOS
|
|
86
128
|
|
|
87
129
|
context 'with action :disable' do
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: poise-service
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Noah Kantrowitz
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-
|
|
11
|
+
date: 2016-05-03 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: halite
|