Class: Serverspec::Commands::Linux
- Inherits:
-
Base
- Object
- Base
- Serverspec::Commands::Linux
show all
- Defined in:
- lib/serverspec/commands/linux.rb
Instance Method Summary
collapse
Methods inherited from Base
#check_authorized_key, #check_belonging_group, #check_cron_entry, #check_directory, #check_enabled, #check_file, #check_file_contain, #check_file_contain_within, #check_file_md5checksum, #check_gid, #check_group, #check_grouped, #check_home_directory, #check_installed, #check_installed_by_gem, #check_installed_by_npm, #check_installed_by_pecl, #check_ipfilter_rule, #check_ipnat_rule, #check_link, #check_listening, #check_login_shell, #check_mode, #check_mounted, #check_owner, #check_process, #check_reachable, #check_resolvable, #check_routing_table, #check_running, #check_running_under_supervisor, #check_socket, #check_svcprop, #check_svcprops, #check_uid, #check_user, #check_yumrepo, #check_yumrepo_enabled, #check_zfs, #escape, #get_mode
Instance Method Details
#check_access_by_user(file, user, access) ⇒ Object
6
7
8
|
# File 'lib/serverspec/commands/linux.rb', line 6
def check_access_by_user(file, user, access)
"su -c \"test -#{access} #{file}\" #{user}"
end
|
#check_iptables_rule(rule, table = nil, chain = nil) ⇒ Object
10
11
12
13
14
15
16
17
|
# File 'lib/serverspec/commands/linux.rb', line 10
def check_iptables_rule(rule, table=nil, chain=nil)
cmd = "iptables"
cmd += " -t #{escape(table)}" if table
cmd += " -S"
cmd += " #{escape(chain)}" if chain
cmd += " | grep -- #{escape(rule)}"
cmd
end
|
#check_kernel_module_loaded(name) ⇒ Object
23
24
25
|
# File 'lib/serverspec/commands/linux.rb', line 23
def check_kernel_module_loaded(name)
"lsmod | grep ^#{name}"
end
|
#check_selinux(mode) ⇒ Object
19
20
21
|
# File 'lib/serverspec/commands/linux.rb', line 19
def check_selinux(mode)
"getenforce | grep -i -- #{escape(mode)} && grep -i -- ^SELINUX=#{escape(mode)}$ /etc/selinux/config"
end
|
#get_interface_speed_of(name) ⇒ Object
27
28
29
|
# File 'lib/serverspec/commands/linux.rb', line 27
def get_interface_speed_of(name)
"ethtool #{name} | grep Speed | gawk '{print gensub(/Speed: ([0-9]+)Mb\\\/s/,\"\\\\1\",\"\")}'"
end
|