Class: Serverspec::Commands::Debian

Inherits:
Linux
  • Object
show all
Defined in:
lib/serverspec/commands/debian.rb

Instance Method Summary collapse

Methods inherited from Linux

#check_access_by_user, #check_iptables_rule, #check_kernel_module_loaded, #check_selinux, #get_interface_speed_of

Methods inherited from Base

#check_access_by_user, #check_authorized_key, #check_belonging_group, #check_cron_entry, #check_directory, #check_file, #check_file_contain, #check_file_contain_within, #check_file_md5checksum, #check_gid, #check_group, #check_grouped, #check_home_directory, #check_installed_by_gem, #check_installed_by_npm, #check_installed_by_pecl, #check_ipfilter_rule, #check_ipnat_rule, #check_iptables_rule, #check_kernel_module_loaded, #check_link, #check_listening, #check_login_shell, #check_mode, #check_mounted, #check_owner, #check_process, #check_reachable, #check_resolvable, #check_routing_table, #check_running_under_supervisor, #check_selinux, #check_socket, #check_svcprop, #check_svcprops, #check_uid, #check_user, #check_yumrepo, #check_yumrepo_enabled, #check_zfs, #escape, #get_mode

Instance Method Details

#check_enabled(service, level = 3) ⇒ Object



4
5
6
7
# File 'lib/serverspec/commands/debian.rb', line 4

def check_enabled(service, level=3)
  # Until everything uses Upstart, this needs an OR.
  "ls /etc/rc#{level}.d/ | grep -- #{escape(service)} || grep 'start on' /etc/init/#{escape(service)}.conf"      
end

#check_installed(package, version = nil) ⇒ Object



9
10
11
12
# File 'lib/serverspec/commands/debian.rb', line 9

def check_installed(package, version=nil)
  escaped_package = escape(package)
  "dpkg -s #{escaped_package} && ! dpkg -s #{escaped_package} | grep -E '^Status: .+ not-installed$'"
end

#check_running(service) ⇒ Object



14
15
16
17
# File 'lib/serverspec/commands/debian.rb', line 14

def check_running(service)
  # This is compatible with Debian >Jaunty and Ubuntu derivatives
  "service #{escape(service)} status | grep 'running'"
end