Module: Boris::Profiles::UNIX
- Includes:
- Structure
- Included in:
- Solaris
- Defined in:
- lib/boris/profiles/unix_core.rb
Instance Attribute Summary
Attributes included from Structure
#file_systems, #hardware, #hosted_shares, #installed_applications, #installed_patches, #installed_services, #local_user_groups, #network_id, #network_interfaces, #operating_system
Attributes included from Lumberjack
#logger
Class Method Summary
(collapse)
Instance Method Summary
(collapse)
Methods included from Structure
#file_system_template, #hosted_share_template, #installed_application_template, #installed_patch_template, #installed_service_template, #local_user_groups_template, #network_interface_template, #scrub_data!
Methods included from Lumberjack
#debug, #error, #fatal, #info, #warn
Class Method Details
+ (Object) connection_type
7
8
9
|
# File 'lib/boris/profiles/unix_core.rb', line 7
def self.connection_type
Boris::SSHConnector
end
|
+ (Boolean) matches_target?(connector)
11
12
13
|
# File 'lib/boris/profiles/unix_core.rb', line 11
def self.matches_target?(connector)
return true if connector.value_at('uname -a') !~ /linux/i
end
|
Instance Method Details
- (Object) get_file_systems
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/boris/profiles/unix_core.rb', line 15
def get_file_systems
super
file_system_command = %q{df -kl 2>/dev/null | grep ^/ | nawk '{print $1 "|" $2 / 1024 "|" $3 / 1024 "|" $6}'}
@connector.values_at(file_system_command).each do |file_system|
h = file_system_template
file_system = file_system.split('|')
h[:capacity_mb] = file_system[1].to_i
h[:file_system] = file_system[0]
h[:mount_point] = file_system[3]
h[:used_space_mb] = file_system[2].to_i
@file_systems << h
end
end
|
- (Object) get_hardware
32
|
# File 'lib/boris/profiles/unix_core.rb', line 32
def get_hardware; super; end
|
- (Object) get_hosted_shares
33
|
# File 'lib/boris/profiles/unix_core.rb', line 33
def get_hosted_shares; super; end
|
- (Object) get_installed_applications
34
|
# File 'lib/boris/profiles/unix_core.rb', line 34
def get_installed_applications; super; end
|
- (Object) get_installed_patches
35
|
# File 'lib/boris/profiles/unix_core.rb', line 35
def get_installed_patches; super; end
|
- (Object) get_installed_services
36
|
# File 'lib/boris/profiles/unix_core.rb', line 36
def get_installed_services; super; end
|
- (Object) get_local_user_groups
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# File 'lib/boris/profiles/unix_core.rb', line 38
def get_local_user_groups
super
user_data = @connector.values_at('cat /etc/passwd | grep -v "^#"')
group_data = @connector.values_at('cat /etc/group | grep -v "^#"')
users = []
groups = []
user_data.each do |x|
h = {}
x = x.split(':')
h[:status] = nil
h[:primary_group_id] = x[3]
h[:username] = x[0]
users << h
end
group_data.each do |group|
group = group.split(':')
h = {:members=>[], :name=>group[0]}
h[:members] = users.select{|user| (user[:primary_group_id] == group[2])}.collect{|user| user[:username]}
@local_user_groups << h
end
end
|
- (Object) get_network_id
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
# File 'lib/boris/profiles/unix_core.rb', line 66
def get_network_id
super
hostname = @connector.value_at('hostname')
domain = @connector.value_at('domainname')
domain = nil if domain =~ /\(none\)/i
if hostname =~ /\./
hostname = hostname.split('.').shift
domain = hostname.join('.') if hostname =~ /\./
end
@network_id[:hostname] = hostname
@network_id[:domain] = domain
end
|
- (Object) get_network_interfaces
82
|
# File 'lib/boris/profiles/unix_core.rb', line 82
def get_network_interfaces; super; end
|
- (Object) get_operating_system
83
|
# File 'lib/boris/profiles/unix_core.rb', line 83
def get_operating_system; super; end
|