specinfra 2.0.0.beta35 → 2.0.0.beta36
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/Guardfile +7 -0
- data/lib/specinfra/command/debian/base/service.rb +24 -0
- data/lib/specinfra/command/module/systemd.rb +24 -0
- data/lib/specinfra/command/redhat/base/service.rb +24 -0
- data/lib/specinfra/version.rb +1 -1
- data/spec/command/base/file_spec.rb +10 -10
- data/spec/command/debian/service_spec.rb +28 -0
- data/spec/command/redhat/package_spec.rb +1 -6
- data/spec/command/redhat/service_spec.rb +28 -0
- data/spec/command/redhat7/service_spec.rb +28 -0
- data/spec/spec_helper.rb +8 -0
- metadata +9 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af4e9534f7f0e39334a2255ab3931672f60a80f2
|
4
|
+
data.tar.gz: 742320224632984f59121b7108a5b853852af593
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca7d998b0d7ef863090aac55ef8434476145cb8f0a8898ffdf71225336bfeb78f0d641d78f75fdae2ae90cba8d812a83e330b653fb1b8f1f1d613acb7ff4b33a
|
7
|
+
data.tar.gz: d8a7df7ee934b4d9eb8aa8f0083406774c990898ec824ea284595b7a2ed70adb1d754d10b4e1494ba59e225047d4cd7249569cc514ca3bb28681842d7f4fb4ca
|
data/Guardfile
ADDED
@@ -4,5 +4,29 @@ class Specinfra::Command::Debian::Base::Service < Specinfra::Command::Linux::Bas
|
|
4
4
|
# Until everything uses Upstart, this needs an OR.
|
5
5
|
"ls /etc/rc#{level}.d/ | grep -- '^S..#{escape(service)}' || grep 'start on' /etc/init/#{escape(service)}.conf"
|
6
6
|
end
|
7
|
+
|
8
|
+
def enable(service)
|
9
|
+
"update-rc.d #{escape(service)} defaults"
|
10
|
+
end
|
11
|
+
|
12
|
+
def disable(service)
|
13
|
+
"update-rc.d -f #{escape(service)} remove"
|
14
|
+
end
|
15
|
+
|
16
|
+
def start(service)
|
17
|
+
"service #{escape(service)} start"
|
18
|
+
end
|
19
|
+
|
20
|
+
def stop(service)
|
21
|
+
"service #{escape(service)} stop"
|
22
|
+
end
|
23
|
+
|
24
|
+
def restart(service)
|
25
|
+
"service #{escape(service)} restart"
|
26
|
+
end
|
27
|
+
|
28
|
+
def reload(service)
|
29
|
+
"service #{escape(service)} reload"
|
30
|
+
end
|
7
31
|
end
|
8
32
|
end
|
@@ -10,4 +10,28 @@ module Specinfra::Command::Module::Systemd
|
|
10
10
|
def check_is_running(service)
|
11
11
|
"systemctl is-active #{escape(service)}.service"
|
12
12
|
end
|
13
|
+
|
14
|
+
def enable(service)
|
15
|
+
"systemctl enable #{escape(service)}.service"
|
16
|
+
end
|
17
|
+
|
18
|
+
def disable(service)
|
19
|
+
"systemctl disable #{escape(service)}.service"
|
20
|
+
end
|
21
|
+
|
22
|
+
def start(service)
|
23
|
+
"systemctl start #{escape(service)}.service"
|
24
|
+
end
|
25
|
+
|
26
|
+
def stop(service)
|
27
|
+
"systemctl stop #{escape(service)}.service"
|
28
|
+
end
|
29
|
+
|
30
|
+
def restart(service)
|
31
|
+
"systemctl restart #{escape(service)}.service"
|
32
|
+
end
|
33
|
+
|
34
|
+
def reload(service)
|
35
|
+
"systemctl reload #{escape(service)}.service"
|
36
|
+
end
|
13
37
|
end
|
@@ -3,6 +3,30 @@ class Specinfra::Command::Redhat::Base::Service < Specinfra::Command::Linux::Bas
|
|
3
3
|
def check_is_enabled(service, level=3)
|
4
4
|
"chkconfig --list #{escape(service)} | grep #{level}:on"
|
5
5
|
end
|
6
|
+
|
7
|
+
def enable(service)
|
8
|
+
"chkconfig #{escape(service)} on"
|
9
|
+
end
|
10
|
+
|
11
|
+
def disable(service)
|
12
|
+
"chkconfig #{escape(service)} off"
|
13
|
+
end
|
14
|
+
|
15
|
+
def start(service)
|
16
|
+
"service #{escape(service)} start"
|
17
|
+
end
|
18
|
+
|
19
|
+
def stop(service)
|
20
|
+
"service #{escape(service)} stop"
|
21
|
+
end
|
22
|
+
|
23
|
+
def restart(service)
|
24
|
+
"service #{escape(service)} restart"
|
25
|
+
end
|
26
|
+
|
27
|
+
def reload(service)
|
28
|
+
"service #{escape(service)} reload"
|
29
|
+
end
|
6
30
|
end
|
7
31
|
end
|
8
32
|
|
data/lib/specinfra/version.rb
CHANGED
@@ -7,43 +7,43 @@ describe 'File related commands' do
|
|
7
7
|
property[:os_by_host] = nil
|
8
8
|
end
|
9
9
|
|
10
|
-
context
|
10
|
+
context get_command(:check_file_is_directory, '/tmp') do
|
11
11
|
it { should eq 'test -d /tmp' }
|
12
12
|
end
|
13
13
|
|
14
|
-
context
|
14
|
+
context get_command(:change_file_mode, '/tmp', '0644') do
|
15
15
|
it { should eq 'chmod 0644 /tmp' }
|
16
16
|
end
|
17
17
|
|
18
|
-
context
|
18
|
+
context get_command(:change_file_owner, '/tmp', 'root') do
|
19
19
|
it { should eq 'chown root /tmp' }
|
20
20
|
end
|
21
21
|
|
22
|
-
context
|
22
|
+
context get_command(:change_file_owner, '/tmp', 'root', 'root') do
|
23
23
|
it { should eq 'chown root:root /tmp' }
|
24
24
|
end
|
25
25
|
|
26
|
-
context
|
26
|
+
context get_command(:change_file_group, '/tmp', 'root') do
|
27
27
|
it { should eq 'chgrp root /tmp' }
|
28
28
|
end
|
29
29
|
|
30
|
-
context
|
30
|
+
context get_command(:create_file_as_directory, '/tmp') do
|
31
31
|
it { should eq 'mkdir -p /tmp' }
|
32
32
|
end
|
33
33
|
|
34
|
-
context
|
34
|
+
context get_command(:get_file_owner_user, '/tmp') do
|
35
35
|
it { should eq 'stat -c %U /tmp' }
|
36
36
|
end
|
37
37
|
|
38
|
-
context
|
38
|
+
context get_command(:get_file_owner_group, '/tmp') do
|
39
39
|
it { should eq 'stat -c %G /tmp' }
|
40
40
|
end
|
41
41
|
|
42
|
-
context
|
42
|
+
context get_command(:move_file, '/src', '/dest') do
|
43
43
|
it { should eq 'mv /src /dest' }
|
44
44
|
end
|
45
45
|
|
46
|
-
context
|
46
|
+
context get_command(:link_file_to, '/link', '/target') do
|
47
47
|
it { should eq 'ln -s /target /link' }
|
48
48
|
end
|
49
49
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
property[:os] = nil
|
4
|
+
set :os, :family => 'debian'
|
5
|
+
|
6
|
+
describe get_command(:enable_service, 'apache2') do
|
7
|
+
it { should eq 'update-rc.d apache2 defaults' }
|
8
|
+
end
|
9
|
+
|
10
|
+
describe get_command(:disable_service, 'apache2') do
|
11
|
+
it { should eq 'update-rc.d -f apache2 remove' }
|
12
|
+
end
|
13
|
+
|
14
|
+
describe get_command(:start_service, 'apache2') do
|
15
|
+
it { should eq 'service apache2 start' }
|
16
|
+
end
|
17
|
+
|
18
|
+
describe get_command(:stop_service, 'apache2') do
|
19
|
+
it { should eq 'service apache2 stop' }
|
20
|
+
end
|
21
|
+
|
22
|
+
describe get_command(:restart_service, 'apache2') do
|
23
|
+
it { should eq 'service apache2 restart' }
|
24
|
+
end
|
25
|
+
|
26
|
+
describe get_command(:reload_service, 'apache2') do
|
27
|
+
it { should eq 'service apache2 reload' }
|
28
|
+
end
|
@@ -1,12 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
property[:os] = nil
|
4
3
|
set :os, { :family => 'redhat' }
|
5
4
|
|
6
|
-
describe
|
7
|
-
after do
|
8
|
-
property[:os] = nil
|
9
|
-
end
|
10
|
-
|
5
|
+
describe get_command(:check_package_is_installed, 'httpd') do
|
11
6
|
it { should eq 'rpm -q httpd' }
|
12
7
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
property[:os] = nil
|
4
|
+
set :os, :family => 'redhat'
|
5
|
+
|
6
|
+
describe get_command(:enable_service, 'httpd') do
|
7
|
+
it { should eq 'chkconfig httpd on' }
|
8
|
+
end
|
9
|
+
|
10
|
+
describe get_command(:disable_service, 'httpd') do
|
11
|
+
it { should eq 'chkconfig httpd off' }
|
12
|
+
end
|
13
|
+
|
14
|
+
describe get_command(:start_service, 'httpd') do
|
15
|
+
it { should eq 'service httpd start' }
|
16
|
+
end
|
17
|
+
|
18
|
+
describe get_command(:stop_service, 'httpd') do
|
19
|
+
it { should eq 'service httpd stop' }
|
20
|
+
end
|
21
|
+
|
22
|
+
describe get_command(:restart_service, 'httpd') do
|
23
|
+
it { should eq 'service httpd restart' }
|
24
|
+
end
|
25
|
+
|
26
|
+
describe get_command(:reload_service, 'httpd') do
|
27
|
+
it { should eq 'service httpd reload' }
|
28
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
property[:os] = nil
|
4
|
+
set :os, :family => 'redhat', :release => '7'
|
5
|
+
|
6
|
+
describe get_command(:enable_service, 'httpd') do
|
7
|
+
it { should eq 'systemctl enable httpd.service' }
|
8
|
+
end
|
9
|
+
|
10
|
+
describe get_command(:disable_service, 'httpd') do
|
11
|
+
it { should eq 'systemctl disable httpd.service' }
|
12
|
+
end
|
13
|
+
|
14
|
+
describe get_command(:start_service, 'httpd') do
|
15
|
+
it { should eq 'systemctl start httpd.service' }
|
16
|
+
end
|
17
|
+
|
18
|
+
describe get_command(:stop_service, 'httpd') do
|
19
|
+
it { should eq 'systemctl stop httpd.service' }
|
20
|
+
end
|
21
|
+
|
22
|
+
describe get_command(:restart_service, 'httpd') do
|
23
|
+
it { should eq 'systemctl restart httpd.service' }
|
24
|
+
end
|
25
|
+
|
26
|
+
describe get_command(:reload_service, 'httpd') do
|
27
|
+
it { should eq 'systemctl reload httpd.service' }
|
28
|
+
end
|
data/spec/spec_helper.rb
CHANGED
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.beta36
|
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-08-
|
11
|
+
date: 2014-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-ssh
|
@@ -105,6 +105,7 @@ files:
|
|
105
105
|
- ".gitmodules"
|
106
106
|
- ".travis.yml"
|
107
107
|
- Gemfile
|
108
|
+
- Guardfile
|
108
109
|
- LICENSE.txt
|
109
110
|
- README.md
|
110
111
|
- Rakefile
|
@@ -323,10 +324,13 @@ files:
|
|
323
324
|
- spec/backend/exec/env_spec.rb
|
324
325
|
- spec/backend/ssh/build_command_spec.rb
|
325
326
|
- spec/command/base/file_spec.rb
|
327
|
+
- spec/command/debian/service_spec.rb
|
326
328
|
- spec/command/factory_spec.rb
|
327
329
|
- spec/command/module/systemd_spec.rb
|
328
330
|
- spec/command/redhat/interface_spec.rb
|
329
331
|
- spec/command/redhat/package_spec.rb
|
332
|
+
- spec/command/redhat/service_spec.rb
|
333
|
+
- spec/command/redhat7/service_spec.rb
|
330
334
|
- spec/configuration_spec.rb
|
331
335
|
- spec/helper/os_spec.rb
|
332
336
|
- spec/helper/properties_spec.rb
|
@@ -363,10 +367,13 @@ test_files:
|
|
363
367
|
- spec/backend/exec/env_spec.rb
|
364
368
|
- spec/backend/ssh/build_command_spec.rb
|
365
369
|
- spec/command/base/file_spec.rb
|
370
|
+
- spec/command/debian/service_spec.rb
|
366
371
|
- spec/command/factory_spec.rb
|
367
372
|
- spec/command/module/systemd_spec.rb
|
368
373
|
- spec/command/redhat/interface_spec.rb
|
369
374
|
- spec/command/redhat/package_spec.rb
|
375
|
+
- spec/command/redhat/service_spec.rb
|
376
|
+
- spec/command/redhat7/service_spec.rb
|
370
377
|
- spec/configuration_spec.rb
|
371
378
|
- spec/helper/os_spec.rb
|
372
379
|
- spec/helper/properties_spec.rb
|