Module: Boris::Profiles::Structure

Includes:
Lumberjack
Included in:
Linux, UNIX, Windows
Defined in:
lib/boris/structure.rb,
lib/boris/helpers/scrubber.rb

Instance Attribute Summary (collapse)

Attributes included from Lumberjack

#logger

Instance Method Summary (collapse)

Methods included from Lumberjack

#debug, #error, #fatal, #info, #warn

Instance Attribute Details

- (Object) file_systems

Returns the value of attribute file_systems



5
6
7
# File 'lib/boris/structure.rb', line 5

def file_systems
  @file_systems
end

- (Object) hardware

Returns the value of attribute hardware



6
7
8
# File 'lib/boris/structure.rb', line 6

def hardware
  @hardware
end

- (Object) hosted_shares

Returns the value of attribute hosted_shares



7
8
9
# File 'lib/boris/structure.rb', line 7

def hosted_shares
  @hosted_shares
end

- (Object) installed_applications

Returns the value of attribute installed_applications



8
9
10
# File 'lib/boris/structure.rb', line 8

def installed_applications
  @installed_applications
end

- (Object) installed_patches

Returns the value of attribute installed_patches



9
10
11
# File 'lib/boris/structure.rb', line 9

def installed_patches
  @installed_patches
end

- (Object) installed_services

Returns the value of attribute installed_services



10
11
12
# File 'lib/boris/structure.rb', line 10

def installed_services
  @installed_services
end

- (Object) local_user_groups

Returns the value of attribute local_user_groups



11
12
13
# File 'lib/boris/structure.rb', line 11

def local_user_groups
  @local_user_groups
end

- (Object) network_id

Returns the value of attribute network_id



12
13
14
# File 'lib/boris/structure.rb', line 12

def network_id
  @network_id
end

- (Object) network_interfaces

Returns the value of attribute network_interfaces



13
14
15
# File 'lib/boris/structure.rb', line 13

def network_interfaces
  @network_interfaces
end

- (Object) operating_system

Returns the value of attribute operating_system



14
15
16
# File 'lib/boris/structure.rb', line 14

def operating_system
  @operating_system
end

Instance Method Details

- (Object) file_system_template



16
17
18
19
20
21
22
23
24
# File 'lib/boris/structure.rb', line 16

def file_system_template
  [
    :capacity_mb,
    :file_system,
    :mount_point,
    :san_storage,
    :used_space_mb
  ].to_nil_hash
end

- (Object) get_file_systems



91
92
93
94
# File 'lib/boris/structure.rb', line 91

def get_file_systems
  debug 'preparing to fetch file systems'
  @file_systems = []
end

- (Object) get_hardware



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/boris/structure.rb', line 96

def get_hardware
  debug 'preparing to fetch hardware'
  @hardware = [
    :cpu_architecture,
    :cpu_core_count,
    :cpu_model,
    :cpu_physical_count,
    :cpu_speed_mhz,
    :cpu_vendor,
    :firmware_version,
    :model,
    :memory_installed_mb,
    :serial,
    :vendor
  ].to_nil_hash
end

- (Object) get_hosted_shares



113
114
115
116
# File 'lib/boris/structure.rb', line 113

def get_hosted_shares
  debug 'preparing to fetch hosted shares'
  @hosted_shares = []
end

- (Object) get_installed_applications



118
119
120
121
# File 'lib/boris/structure.rb', line 118

def get_installed_applications
  debug 'preparing to fetch installed applications'
  @installed_applications = []
end

- (Object) get_installed_patches



123
124
125
126
# File 'lib/boris/structure.rb', line 123

def get_installed_patches
  debug 'preparing to fetch installed patches'
  @installed_patches = []
end

- (Object) get_installed_services Also known as: get_installed_daemons



128
129
130
131
# File 'lib/boris/structure.rb', line 128

def get_installed_services
  debug 'preparing to fetch installed_services'
  @installed_services = []
end

- (Object) get_local_user_groups



133
134
135
136
# File 'lib/boris/structure.rb', line 133

def get_local_user_groups
  debug 'preparing to fetch users and groups'
  @local_user_groups = []
end

- (Object) get_network_id



138
139
140
141
142
143
144
# File 'lib/boris/structure.rb', line 138

def get_network_id
  debug 'preparing to fetch network id'
  @network_id = [
    :domain,
    :hostname
  ].to_nil_hash
end

- (Object) get_network_interfaces



