Sha256: 60a2ba376ef451c118763cf5d6e5feab8aebf5c942eea618e7fae1ef99e43bfa
Contents?: true
Size: 1.01 KB
Versions: 7
Compression:
Stored size: 1.01 KB
Contents
require 'shellwords' module Serverspec module Commands class Linux < Base def check_access_by_user(file, user, access) "su -c \"test -#{access} #{file}\" #{user}" end 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 def check_selinux(mode) cmd = "" cmd += "test ! -f /etc/selinux/config || (" if mode == "disabled" cmd += "getenforce | grep -i -- #{escape(mode)} " cmd += "&& grep -i -- ^SELINUX=#{escape(mode)}$ /etc/selinux/config" cmd += ")" if mode == "disabled" cmd end def check_kernel_module_loaded(name) "lsmod | grep ^#{name}" end def get_interface_speed_of(name) "ethtool #{name} | grep Speed | gawk '{print gensub(/Speed: ([0-9]+)Mb\\\/s/,\"\\\\1\",\"\")}'" end end end end
Version data entries
7 entries across 7 versions & 1 rubygems