Class: SpecInfra::Command::AIX
- Inherits:
-
Base
- Object
- Base
- SpecInfra::Command::AIX
show all
- Defined in:
- lib/specinfra/command/aix.rb
Defined Under Namespace
Classes: NotImplementedError
Instance Method Summary
collapse
-
#check_access_by_user(file, user, access) ⇒ Object
-
#check_belonging_group(user, group) ⇒ Object
-
#check_enabled(service, level = nil) ⇒ Object
-
#check_gid(group, gid) ⇒ Object
-
#check_grouped(file, group) ⇒ Object
-
#check_home_directory(user, path_to_home) ⇒ Object
-
#check_installed(package, version) ⇒ Object
-
#check_listening(port) ⇒ Object
-
#check_login_shell(user, path_to_shell) ⇒ Object
-
#check_mode(file, mode) ⇒ Object
-
#check_owner(file, owner) ⇒ Object
-
#check_running(service) ⇒ Object
Methods inherited from Base
#check_authorized_key, #check_container, #check_cotainer_running, #check_cron_entry, #check_directory, #check_file, #check_file_contain, #check_file_contain_with_fixed_strings, #check_file_contain_with_regexp, #check_file_contain_within, #check_file_md5checksum, #check_file_sha256checksum, #check_group, #check_installed_by_cpan, #check_installed_by_gem, #check_installed_by_npm, #check_installed_by_pear, #check_installed_by_pecl, #check_installed_by_pip, #check_ipfilter_rule, #check_ipnat_rule, #check_iptables_rule, #check_ipv4_address, #check_kernel_module_loaded, #check_link, #check_listening_with_protocol, #check_mail_alias, #check_monitored_by_god, #check_monitored_by_monit, #check_mounted, #check_process, #check_reachable, #check_resolvable, #check_routing_table, #check_running_under_supervisor, #check_running_under_upstart, #check_selinux, #check_socket, #check_svcprop, #check_svcprops, #check_uid, #check_user, #check_yumrepo, #check_yumrepo_enabled, #check_zfs, #escape, #get_file_content, #get_mode, #get_package_version, #get_process
Instance Method Details
#check_access_by_user(file, user, access) ⇒ Object
6
7
8
|
# File 'lib/specinfra/command/aix.rb', line 6
def check_access_by_user(file, user, access)
"su -s sh -c \"test -#{access} #{file}\" #{user}"
end
|
#check_belonging_group(user, group) ⇒ Object
32
33
34
|
# File 'lib/specinfra/command/aix.rb', line 32
def check_belonging_group(user, group)
"lsuser -a groups #{escape(user)} | awk -F'=' '{print $2}'| sed -e 's/,/ /g' |grep -w -- #{escape(group)}"
end
|
#check_enabled(service, level = nil) ⇒ Object
10
11
12
|
# File 'lib/specinfra/command/aix.rb', line 10
def check_enabled(service,level=nil)
"lssrc -s #{escape(service)} | grep active"
end
|
#check_gid(group, gid) ⇒ Object
36
37
38
39
|
# File 'lib/specinfra/command/aix.rb', line 36
def check_gid(group, gid)
regexp = "^#{group}"
"cat etc/group | grep -w -- #{escape(regexp)} | cut -f 3 -d ':' | grep -w -- #{escape(gid)}"
end
|
#check_grouped(file, group) ⇒ Object
58
59
60
61
|
# File 'lib/specinfra/command/aix.rb', line 58
def check_grouped(file, group)
regexp = "^#{group}$"
"ls -al #{escape(file)} | awk '{print $4}' | grep -- #{escape(regexp)}"
end
|
#check_home_directory(user, path_to_home) ⇒ Object
45
46
47
|
# File 'lib/specinfra/command/aix.rb', line 45
def check_home_directory(user, path_to_home)
"lsuser -a home #{escape(user)} | awk -F'=' '{print $2}' | grep -w -- #{escape(path_to_home)}"
end
|
#check_installed(package, version) ⇒ Object
18
19
20
21
22
23
24
|
# File 'lib/specinfra/command/aix.rb', line 18
def check_installed(package,version)
if version
"lslpp -L #{escape(package)} | awk '{print $2}' | grep -w -- #{version}"
else
"lslpp -L #{escape(package)}"
end
end
|
#check_listening(port) ⇒ Object
26
27
28
29
30
|
# File 'lib/specinfra/command/aix.rb', line 26
def check_listening(port)
regexp = "*.#{port} "
"netstat -an -f inet | awk '{print $4}' | grep -- #{regexp}"
end
|
#check_login_shell(user, path_to_shell) ⇒ Object
41
42
43
|
# File 'lib/specinfra/command/aix.rb', line 41
def check_login_shell(user, path_to_shell)
"lsuser -a shell #{escape(user)} |awk -F'=' '{print $2}' | grep -w -- #{escape(path_to_shell)}"
end
|
#check_mode(file, mode) ⇒ Object
49
50
51
|
# File 'lib/specinfra/command/aix.rb', line 49
def check_mode(file, mode)
raise NotImplementedError.new
end
|
#check_owner(file, owner) ⇒ Object
53
54
55
56
|
# File 'lib/specinfra/command/aix.rb', line 53
def check_owner(file, owner)
regexp = "^#{owner}$"
"ls -al #{escape(file)} | awk '{print $3}' | grep -- #{escape(regexp)}"
end
|
#check_running(service) ⇒ Object
14
15
16
|
# File 'lib/specinfra/command/aix.rb', line 14
def check_running(service)
"ps -ef | grep -v grep | grep #{escape(service)}"
end
|