serverspec 2.28.0 → 2.29.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/serverspec/type/file.rb +12 -0
- data/lib/serverspec/version.rb +1 -1
- data/spec/type/base/file_spec.rb +15 -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: b5dbcdde2a597094da01d9a52381e04d6968710c
|
4
|
+
data.tar.gz: da28c1a7fed332ff7c166c90f75f05cad01e94a1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9d83c03e913c7e3c22a6655278ba0dc92eaa09c25cb4c08713059fdd5e7f0902f7896b838ec817dc91d990ad4ad50787191bf03680efd23959aee332e785fec
|
7
|
+
data.tar.gz: 6531d6f1ee05d1d65b70943c32ac007a0d366370503df2c185e925b92ccf180d596ec41b5900b344852e856b38a9d6284c60123f4477bbb30229e31b309b3941
|
data/lib/serverspec/type/file.rb
CHANGED
@@ -113,6 +113,10 @@ module Serverspec::Type
|
|
113
113
|
@content
|
114
114
|
end
|
115
115
|
|
116
|
+
def group
|
117
|
+
@runner.get_file_owner_group(@name).stdout.strip
|
118
|
+
end
|
119
|
+
|
116
120
|
def version?(version)
|
117
121
|
@runner.check_file_has_version(@name, version)
|
118
122
|
end
|
@@ -121,11 +125,19 @@ module Serverspec::Type
|
|
121
125
|
@runner.get_file_link_target(@name).stdout.strip
|
122
126
|
end
|
123
127
|
|
128
|
+
def mode
|
129
|
+
@runner.get_file_mode(@name).stdout.strip
|
130
|
+
end
|
131
|
+
|
124
132
|
def mtime
|
125
133
|
d = @runner.get_file_mtime(@name).stdout.strip
|
126
134
|
DateTime.strptime(d, '%s').new_offset(DateTime.now.offset)
|
127
135
|
end
|
128
136
|
|
137
|
+
def owner
|
138
|
+
@runner.get_file_owner_user(@name).stdout.strip
|
139
|
+
end
|
140
|
+
|
129
141
|
def size
|
130
142
|
@runner.get_file_size(@name).stdout.strip.to_i
|
131
143
|
end
|
data/lib/serverspec/version.rb
CHANGED
data/spec/type/base/file_spec.rb
CHANGED
@@ -319,6 +319,11 @@ describe file('invalid-file') do
|
|
319
319
|
its(:sha256sum) { should_not eq 'INVALIDSHA256CHECKSUM' }
|
320
320
|
end
|
321
321
|
|
322
|
+
describe file('/etc/passwd') do
|
323
|
+
let(:stdout) { "root\r\n" }
|
324
|
+
its(:group) { should eq 'root' }
|
325
|
+
end
|
326
|
+
|
322
327
|
describe file('/etc/passwd') do
|
323
328
|
let(:stdout) {<<EOF
|
324
329
|
root:x:0:0:root:/root:/bin/bash
|
@@ -342,11 +347,21 @@ describe file('/etc/pam.d/system-auth') do
|
|
342
347
|
its(:link_target) { should eq '/etc/pam.dsystem-auth-ac' }
|
343
348
|
end
|
344
349
|
|
350
|
+
describe file('/etc/passwd') do
|
351
|
+
let(:stdout) { "644\r\n" }
|
352
|
+
its(:mode) { should eq '644' }
|
353
|
+
end
|
354
|
+
|
345
355
|
describe file('/etc/passwd') do
|
346
356
|
let(:stdout) { Time.now.to_i.to_s }
|
347
357
|
its(:mtime) { should > DateTime.now - 1 }
|
348
358
|
end
|
349
359
|
|
360
|
+
describe file('/etc/passwd') do
|
361
|
+
let(:stdout) { "root\r\n" }
|
362
|
+
its(:owner) { should eq 'root' }
|
363
|
+
end
|
364
|
+
|
350
365
|
describe file('/etc/passwod') do
|
351
366
|
let(:stdout) { 100.to_s }
|
352
367
|
its(:size) { should > 0 }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: serverspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.29.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gosuke Miyashita
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|