poise-service 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 620447ed47a3030f8b4450f2c0ff5fec761a2188
|
4
|
+
data.tar.gz: 675005000178c19f5b7d4422857d67372fe3d50a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61d7319f04b307c041e763ff157993957a627703bb22b32845f5cf8aae3e8f34acfc10dc955239d5258a1775a49c7a79d41b1c590e242601d1cbafa388166553
|
7
|
+
data.tar.gz: b908f0d756102441e6921f57ec639282b65f0d4f76546824d2e22f4e0d069bd72a062572ac89c54a43bf5661529b41a5fd2e76c8591d8cb430fa6caa8fd6feb1
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Poise-Service Changelog
|
2
2
|
|
3
|
+
## v1.3.1
|
4
|
+
|
5
|
+
* [#25](https://github.com/poise/poise-service/pull/25) Cope with a service user
|
6
|
+
with an invalid home directory.
|
7
|
+
* Use the correct default cookbook for `service_template` when used with additional plugins.
|
8
|
+
|
3
9
|
## v1.3.0
|
4
10
|
|
5
11
|
* Allow setting `pid_file_external false` as a provider option for the `sysvinit`
|
@@ -118,23 +118,26 @@ module PoiseService
|
|
118
118
|
# @see #directory
|
119
119
|
# @return [String]
|
120
120
|
def default_directory
|
121
|
-
#
|
122
|
-
|
123
|
-
# Force a reload in case any users were created earlier in the run.
|
124
|
-
Etc.endpwent
|
125
|
-
home = begin
|
126
|
-
Dir.home(user)
|
127
|
-
rescue ArgumentError
|
128
|
-
nil
|
129
|
-
end
|
130
|
-
end
|
131
|
-
# Better than nothing
|
132
|
-
home || case node['platform_family']
|
121
|
+
# Default fallback.
|
122
|
+
sysroot = case node['platform_family']
|
133
123
|
when 'windows'
|
134
124
|
ENV.fetch('SystemRoot', 'C:\\')
|
135
125
|
else
|
136
126
|
'/'
|
137
127
|
end
|
128
|
+
# For root we always want the system root path.
|
129
|
+
return sysroot if user == 'root'
|
130
|
+
# Force a reload in case any users were created earlier in the run.
|
131
|
+
Etc.endpwent
|
132
|
+
# ArgumentError means we can't find the user, possibly nsswitch caching?
|
133
|
+
home = begin
|
134
|
+
Dir.home(user)
|
135
|
+
rescue ArgumentError
|
136
|
+
sysroot
|
137
|
+
end
|
138
|
+
# If the home doesn't exist or is empty, use sysroot.
|
139
|
+
home = sysroot if home.empty? || !::File.directory?(home)
|
140
|
+
home
|
138
141
|
end
|
139
142
|
|
140
143
|
# Clean up a signal string/integer. Ints are mapped to the signal name,
|
@@ -161,6 +161,8 @@ describe PoiseService::Resources::PoiseService::Resource do
|
|
161
161
|
let(:user) { 'poise' }
|
162
162
|
before do
|
163
163
|
expect(Dir).to receive(:home).with('poise').and_return('/home/poise')
|
164
|
+
allow(File).to receive(:directory?).and_call_original
|
165
|
+
allow(File).to receive(:directory?).with('/home/poise').and_return(true)
|
164
166
|
end
|
165
167
|
|
166
168
|
it { is_expected.to eq '/home/poise' }
|
@@ -174,6 +176,26 @@ describe PoiseService::Resources::PoiseService::Resource do
|
|
174
176
|
|
175
177
|
it { is_expected.to eq '/' }
|
176
178
|
end # /context with an invalid user
|
179
|
+
|
180
|
+
context 'with a non-existent directory' do
|
181
|
+
let(:user) { 'poise' }
|
182
|
+
before do
|
183
|
+
expect(Dir).to receive(:home).with('poise').and_return('/home/poise')
|
184
|
+
allow(File).to receive(:directory?).and_call_original
|
185
|
+
allow(File).to receive(:directory?).with('/home/poise').and_return(false)
|
186
|
+
end
|
187
|
+
|
188
|
+
it { is_expected.to eq '/' }
|
189
|
+
end # /context with a non-existent directory
|
190
|
+
|
191
|
+
context 'with a blank directory' do
|
192
|
+
let(:user) { 'poise' }
|
193
|
+
before do
|
194
|
+
expect(Dir).to receive(:home).with('poise').and_return('')
|
195
|
+
end
|
196
|
+
|
197
|
+
it { is_expected.to eq '/' }
|
198
|
+
end # /context with a blank directory
|
177
199
|
end # /describe #default_directory
|
178
200
|
|
179
201
|
describe '#restart_on_update' 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.3.
|
4
|
+
version: 1.3.1
|
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-05-
|
11
|
+
date: 2016-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: halite
|