specinfra 2.0.0.beta43 → 2.0.0.beta44
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/lib/specinfra/backend/ssh.rb +4 -1
- data/lib/specinfra/command/module/systemd.rb +11 -8
- data/lib/specinfra/runner.rb +5 -5
- data/lib/specinfra/version.rb +1 -1
- data/spec/command/module/systemd_spec.rb +5 -4
- data/spec/command/redhat7/service_spec.rb +10 -6
- data/wercker.yml +3 -3
- 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: 7e06e2085c8a22f674bc94c57c8915bb79029774
|
4
|
+
data.tar.gz: 07b5050a0cd064f0aa9a4a56a1258b2aae747bbb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d15fb703b1b5894fcbc5ab87ca8571482a0b06abd704d0a15a727e3d19c18c14976bf51017e558298a71d103dd1d20c2c83595ad25c8ac51d3ecdbf93313fc5
|
7
|
+
data.tar.gz: ac34fb786f096fd8024665dc8ee07b47e21ff591ada409d0a3a61a4a444c9d13a53a7a960cd098bc145bc9df9ab7e77458efb298d136ccaea1f24848897444a0
|
@@ -91,6 +91,7 @@ module Specinfra::Backend
|
|
91
91
|
stderr_data = ''
|
92
92
|
exit_status = nil
|
93
93
|
exit_signal = nil
|
94
|
+
retry_prompt = /^Sorry, try again/
|
94
95
|
|
95
96
|
if Specinfra.configuration.ssh.nil?
|
96
97
|
Specinfra.configuration.ssh = create_ssh
|
@@ -106,7 +107,9 @@ module Specinfra::Backend
|
|
106
107
|
channel.exec("#{command}") do |ch, success|
|
107
108
|
abort "FAILED: couldn't execute command (ssh.channel.exec)" if !success
|
108
109
|
channel.on_data do |ch, data|
|
109
|
-
if data.match
|
110
|
+
if data.match retry_prompt
|
111
|
+
abort 'Wrong sudo password! Please confirm your password.'
|
112
|
+
elsif data.match /^#{prompt}/
|
110
113
|
channel.send_data "#{Specinfra.configuration.sudo_password}\n"
|
111
114
|
else
|
112
115
|
stdout_data += data
|
@@ -3,35 +3,38 @@ module Specinfra::Command::Module::Systemd
|
|
3
3
|
if level.to_s =~ /^\d+$/
|
4
4
|
level = "runlevel#{level}.target"
|
5
5
|
end
|
6
|
+
unless service.include?('.')
|
7
|
+
service += '.service'
|
8
|
+
end
|
6
9
|
|
7
|
-
"systemctl --plain list-dependencies #{level} | grep '
|
10
|
+
"systemctl --plain list-dependencies #{level} | grep '\\(^\\| \\)#{escape(service)}$'"
|
8
11
|
end
|
9
12
|
|
10
13
|
def check_is_running(service)
|
11
|
-
"systemctl is-active #{escape(service)}
|
14
|
+
"systemctl is-active #{escape(service)}"
|
12
15
|
end
|
13
16
|
|
14
17
|
def enable(service)
|
15
|
-
"systemctl enable #{escape(service)}
|
18
|
+
"systemctl enable #{escape(service)}"
|
16
19
|
end
|
17
20
|
|
18
21
|
def disable(service)
|
19
|
-
"systemctl disable #{escape(service)}
|
22
|
+
"systemctl disable #{escape(service)}"
|
20
23
|
end
|
21
24
|
|
22
25
|
def start(service)
|
23
|
-
"systemctl start #{escape(service)}
|
26
|
+
"systemctl start #{escape(service)}"
|
24
27
|
end
|
25
28
|
|
26
29
|
def stop(service)
|
27
|
-
"systemctl stop #{escape(service)}
|
30
|
+
"systemctl stop #{escape(service)}"
|
28
31
|
end
|
29
32
|
|
30
33
|
def restart(service)
|
31
|
-
"systemctl restart #{escape(service)}
|
34
|
+
"systemctl restart #{escape(service)}"
|
32
35
|
end
|
33
36
|
|
34
37
|
def reload(service)
|
35
|
-
"systemctl reload #{escape(service)}
|
38
|
+
"systemctl reload #{escape(service)}"
|
36
39
|
end
|
37
40
|
end
|
data/lib/specinfra/runner.rb
CHANGED
@@ -4,16 +4,16 @@ module Specinfra
|
|
4
4
|
backend = Specinfra.backend
|
5
5
|
processor = Specinfra::Processor
|
6
6
|
|
7
|
-
if os.include?(:family)
|
8
|
-
if
|
7
|
+
if ! os.include?(:family) || os[:family] != 'windows'
|
8
|
+
if processor.respond_to?(meth)
|
9
|
+
processor.send(meth, *args)
|
10
|
+
elsif backend.respond_to?(meth)
|
9
11
|
backend.send(meth, *args)
|
10
12
|
else
|
11
13
|
run(meth, *args)
|
12
14
|
end
|
13
15
|
else
|
14
|
-
if
|
15
|
-
processor.send(meth, *args)
|
16
|
-
elsif backend.respond_to?(meth)
|
16
|
+
if backend.respond_to?(meth)
|
17
17
|
backend.send(meth, *args)
|
18
18
|
else
|
19
19
|
run(meth, *args)
|
data/lib/specinfra/version.rb
CHANGED
@@ -2,10 +2,11 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Specinfra::Command::Redhat::V7::Service do
|
4
4
|
let(:klass) { Specinfra::Command::Redhat::V7::Service }
|
5
|
-
it { expect(klass.check_is_enabled('httpd')).to eq "systemctl --plain list-dependencies multi-user.target | grep '
|
6
|
-
it { expect(klass.check_is_enabled('httpd', 'multi-user.target')).to eq "systemctl --plain list-dependencies multi-user.target | grep '
|
7
|
-
it { expect(klass.check_is_enabled('httpd', 3)).to eq "systemctl --plain list-dependencies runlevel3.target | grep '
|
8
|
-
it { expect(klass.check_is_enabled('httpd', '3')).to eq "systemctl --plain list-dependencies runlevel3.target | grep '
|
5
|
+
it { expect(klass.check_is_enabled('httpd')).to eq "systemctl --plain list-dependencies multi-user.target | grep '\\(^\\| \\)httpd.service$'" }
|
6
|
+
it { expect(klass.check_is_enabled('httpd', 'multi-user.target')).to eq "systemctl --plain list-dependencies multi-user.target | grep '\\(^\\| \\)httpd.service$'" }
|
7
|
+
it { expect(klass.check_is_enabled('httpd', 3)).to eq "systemctl --plain list-dependencies runlevel3.target | grep '\\(^\\| \\)httpd.service$'" }
|
8
|
+
it { expect(klass.check_is_enabled('httpd', '3')).to eq "systemctl --plain list-dependencies runlevel3.target | grep '\\(^\\| \\)httpd.service$'" }
|
9
|
+
it { expect(klass.check_is_enabled('sshd.socket')).to eq "systemctl --plain list-dependencies multi-user.target | grep '\\(^\\| \\)sshd.socket$'" }
|
9
10
|
end
|
10
11
|
|
11
12
|
|
@@ -4,25 +4,29 @@ property[:os] = nil
|
|
4
4
|
set :os, :family => 'redhat', :release => '7'
|
5
5
|
|
6
6
|
describe get_command(:enable_service, 'httpd') do
|
7
|
-
it { should eq 'systemctl enable httpd
|
7
|
+
it { should eq 'systemctl enable httpd' }
|
8
8
|
end
|
9
9
|
|
10
10
|
describe get_command(:disable_service, 'httpd') do
|
11
|
-
it { should eq 'systemctl disable httpd
|
11
|
+
it { should eq 'systemctl disable httpd' }
|
12
12
|
end
|
13
13
|
|
14
14
|
describe get_command(:start_service, 'httpd') do
|
15
|
-
it { should eq 'systemctl start httpd
|
15
|
+
it { should eq 'systemctl start httpd' }
|
16
16
|
end
|
17
17
|
|
18
18
|
describe get_command(:stop_service, 'httpd') do
|
19
|
-
it { should eq 'systemctl stop httpd
|
19
|
+
it { should eq 'systemctl stop httpd' }
|
20
20
|
end
|
21
21
|
|
22
22
|
describe get_command(:restart_service, 'httpd') do
|
23
|
-
it { should eq 'systemctl restart httpd
|
23
|
+
it { should eq 'systemctl restart httpd' }
|
24
24
|
end
|
25
25
|
|
26
26
|
describe get_command(:reload_service, 'httpd') do
|
27
|
-
it { should eq 'systemctl reload httpd
|
27
|
+
it { should eq 'systemctl reload httpd' }
|
28
|
+
end
|
29
|
+
|
30
|
+
describe get_command(:enable_service, 'sshd.socket') do
|
31
|
+
it { should eq 'systemctl enable sshd.socket' }
|
28
32
|
end
|
data/wercker.yml
CHANGED
@@ -28,7 +28,7 @@ build:
|
|
28
28
|
cwd: $WORKING_DIR
|
29
29
|
- script:
|
30
30
|
name: Run itamae
|
31
|
-
code: bundle exec
|
31
|
+
code: bundle exec itamae ssh --host centos65 --vagrant recipe.rb
|
32
32
|
cwd: $WORKING_DIR
|
33
33
|
- script:
|
34
34
|
name: Run vagrant reload centos65
|
@@ -44,7 +44,7 @@ build:
|
|
44
44
|
cwd: $WORKING_DIR
|
45
45
|
- script:
|
46
46
|
name: Run itamae
|
47
|
-
code: bundle exec
|
47
|
+
code: bundle exec itamae ssh --host centos70 --vagrant recipe.rb
|
48
48
|
cwd: $WORKING_DIR
|
49
49
|
- script:
|
50
50
|
name: Run vagrant reload centos70
|
@@ -60,7 +60,7 @@ build:
|
|
60
60
|
cwd: $WORKING_DIR
|
61
61
|
- script:
|
62
62
|
name: Run itamae
|
63
|
-
code: bundle exec
|
63
|
+
code: bundle exec itamae ssh --host ubuntu1404 --vagrant recipe.rb
|
64
64
|
cwd: $WORKING_DIR
|
65
65
|
- script:
|
66
66
|
name: Run vagrant reload ubuntu1404
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: specinfra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.
|
4
|
+
version: 2.0.0.beta44
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gosuke Miyashita
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-ssh
|