serverspec-extended-types 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/CHANGES.md +4 -0
- data/README.md +3 -3
- data/lib/serverspec_extended_types/version.rb +1 -1
- data/lib/serverspec_extended_types/virtualenv.rb +6 -6
- data/spec/types/http_get_spec.rb +1 -1
- data/spec/types/virtualenv_spec.rb +12 -12
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
N2QzMDBhYzA5MjU0M2RkOTA3MGU1ZTgxNDFlMzg3ZWE4YWQyOWQ2OQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OWYxYTE2NGM5NmExZWNhY2JlYWZjNmZhYThlNDdjZTFiMzM4YTZjNA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NTk1ZTA4NzQ4NzQ4YTM0YmQ4MTE0ZTQ5ZTEwNjgxZThhNzExODk0MGM4MDg0
|
10
|
+
MjcyN2NkNDRhMTJlNmE1ZGE4YmUxNTJmZGE3NDY2ZjQyM2E0YmEyZDA0Nzlk
|
11
|
+
ZDE2YjEzYjJlMTVjNTU5YWUyN2YzNzIwZjBjMzFhZmJhYWFlZGM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZTczY2FlZTQxZWUxNDkwNDVmMzA3MjA4MmU2YzIxMzdjZTQ3ODFjZTg2ODYx
|
14
|
+
YWMxNzU4ODE2Y2UxMTE0NWY0NTE5MjhiNWQwYjJhOTAyYTE2NTcwNzdjYzk4
|
15
|
+
NzgxYTZhYWZmMmRkNDQ1YjBmZTQ0NTFjZWFlZTY2M2ZkYTJlNmY=
|
data/CHANGES.md
CHANGED
data/README.md
CHANGED
@@ -217,9 +217,9 @@ Test whether this appears to be a working venv
|
|
217
217
|
|
218
218
|
Tests performed:
|
219
219
|
|
220
|
-
* venv_path/bin/pip executable by
|
221
|
-
* venv_path/bin/python executable by
|
222
|
-
* venv_path/bin/activate
|
220
|
+
* venv_path/bin/pip executable by owner?
|
221
|
+
* venv_path/bin/python executable by owner?
|
222
|
+
* venv_path/bin/activate readable by owner?
|
223
223
|
* 'export VIRTUAL_ENV' in venv_path/bin/activate?
|
224
224
|
|
225
225
|
## Contributing
|
@@ -15,9 +15,9 @@ module Serverspec::Type
|
|
15
15
|
# Test whether this appears to be a working venv
|
16
16
|
#
|
17
17
|
# Tests performed:
|
18
|
-
# - venv_path/bin/pip executable by
|
19
|
-
# - venv_path/bin/python executable by
|
20
|
-
# - venv_path/bin/activate
|
18
|
+
# - venv_path/bin/pip executable by owner?
|
19
|
+
# - venv_path/bin/python executable by owner?
|
20
|
+
# - venv_path/bin/activate readable by owner?
|
21
21
|
# - 'export VIRTUAL_ENV' in venv_path/bin/activate?
|
22
22
|
#
|
23
23
|
# @example
|
@@ -32,9 +32,9 @@ module Serverspec::Type
|
|
32
32
|
python_path = ::File.join(@name, 'bin', 'python')
|
33
33
|
act_path = ::File.join(@name, 'bin', 'activate')
|
34
34
|
cmd = "grep -q 'export VIRTUAL_ENV' #{act_path}"
|
35
|
-
@runner.check_file_is_executable(pip_path, '
|
36
|
-
@runner.check_file_is_executable(python_path, '
|
37
|
-
@runner.
|
35
|
+
@runner.check_file_is_executable(pip_path, 'owner') and
|
36
|
+
@runner.check_file_is_executable(python_path, 'owner') and
|
37
|
+
@runner.check_file_is_readable(act_path, 'owner') and
|
38
38
|
@runner.run_command(cmd).exit_status.to_i == 0
|
39
39
|
end
|
40
40
|
|
data/spec/types/http_get_spec.rb
CHANGED
@@ -54,7 +54,7 @@ describe 'http_get()' do
|
|
54
54
|
stub_const('ENV', ENV.to_hash.merge('TARGET_HOST' => 'myhost'))
|
55
55
|
conn = double
|
56
56
|
headers = double
|
57
|
-
expect(headers).to receive(:[]=).with(:user_agent,
|
57
|
+
expect(headers).to receive(:[]=).with(:user_agent, %r"Serverspec::Type::Http_Get/\d+\.\d+\.\d+ \(https://github.com/jantman/serverspec-extended-types\)")
|
58
58
|
expect(conn).to receive(:headers).and_return(headers)
|
59
59
|
expect(headers).to receive(:[]=).with(:Host, 'hostheader')
|
60
60
|
expect(conn).to receive(:headers).and_return(headers)
|
@@ -16,36 +16,36 @@ describe 'Serverspec::Type#virtualenv' do
|
|
16
16
|
context '#virtualenv?' do
|
17
17
|
it 'checks all files' do
|
18
18
|
v = virtualenv('/foo/bar')
|
19
|
-
expect(v.instance_variable_get(:@runner)).to receive(:check_file_is_executable).once.ordered.with('/foo/bar/bin/pip', '
|
20
|
-
expect(v.instance_variable_get(:@runner)).to receive(:check_file_is_executable).once.ordered.with('/foo/bar/bin/python', '
|
21
|
-
expect(v.instance_variable_get(:@runner)).to receive(:
|
19
|
+
expect(v.instance_variable_get(:@runner)).to receive(:check_file_is_executable).once.ordered.with('/foo/bar/bin/pip', 'owner').and_return(true)
|
20
|
+
expect(v.instance_variable_get(:@runner)).to receive(:check_file_is_executable).once.ordered.with('/foo/bar/bin/python', 'owner').and_return(true)
|
21
|
+
expect(v.instance_variable_get(:@runner)).to receive(:check_file_is_readable).once.ordered.with('/foo/bar/bin/activate', 'owner').and_return(true)
|
22
22
|
res = Specinfra::CommandResult.new({:stdout => '', :stderr => '', :exit_signal => nil, :exit_status => 0 })
|
23
23
|
expect(v.instance_variable_get(:@runner)).to receive(:run_command).once.ordered.with("grep -q 'export VIRTUAL_ENV' /foo/bar/bin/activate").and_return(res)
|
24
24
|
expect(v.virtualenv?).to eq true
|
25
25
|
end
|
26
26
|
it 'returns false with missing pip' do
|
27
27
|
v = virtualenv('/foo/bar')
|
28
|
-
expect(v.instance_variable_get(:@runner)).to receive(:check_file_is_executable).once.ordered.with('/foo/bar/bin/pip', '
|
28
|
+
expect(v.instance_variable_get(:@runner)).to receive(:check_file_is_executable).once.ordered.with('/foo/bar/bin/pip', 'owner').and_return(false)
|
29
29
|
expect(v.virtualenv?).to eq false
|
30
30
|
end
|
31
31
|
it 'returns false with missing python' do
|
32
32
|
v = virtualenv('/foo/bar')
|
33
|
-
expect(v.instance_variable_get(:@runner)).to receive(:check_file_is_executable).once.ordered.with('/foo/bar/bin/pip', '
|
34
|
-
expect(v.instance_variable_get(:@runner)).to receive(:check_file_is_executable).once.ordered.with('/foo/bar/bin/python', '
|
33
|
+
expect(v.instance_variable_get(:@runner)).to receive(:check_file_is_executable).once.ordered.with('/foo/bar/bin/pip', 'owner').and_return(true)
|
34
|
+
expect(v.instance_variable_get(:@runner)).to receive(:check_file_is_executable).once.ordered.with('/foo/bar/bin/python', 'owner').and_return(false)
|
35
35
|
expect(v.virtualenv?).to eq false
|
36
36
|
end
|
37
37
|
it 'returns false with missing activate' do
|
38
38
|
v = virtualenv('/foo/bar')
|
39
|
-
expect(v.instance_variable_get(:@runner)).to receive(:check_file_is_executable).once.ordered.with('/foo/bar/bin/pip', '
|
40
|
-
expect(v.instance_variable_get(:@runner)).to receive(:check_file_is_executable).once.ordered.with('/foo/bar/bin/python', '
|
41
|
-
expect(v.instance_variable_get(:@runner)).to receive(:
|
39
|
+
expect(v.instance_variable_get(:@runner)).to receive(:check_file_is_executable).once.ordered.with('/foo/bar/bin/pip', 'owner').and_return(true)
|
40
|
+
expect(v.instance_variable_get(:@runner)).to receive(:check_file_is_executable).once.ordered.with('/foo/bar/bin/python', 'owner').and_return(true)
|
41
|
+
expect(v.instance_variable_get(:@runner)).to receive(:check_file_is_readable).once.ordered.with('/foo/bar/bin/activate', 'owner').and_return(false)
|
42
42
|
expect(v.virtualenv?).to eq false
|
43
43
|
end
|
44
44
|
it 'returns false with invalid activate' do
|
45
45
|
v = virtualenv('/foo/bar')
|
46
|
-
expect(v.instance_variable_get(:@runner)).to receive(:check_file_is_executable).once.ordered.with('/foo/bar/bin/pip', '
|
47
|
-
expect(v.instance_variable_get(:@runner)).to receive(:check_file_is_executable).once.ordered.with('/foo/bar/bin/python', '
|
48
|
-
expect(v.instance_variable_get(:@runner)).to receive(:
|
46
|
+
expect(v.instance_variable_get(:@runner)).to receive(:check_file_is_executable).once.ordered.with('/foo/bar/bin/pip', 'owner').and_return(true)
|
47
|
+
expect(v.instance_variable_get(:@runner)).to receive(:check_file_is_executable).once.ordered.with('/foo/bar/bin/python', 'owner').and_return(true)
|
48
|
+
expect(v.instance_variable_get(:@runner)).to receive(:check_file_is_readable).once.ordered.with('/foo/bar/bin/activate', 'owner').and_return(true)
|
49
49
|
res = Specinfra::CommandResult.new({:stdout => '', :stderr => '', :exit_signal => nil, :exit_status => 254 })
|
50
50
|
expect(v.instance_variable_get(:@runner)).to receive(:run_command).once.ordered.with("grep -q 'export VIRTUAL_ENV' /foo/bar/bin/activate").and_return(res)
|
51
51
|
expect(v.virtualenv?).to eq false
|