serverspec 2.0.0.beta19 → 2.0.0.beta20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/WINDOWS_SUPPORT.md +9 -13
- data/lib/serverspec/helper/type.rb +7 -9
- data/lib/serverspec/helper.rb +0 -2
- data/lib/serverspec/setup.rb +11 -7
- data/lib/serverspec/type/base.rb +15 -17
- data/lib/serverspec/type/cgroup.rb +13 -16
- data/lib/serverspec/type/command.rb +14 -17
- data/lib/serverspec/type/cron.rb +8 -9
- data/lib/serverspec/type/default_gateway.rb +14 -16
- data/lib/serverspec/type/file.rb +76 -78
- data/lib/serverspec/type/group.rb +7 -9
- data/lib/serverspec/type/host.rb +10 -12
- data/lib/serverspec/type/iis_app_pool.rb +40 -42
- data/lib/serverspec/type/iis_website.rb +28 -31
- data/lib/serverspec/type/interface.rb +10 -12
- data/lib/serverspec/type/ipfilter.rb +7 -9
- data/lib/serverspec/type/ipnat.rb +7 -9
- data/lib/serverspec/type/iptables.rb +7 -9
- data/lib/serverspec/type/kernel_module.rb +4 -6
- data/lib/serverspec/type/linux_kernel_parameter.rb +7 -9
- data/lib/serverspec/type/lxc.rb +10 -12
- data/lib/serverspec/type/mail_alias.rb +4 -6
- data/lib/serverspec/type/package.rb +48 -50
- data/lib/serverspec/type/php_config.rb +7 -9
- data/lib/serverspec/type/port.rb +28 -30
- data/lib/serverspec/type/ppa.rb +7 -9
- data/lib/serverspec/type/process.rb +20 -22
- data/lib/serverspec/type/routing_table.rb +7 -9
- data/lib/serverspec/type/selinux.rb +13 -17
- data/lib/serverspec/type/service.rb +24 -26
- data/lib/serverspec/type/user.rb +22 -30
- data/lib/serverspec/type/windows_feature.rb +4 -6
- data/lib/serverspec/type/windows_hot_fix.rb +4 -6
- data/lib/serverspec/type/windows_registry_key.rb +13 -15
- data/lib/serverspec/type/windows_scheduled_task.rb +4 -6
- data/lib/serverspec/type/yumrepo.rb +7 -9
- data/lib/serverspec/type/zfs.rb +10 -12
- data/lib/serverspec/version.rb +1 -1
- data/lib/serverspec.rb +2 -1
- data/spec/spec_helper.rb +2 -3
- data/spec/type/aix/group_spec.rb +0 -4
- data/spec/type/aix/package_spec.rb +0 -4
- data/spec/type/aix/port_spec.rb +12 -25
- data/spec/type/aix/service_spec.rb +0 -7
- data/spec/type/aix/user_spec.rb +0 -12
- data/spec/type/arch/file_spec.rb +0 -13
- data/spec/type/arch/package_spec.rb +0 -10
- data/spec/type/base/cron_spec.rb +0 -8
- data/spec/type/base/file_spec.rb +0 -53
- data/spec/type/base/group_spec.rb +0 -8
- data/spec/type/base/host_spec.rb +0 -20
- data/spec/type/base/mail_alias_spec.rb +0 -4
- data/spec/type/base/package_spec.rb +10 -38
- data/spec/type/base/port_spec.rb +19 -18
- data/spec/type/base/service_spec.rb +4 -29
- data/spec/type/base/user_spec.rb +0 -24
- data/spec/type/darwin/package_spec.rb +0 -8
- data/spec/type/darwin/port_spec.rb +17 -23
- data/spec/type/darwin/service_spec.rb +0 -12
- data/spec/type/debian/package_spec.rb +0 -12
- data/spec/type/debian/service_spec.rb +0 -8
- data/spec/type/freebsd/file_spec.rb +0 -16
- data/spec/type/freebsd/package_spec.rb +0 -8
- data/spec/type/freebsd/port_spec.rb +17 -23
- data/spec/type/freebsd/service_spec.rb +0 -4
- data/spec/type/freebsd10/package_spec.rb +0 -8
- data/spec/type/gentoo/package_spec.rb +0 -5
- data/spec/type/gentoo/service_spec.rb +0 -8
- data/spec/type/linux/file_spec.rb +0 -13
- data/spec/type/linux/iptables_spec.rb +0 -8
- data/spec/type/linux/kernel_module_spec.rb +0 -4
- data/spec/type/linux/lxc_container_spec.rb +0 -8
- data/spec/type/nixos/package_spec.rb +0 -12
- data/spec/type/openbsd/file_spec.rb +0 -30
- data/spec/type/openbsd/mail_alias_spec.rb +0 -4
- data/spec/type/openbsd/package_spec.rb +0 -9
- data/spec/type/openbsd/service_spec.rb +0 -7
- data/spec/type/openbsd/user_spec.rb +0 -8
- data/spec/type/opensuse/service_spec.rb +0 -12
- data/spec/type/plamo/package_spec.rb +0 -4
- data/spec/type/plamo/service_spec.rb +0 -4
- data/spec/type/redhat/file_spec.rb +0 -13
- data/spec/type/redhat/package_spec.rb +0 -12
- data/spec/type/redhat/service_spec.rb +0 -8
- data/spec/type/redhat/yumrepo_spec.rb +5 -19
- data/spec/type/redhat5/iptables_spec.rb +0 -8
- data/spec/type/smartos/package_spec.rb +0 -8
- data/spec/type/smartos/service_spec.rb +0 -12
- data/spec/type/solaris/cron_spec.rb +0 -8
- data/spec/type/solaris/file_spec.rb +0 -14
- data/spec/type/solaris/group_spec.rb +0 -4
- data/spec/type/solaris/host_spec.rb +3 -11
- data/spec/type/solaris/package_spec.rb +0 -4
- data/spec/type/solaris/port_spec.rb +23 -22
- data/spec/type/solaris/service_spec.rb +0 -12
- data/spec/type/solaris/user_spec.rb +0 -12
- data/spec/type/solaris10/file_spec.rb +0 -58
- data/spec/type/solaris10/group_spec.rb +0 -4
- data/spec/type/solaris10/host_spec.rb +2 -6
- data/spec/type/solaris10/package_spec.rb +0 -3
- data/spec/type/solaris10/user_spec.rb +0 -4
- data/spec/type/suse/package_spec.rb +0 -12
- data/spec/type/suse/service_spec.rb +0 -8
- data/spec/type/ubuntu/ppa_spec.rb +0 -8
- data/spec/type/ubuntu/service_spec.rb +0 -4
- data/spec/type/windows/feature_spec.rb +8 -0
- data/spec/type/windows/file_spec.rb +0 -36
- data/spec/type/windows/group_spec.rb +0 -4
- data/spec/type/windows/host_spec.rb +0 -20
- data/spec/type/windows/port_spec.rb +0 -4
- data/spec/type/windows/service_spec.rb +0 -8
- data/spec/type/windows/user_spec.rb +0 -8
- metadata +2 -5
- data/lib/serverspec/helper/properties.rb +0 -9
- data/spec/helper/properties_spec.rb +0 -11
@@ -1,43 +1,40 @@
|
|
1
|
-
module Serverspec
|
2
|
-
|
3
|
-
class IisWebsite < Base
|
1
|
+
module Serverspec::Type
|
2
|
+
class IisWebsite < Base
|
4
3
|
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
def exists?()
|
5
|
+
@runner.check_iis_website_is_installed(@name)
|
6
|
+
end
|
8
7
|
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
def enabled?()
|
9
|
+
@runner.check_iis_website_is_enabled(@name)
|
10
|
+
end
|
12
11
|
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
def running?()
|
13
|
+
@runner.check_iis_website_is_running(@name)
|
14
|
+
end
|
16
15
|
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
def in_app_pool?(app_pool)
|
17
|
+
@runner.check_iis_website_is_in_app_pool(@name, app_pool)
|
18
|
+
end
|
20
19
|
|
21
|
-
|
22
|
-
|
23
|
-
|
20
|
+
def has_physical_path?(path)
|
21
|
+
@runner.check_iis_website_has_physical_path(@name, path)
|
22
|
+
end
|
24
23
|
|
25
|
-
|
26
|
-
|
27
|
-
|
24
|
+
def has_site_bindings?(port, protocol, ipaddress, host_header)
|
25
|
+
@runner.check_iis_website_has_site_bindings(@name, port, protocol, ipaddress, host_header)
|
26
|
+
end
|
28
27
|
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
def has_virtual_dir?(vdir, path)
|
29
|
+
@runner.check_iis_website_has_virtual_dir(@name, vdir, path)
|
30
|
+
end
|
32
31
|
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
def has_site_application?(app, pool, physical_path)
|
33
|
+
@runner.check_iis_website_has_site_application(@name, app, pool, physical_path)
|
34
|
+
end
|
36
35
|
|
37
|
-
|
38
|
-
|
39
|
-
end
|
36
|
+
def to_s
|
37
|
+
%Q[IIS Website "#{@name}"]
|
40
38
|
end
|
41
39
|
end
|
42
40
|
end
|
43
|
-
|
@@ -1,16 +1,14 @@
|
|
1
|
-
module Serverspec
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
end
|
1
|
+
module Serverspec::Type
|
2
|
+
class Interface < Base
|
3
|
+
def speed
|
4
|
+
ret = @runner.get_interface_speed_of(@name)
|
5
|
+
val = ret.stdout.strip
|
6
|
+
val = val.to_i if val.match(/^\d+$/)
|
7
|
+
val
|
8
|
+
end
|
10
9
|
|
11
|
-
|
12
|
-
|
13
|
-
end
|
10
|
+
def has_ipv4_address?(ip_address)
|
11
|
+
@runner.check_interface_has_ipv4_address(@name, ip_address)
|
14
12
|
end
|
15
13
|
end
|
16
14
|
end
|
@@ -1,13 +1,11 @@
|
|
1
|
-
module Serverspec
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
end
|
1
|
+
module Serverspec::Type
|
2
|
+
class Ipfilter < Base
|
3
|
+
def has_rule?(rule)
|
4
|
+
@runner.check_ipfilter_has_rule(rule)
|
5
|
+
end
|
7
6
|
|
8
|
-
|
9
|
-
|
10
|
-
end
|
7
|
+
def to_s
|
8
|
+
'ipfilter'
|
11
9
|
end
|
12
10
|
end
|
13
11
|
end
|
@@ -1,13 +1,11 @@
|
|
1
|
-
module Serverspec
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
end
|
1
|
+
module Serverspec::Type
|
2
|
+
class Ipnat < Base
|
3
|
+
def has_rule?(rule)
|
4
|
+
@runner.check_ipnat_has_rule(rule)
|
5
|
+
end
|
7
6
|
|
8
|
-
|
9
|
-
|
10
|
-
end
|
7
|
+
def to_s
|
8
|
+
'ipnat'
|
11
9
|
end
|
12
10
|
end
|
13
11
|
end
|
@@ -1,13 +1,11 @@
|
|
1
|
-
module Serverspec
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
end
|
1
|
+
module Serverspec::Type
|
2
|
+
class Iptables < Base
|
3
|
+
def has_rule?(rule, table, chain)
|
4
|
+
@runner.check_iptables_has_rule(rule, table, chain)
|
5
|
+
end
|
7
6
|
|
8
|
-
|
9
|
-
|
10
|
-
end
|
7
|
+
def to_s
|
8
|
+
'iptables'
|
11
9
|
end
|
12
10
|
end
|
13
11
|
end
|
@@ -1,9 +1,7 @@
|
|
1
|
-
module Serverspec
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
@runner.check_kernel_module_is_loaded(@name)
|
6
|
-
end
|
1
|
+
module Serverspec::Type
|
2
|
+
class KernelModule < Base
|
3
|
+
def loaded?
|
4
|
+
@runner.check_kernel_module_is_loaded(@name)
|
7
5
|
end
|
8
6
|
end
|
9
7
|
end
|
@@ -1,12 +1,10 @@
|
|
1
|
-
module Serverspec
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
val
|
9
|
-
end
|
1
|
+
module Serverspec::Type
|
2
|
+
class LinuxKernelParameter < Base
|
3
|
+
def value
|
4
|
+
ret = @runner.run_command("/sbin/sysctl -q -n #{@name}")
|
5
|
+
val = ret.stdout.strip
|
6
|
+
val = val.to_i if val.match(/^\d+$/)
|
7
|
+
val
|
10
8
|
end
|
11
9
|
end
|
12
10
|
end
|
data/lib/serverspec/type/lxc.rb
CHANGED
@@ -1,17 +1,15 @@
|
|
1
|
-
module Serverspec
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
end
|
1
|
+
module Serverspec::Type
|
2
|
+
class Lxc < Base
|
3
|
+
def exists?
|
4
|
+
@runner.check_lxc_container_exists(@name)
|
5
|
+
end
|
7
6
|
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
def running?
|
8
|
+
@runner.check_lxc_container_is_running(@name)
|
9
|
+
end
|
11
10
|
|
12
|
-
|
13
|
-
|
14
|
-
end
|
11
|
+
def to_s
|
12
|
+
'LXC'
|
15
13
|
end
|
16
14
|
end
|
17
15
|
end
|
@@ -1,9 +1,7 @@
|
|
1
|
-
module Serverspec
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
@runner.check_mail_alias_is_aliased_to(@name, target)
|
6
|
-
end
|
1
|
+
module Serverspec::Type
|
2
|
+
class MailAlias < Base
|
3
|
+
def aliased_to?(target)
|
4
|
+
@runner.check_mail_alias_is_aliased_to(@name, target)
|
7
5
|
end
|
8
6
|
end
|
9
7
|
end
|
@@ -1,66 +1,64 @@
|
|
1
|
-
module Serverspec
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
@runner.send(check_method, @name, version)
|
10
|
-
end
|
1
|
+
module Serverspec::Type
|
2
|
+
class Package < Base
|
3
|
+
def installed?(provider, version)
|
4
|
+
if provider.nil?
|
5
|
+
@runner.check_package_is_installed(@name, version)
|
6
|
+
else
|
7
|
+
check_method = "check_package_is_installed_by_#{provider}".to_sym
|
8
|
+
@runner.send(check_method, @name, version)
|
11
9
|
end
|
10
|
+
end
|
12
11
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
end
|
12
|
+
def version
|
13
|
+
ret = @runner.get_package_version(@name).stdout.strip
|
14
|
+
if ret.empty?
|
15
|
+
nil
|
16
|
+
else
|
17
|
+
Version.new(ret)
|
20
18
|
end
|
19
|
+
end
|
21
20
|
|
22
|
-
|
23
|
-
|
21
|
+
class Version
|
22
|
+
include Comparable
|
24
23
|
|
25
|
-
|
24
|
+
attr_reader :epoch, :version
|
26
25
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
end
|
32
|
-
@epoch = matches[1].to_i
|
33
|
-
@version = matches[2].to_s
|
26
|
+
def initialize(val)
|
27
|
+
matches = val.match(/^(?:(\d+):)?(\d[0-9a-zA-Z.+:~-]*)$/)
|
28
|
+
if matches.nil?
|
29
|
+
raise ArgumentError, "Malformed version number string #{val}"
|
34
30
|
end
|
31
|
+
@epoch = matches[1].to_i
|
32
|
+
@version = matches[2].to_s
|
33
|
+
end
|
35
34
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
35
|
+
def <=>(other)
|
36
|
+
other = Version.new(other) if other.is_a?(String)
|
37
|
+
rv = @epoch <=> other.epoch
|
38
|
+
return rv if rv != 0
|
40
39
|
|
41
|
-
|
42
|
-
|
40
|
+
self.ver_array <=> other.ver_array
|
41
|
+
end
|
43
42
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
end
|
56
|
-
else
|
57
|
-
# Digits
|
58
|
-
res << matches[1].to_i
|
43
|
+
def ver_array
|
44
|
+
val = @version
|
45
|
+
re = /^(?:(\d+)|(\D+))(.*)$/
|
46
|
+
res = []
|
47
|
+
until val.empty?
|
48
|
+
matches = val.match(re)
|
49
|
+
if matches[1].nil?
|
50
|
+
# String
|
51
|
+
matches[2].to_s.each_byte do |b|
|
52
|
+
code_point = defined?("~".ord) ? "~".ord : ?~
|
53
|
+
res << ((b == code_point) ? -2 : b)
|
59
54
|
end
|
60
|
-
|
55
|
+
else
|
56
|
+
# Digits
|
57
|
+
res << matches[1].to_i
|
61
58
|
end
|
62
|
-
|
59
|
+
val = matches[3].to_s
|
63
60
|
end
|
61
|
+
res << -1
|
64
62
|
end
|
65
63
|
end
|
66
64
|
end
|
@@ -1,12 +1,10 @@
|
|
1
|
-
module Serverspec
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
val
|
9
|
-
end
|
1
|
+
module Serverspec::Type
|
2
|
+
class PhpConfig < Base
|
3
|
+
def value
|
4
|
+
ret = @runner.run_command("php -r 'echo get_cfg_var( \"#{@name}\" );'")
|
5
|
+
val = ret.stdout
|
6
|
+
val = val.to_i if val.match(/^\d+$/)
|
7
|
+
val
|
10
8
|
end
|
11
9
|
end
|
12
10
|
end
|
data/lib/serverspec/type/port.rb
CHANGED
@@ -1,42 +1,40 @@
|
|
1
1
|
require 'resolv'
|
2
2
|
|
3
|
-
module Serverspec
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
end
|
3
|
+
module Serverspec::Type
|
4
|
+
class Port < Base
|
5
|
+
def protocols
|
6
|
+
%w(udp tcp tcp6 udp6)
|
7
|
+
end
|
9
8
|
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
def options
|
10
|
+
@options ||= {}
|
11
|
+
end
|
13
12
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
end
|
13
|
+
def protocol_matcher(protocol)
|
14
|
+
protocol = protocol.to_s.downcase
|
15
|
+
if protocols.include?(protocol)
|
16
|
+
options[:protocol] = protocol
|
17
|
+
else
|
18
|
+
raise ArgumentError.new("`be_listening` matcher doesn't support #{protocol}")
|
21
19
|
end
|
20
|
+
end
|
22
21
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
end
|
22
|
+
def local_address_matcher(local_address)
|
23
|
+
if valid_ip_address?(local_address)
|
24
|
+
options[:local_address] = local_address
|
25
|
+
else
|
26
|
+
raise ArgumentError.new("`be_listening` matcher requires valid IPv4 or IPv6 address")
|
29
27
|
end
|
28
|
+
end
|
30
29
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
30
|
+
def listening?(protocol, local_address)
|
31
|
+
protocol_matcher(protocol) if protocol
|
32
|
+
local_address_matcher(local_address) if local_address
|
33
|
+
@runner.check_port_is_listening(@name, options)
|
34
|
+
end
|
36
35
|
|
37
|
-
|
38
|
-
|
39
|
-
end
|
36
|
+
def valid_ip_address?(ip_address)
|
37
|
+
!!(ip_address =~ Resolv::IPv4::Regex) || !!(ip_address =~ Resolv::IPv6::Regex)
|
40
38
|
end
|
41
39
|
end
|
42
40
|
end
|
data/lib/serverspec/type/ppa.rb
CHANGED
@@ -1,13 +1,11 @@
|
|
1
|
-
module Serverspec
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
end
|
1
|
+
module Serverspec::Type
|
2
|
+
class Ppa < Base
|
3
|
+
def exists?
|
4
|
+
@runner.check_ppa_exists(@name)
|
5
|
+
end
|
7
6
|
|
8
|
-
|
9
|
-
|
10
|
-
end
|
7
|
+
def enabled?
|
8
|
+
@runner.check_ppa_is_enabled(@name)
|
11
9
|
end
|
12
10
|
end
|
13
11
|
end
|
@@ -1,29 +1,27 @@
|
|
1
|
-
module Serverspec
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
end
|
1
|
+
module Serverspec::Type
|
2
|
+
class Process < Base
|
3
|
+
def running?
|
4
|
+
pid = @runner.get_process(@name, :format => "pid=").stdout
|
5
|
+
not pid.empty?
|
6
|
+
end
|
8
7
|
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
def user
|
9
|
+
get_column("user")
|
10
|
+
end
|
12
11
|
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
def group
|
13
|
+
get_column("group")
|
14
|
+
end
|
16
15
|
|
17
|
-
|
18
|
-
|
19
|
-
|
16
|
+
def method_missing(meth)
|
17
|
+
get_column(meth.to_s)
|
18
|
+
end
|
20
19
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
end
|
20
|
+
def get_column(keyword)
|
21
|
+
ret = @runner.get_process(@name, :format => "#{keyword}=")
|
22
|
+
val = ret.stdout.strip
|
23
|
+
val = val.to_i if val.match(/^\d+$/)
|
24
|
+
val
|
27
25
|
end
|
28
26
|
end
|
29
27
|
end
|
@@ -1,13 +1,11 @@
|
|
1
|
-
module Serverspec
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
end
|
1
|
+
module Serverspec::Type
|
2
|
+
class RoutingTable < Base
|
3
|
+
def has_entry?(entry)
|
4
|
+
@runner.check_routing_table_has_entry(entry)
|
5
|
+
end
|
7
6
|
|
8
|
-
|
9
|
-
|
10
|
-
end
|
7
|
+
def to_s
|
8
|
+
'Routing Table'
|
11
9
|
end
|
12
10
|
end
|
13
11
|
end
|
@@ -1,23 +1,19 @@
|
|
1
|
-
module Serverspec
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
end
|
1
|
+
module Serverspec::Type
|
2
|
+
class Selinux < Base
|
3
|
+
def disabled?
|
4
|
+
@runner.check_selinux_has_mode('disabled')
|
5
|
+
end
|
7
6
|
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
def enforcing?
|
8
|
+
@runner.check_selinux_has_mode('enforcing')
|
9
|
+
end
|
11
10
|
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
def permissive?
|
12
|
+
@runner.check_selinux_has_mode('permissive')
|
13
|
+
end
|
15
14
|
|
16
|
-
|
17
|
-
|
18
|
-
end
|
15
|
+
def to_s
|
16
|
+
'SELinux'
|
19
17
|
end
|
20
18
|
end
|
21
19
|
end
|
22
|
-
|
23
|
-
|
@@ -1,35 +1,33 @@
|
|
1
|
-
module Serverspec
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
end
|
1
|
+
module Serverspec::Type
|
2
|
+
class Service < Base
|
3
|
+
def enabled?(level=3)
|
4
|
+
@runner.check_service_is_enabled(@name, level)
|
5
|
+
end
|
7
6
|
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
def installed?(name, version)
|
8
|
+
@runner.check_service_is_installed(@name)
|
9
|
+
end
|
11
10
|
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
def has_start_mode?(mode)
|
12
|
+
@runner.check_service_has_start_mode(@name, mode)
|
13
|
+
end
|
15
14
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
end
|
15
|
+
def running?(under)
|
16
|
+
if under
|
17
|
+
check_method = "check_service_is_running_under_#{under}".to_sym
|
18
|
+
@runner.send(check_method, @name)
|
19
|
+
else
|
20
|
+
@runner.check_service_is_running(@name)
|
23
21
|
end
|
22
|
+
end
|
24
23
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
24
|
+
def monitored_by?(monitor)
|
25
|
+
check_method = "check_service_is_monitored_by_#{monitor}".to_sym
|
26
|
+
res = @runner.send(check_method, @name)
|
27
|
+
end
|
29
28
|
|
30
|
-
|
31
|
-
|
32
|
-
end
|
29
|
+
def has_property?(property)
|
30
|
+
@runner.check_service_has_property(@name, property)
|
33
31
|
end
|
34
32
|
end
|
35
33
|
end
|