Class: Serverspec::Commands::Solaris
- Inherits:
-
Base
- Object
- Base
- Serverspec::Commands::Solaris
show all
- Defined in:
- lib/serverspec/commands/solaris.rb
Instance Method Summary
collapse
Methods inherited from Base
#check_belonging_group, #check_directory, #check_file, #check_file_contain, #check_file_contain_within, #check_group, #check_grouped, #check_installed_by_gem, #check_iptables_rule, #check_link, #check_mode, #check_owner, #check_process, #check_running_under_supervisor, #check_user, #get_mode
Instance Method Details
#check_cron_entry(user, entry) ⇒ Object
20
21
22
23
|
# File 'lib/serverspec/commands/solaris.rb', line 20
def check_cron_entry user, entry
entry_escaped = entry.gsub(/\*/, '\\*')
"crontab -l #{user} | grep '#{entry_escaped}'"
end
|
#check_enabled(service) ⇒ Object
4
5
6
|
# File 'lib/serverspec/commands/solaris.rb', line 4
def check_enabled service
"svcs -l #{service} 2> /dev/null | grep 'enabled true'"
end
|
#check_installed(package) ⇒ Object
8
9
10
|
# File 'lib/serverspec/commands/solaris.rb', line 8
def check_installed package
"pkg list -H #{package} 2> /dev/null"
end
|
#check_ipfilter_rule(rule) ⇒ Object
37
38
39
|
# File 'lib/serverspec/commands/solaris.rb', line 37
def check_ipfilter_rule rule
"/sbin/ipfstat -io 2> /dev/null | grep '#{rule}'"
end
|
#check_ipnat_rule(rule) ⇒ Object
41
42
43
|
# File 'lib/serverspec/commands/solaris.rb', line 41
def check_ipnat_rule rule
"/sbin/ipnat -l 2> /dev/null | grep '^#{rule}$'"
end
|
#check_listening(port) ⇒ Object
12
13
14
|
# File 'lib/serverspec/commands/solaris.rb', line 12
def check_listening port
"netstat -an 2> /dev/null | egrep 'LISTEN|Idle' | grep '\.#{port} '"
end
|
#check_running(service) ⇒ Object
16
17
18
|
# File 'lib/serverspec/commands/solaris.rb', line 16
def check_running service
"svcs -l #{service} status 2> /dev/null |grep 'state online'"
end
|
#check_svcprop(svc, property, value) ⇒ Object
45
46
47
|
# File 'lib/serverspec/commands/solaris.rb', line 45
def check_svcprop svc, property, value
"svcprop -p #{property} #{svc} | grep ^#{value}$"
end
|
#check_svcprops(svc, property) ⇒ Object
49
50
51
52
53
54
55
|
# File 'lib/serverspec/commands/solaris.rb', line 49
def check_svcprops svc, property
commands = []
property.sort.each do |key, value|
commands << "svcprop -p #{key} #{svc} | grep ^#{value}$"
end
commands.join(' && ')
end
|
#check_zfs(zfs, property = nil) ⇒ Object
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/serverspec/commands/solaris.rb', line 25
def check_zfs zfs, property=nil
if property.nil?
"/sbin/zfs list -H #{zfs}"
else
commands = []
property.sort.each do |key, value|
commands << "/sbin/zfs list -H -o #{key} #{zfs} | grep ^#{value}$"
end
commands.join(' && ')
end
end
|