146
147
148
149
# File 'lib/boris/structure.rb', line 146

def get_network_interfaces
  debug 'preparing to fetch network_interfaces'
  @network_interfaces = []
end

- (Object) get_operating_system



151
152
153
154
155
156
157
158
159
160
161
162
163
# File 'lib/boris/structure.rb', line 151

def get_operating_system
  debug 'preparing to fetch operating system'
  @operating_system = [
    :date_installed,
    :kernel,
    :license_key,
    :name,
    :service_pack,
    :version,
    :features=>[],
    :roles=>[]
  ].to_nil_hash
end

- (Object) hosted_share_template



26
27
28
29
30
31
# File 'lib/boris/structure.rb', line 26

def hosted_share_template
  [
    :name,
    :path
  ].to_nil_hash
end

- (Object) installed_application_template



33
34
35
36
37
38
39
40
41
42
# File 'lib/boris/structure.rb', line 33

def installed_application_template
  [
    :date_installed,
    :install_location,
    :license_key,
    :name,
    :vendor,
    :version
  ].to_nil_hash
end

- (Object) installed_patch_template



44
45
46
47
48
49
50
# File 'lib/boris/structure.rb', line 44

def installed_patch_template
  [
    :date_installed,
    :installed_by,
    :patch_code        
  ].to_nil_hash
end

- (Object) installed_service_template



52
53
54
55
56
57
58
# File 'lib/boris/structure.rb', line 52

def installed_service_template
  [
    :name,
    :install_location,
    :start_mode
  ].to_nil_hash
end

- (Object) local_user_groups_template



60
61
62
63
64
65
# File 'lib/boris/structure.rb', line 60

def local_user_groups_template
  {
    :group=>nil,
    :members=>[]
  }
end

- (Object) network_interface_template



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/boris/structure.rb', line 67

def network_interface_template
  [
    :auto_negotiate,
    :current_speed_mbps,
    :duplex,
    :fabric_name,
    :is_uplink,
    :mac_address,
    :model,
    :model_id,
    :mtu,
    :name,
    :node_wwn,
    :port_wwn,
    :remote_mac_address,
    :status,
    :type,
    :vendor,
    :vendor_id,
    :dns_servers=>[],
    :ip_addresses=>[]
  ].to_nil_hash
end

- (Object) scrub_data!



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/boris/helpers/scrubber.rb', line 3

def scrub_data!
  [ @file_systems,
    @hosted_shares,
    @installed_applications,
    @installed_patches,
    @installed_services,
    @local_user_groups,
    @network_interfaces
  ].each {|arr| arr.strip_string_values_in_array}
  debug 'string values from within data arrays cleaned up'

  [@hardware, @network_id, @operating_system].each {|h| h.strip_string_values_in_hash}
  debug 'string values from within data hashes cleaned up'

  @installed_applications.each do |app|
    app[:license_key].upcase! unless !app[:license_key]
    app[:name].string_clean
    app[:vendor].format_vendor unless !app[:vendor]
  end
  debug 'installed application data cleaned up'

  @network_id[:hostname].upcase!
  @network_id[:domain].downcase! unless !@network_id[:domain]
  debug 'network id data cleaned up'

  @network_interfaces.each do |interface|
    interface[:fabric_name].downcase! unless !interface[:fabric_name]
    interface[:mac_address].upcase! unless !interface[:mac_address]
    interface[:model] = interface[:model].format_model unless !interface[:model]
    interface[:node_wwn].downcase! unless !interface[:node_wwn]
    interface[:port_wwn].downcase! unless !interface[:port_wwn]
    interface[:remote_mac_address].upcase! unless !interface[:remote_mac_address]
    interface[:vendor] = interface[:vendor].format_vendor unless !interface[:vendor]
  end
  debug 'network interface data cleaned up'

  @hardware[:cpu_vendor] = @hardware[:cpu_vendor].string_clean.format_vendor unless !@hardware[:cpu_vendor]
  @hardware[:model] = @hardware[:model].format_model unless !@hardware[:model]
  @hardware[:serial].upcase! unless !@hardware[:serial]
  @hardware[:vendor] = @hardware[:vendor].string_clean.format_vendor unless !@hardware[:vendor]
  debug 'network interface data cleaned up'

  @operating_system[:license_key].upcase! unless !@operating_system[:license_key]
  debug 'operating system data cleaned up'

  debug 'data scrubbing complete'
end