|
|
@ -129,7 +129,7 @@ class AIXHardware(Hardware):
|
|
|
|
rc, out, err = self.module.run_command("/usr/sbin/lsattr -El sys0 -a fwversion")
|
|
|
|
rc, out, err = self.module.run_command("/usr/sbin/lsattr -El sys0 -a fwversion")
|
|
|
|
data = out.split()
|
|
|
|
data = out.split()
|
|
|
|
dmi_facts['firmware_version'] = data[1].strip('IBM,')
|
|
|
|
dmi_facts['firmware_version'] = data[1].strip('IBM,')
|
|
|
|
lsconf_path = self.module.get_bin_path("lsconf")
|
|
|
|
lsconf_path = self.module.get_bin_path("lsconf", warning="dmi facts skipped")
|
|
|
|
if lsconf_path:
|
|
|
|
if lsconf_path:
|
|
|
|
rc, out, err = self.module.run_command(lsconf_path)
|
|
|
|
rc, out, err = self.module.run_command(lsconf_path)
|
|
|
|
if rc == 0 and out:
|
|
|
|
if rc == 0 and out:
|
|
|
@ -160,8 +160,9 @@ class AIXHardware(Hardware):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
vgs_facts = {}
|
|
|
|
vgs_facts = {}
|
|
|
|
lsvg_path = self.module.get_bin_path("lsvg")
|
|
|
|
warn = "vgs facts skipped"
|
|
|
|
xargs_path = self.module.get_bin_path("xargs")
|
|
|
|
lsvg_path = self.module.get_bin_path("lsvg", warning=warn)
|
|
|
|
|
|
|
|
xargs_path = self.module.get_bin_path("xargs", warning=warn)
|
|
|
|
cmd = "%s -o | %s %s -p" % (lsvg_path, xargs_path, lsvg_path)
|
|
|
|
cmd = "%s -o | %s %s -p" % (lsvg_path, xargs_path, lsvg_path)
|
|
|
|
if lsvg_path and xargs_path:
|
|
|
|
if lsvg_path and xargs_path:
|
|
|
|
rc, out, err = self.module.run_command(cmd, use_unsafe_shell=True)
|
|
|
|
rc, out, err = self.module.run_command(cmd, use_unsafe_shell=True)
|
|
|
@ -194,35 +195,36 @@ class AIXHardware(Hardware):
|
|
|
|
|
|
|
|
|
|
|
|
# AIX does not have mtab but mount command is only source of info (or to use
|
|
|
|
# AIX does not have mtab but mount command is only source of info (or to use
|
|
|
|
# api calls to get same info)
|
|
|
|
# api calls to get same info)
|
|
|
|
mount_path = self.module.get_bin_path('mount')
|
|
|
|
mount_path = self.module.get_bin_path('mount', warning="skipping mount facts")
|
|
|
|
rc, mount_out, err = self.module.run_command(mount_path)
|
|
|
|
if mount_path:
|
|
|
|
if mount_out:
|
|
|
|
rc, mount_out, err = self.module.run_command(mount_path)
|
|
|
|
for line in mount_out.split('\n'):
|
|
|
|
if mount_out:
|
|
|
|
fields = line.split()
|
|
|
|
for line in mount_out.split('\n'):
|
|
|
|
if len(fields) != 0 and fields[0] != 'node' and fields[0][0] != '-' and re.match('^/.*|^[a-zA-Z].*|^[0-9].*', fields[0]):
|
|
|
|
fields = line.split()
|
|
|
|
if re.match('^/', fields[0]):
|
|
|
|
if len(fields) != 0 and fields[0] != 'node' and fields[0][0] != '-' and re.match('^/.*|^[a-zA-Z].*|^[0-9].*', fields[0]):
|
|
|
|
# normal mount
|
|
|
|
if re.match('^/', fields[0]):
|
|
|
|
mount = fields[1]
|
|
|
|
# normal mount
|
|
|
|
mount_info = {'mount': mount,
|
|
|
|
mount = fields[1]
|
|
|
|
'device': fields[0],
|
|
|
|
mount_info = {'mount': mount,
|
|
|
|
'fstype': fields[2],
|
|
|
|
'device': fields[0],
|
|
|
|
'options': fields[6],
|
|
|
|
'fstype': fields[2],
|
|
|
|
'time': '%s %s %s' % (fields[3], fields[4], fields[5])}
|
|
|
|
'options': fields[6],
|
|
|
|
mount_info.update(get_mount_size(mount))
|
|
|
|
'time': '%s %s %s' % (fields[3], fields[4], fields[5])}
|
|
|
|
else:
|
|
|
|
mount_info.update(get_mount_size(mount))
|
|
|
|
# nfs or cifs based mount
|
|
|
|
else:
|
|
|
|
# in case of nfs if no mount options are provided on command line
|
|
|
|
# nfs or cifs based mount
|
|
|
|
# add into fields empty string...
|
|
|
|
# in case of nfs if no mount options are provided on command line
|
|
|
|
if len(fields) < 8:
|
|
|
|
# add into fields empty string...
|
|
|
|
fields.append("")
|
|
|
|
if len(fields) < 8:
|
|
|
|
|
|
|
|
fields.append("")
|
|
|
|
mount_info = {'mount': fields[2],
|
|
|
|
|
|
|
|
'device': '%s:%s' % (fields[0], fields[1]),
|
|
|
|
mount_info = {'mount': fields[2],
|
|
|
|
'fstype': fields[3],
|
|
|
|
'device': '%s:%s' % (fields[0], fields[1]),
|
|
|
|
'options': fields[7],
|
|
|
|
'fstype': fields[3],
|
|
|
|
'time': '%s %s %s' % (fields[4], fields[5], fields[6])}
|
|
|
|
'options': fields[7],
|
|
|
|
|
|
|
|
'time': '%s %s %s' % (fields[4], fields[5], fields[6])}
|
|
|
|
mounts.append(mount_info)
|
|
|
|
|
|
|
|
|
|
|
|
mounts.append(mount_info)
|
|
|
|
|
|
|
|
|
|
|
|
mount_facts['mounts'] = mounts
|
|
|
|
mount_facts['mounts'] = mounts
|
|
|
|
|
|
|
|
|
|
|
@ -232,30 +234,32 @@ class AIXHardware(Hardware):
|
|
|
|
device_facts = {}
|
|
|
|
device_facts = {}
|
|
|
|
device_facts['devices'] = {}
|
|
|
|
device_facts['devices'] = {}
|
|
|
|
|
|
|
|
|
|
|
|
lsdev_cmd = self.module.get_bin_path('lsdev', True)
|
|
|
|
warn = 'device facts are skipped'
|
|
|
|
lsattr_cmd = self.module.get_bin_path('lsattr', True)
|
|
|
|
lsdev_cmd = self.module.get_bin_path('lsdev', warning=warn)
|
|
|
|
rc, out_lsdev, err = self.module.run_command(lsdev_cmd)
|
|
|
|
lsattr_cmd = self.module.get_bin_path('lsattr', warning=warn)
|
|
|
|
|
|
|
|
if lsdev_cmd and lsattr_cmd:
|
|
|
|
for line in out_lsdev.splitlines():
|
|
|
|
rc, out_lsdev, err = self.module.run_command(lsdev_cmd)
|
|
|
|
field = line.split()
|
|
|
|
|
|
|
|
|
|
|
|
for line in out_lsdev.splitlines():
|
|
|
|
device_attrs = {}
|
|
|
|
field = line.split()
|
|
|
|
device_name = field[0]
|
|
|
|
|
|
|
|
device_state = field[1]
|
|
|
|
device_attrs = {}
|
|
|
|
device_type = field[2:]
|
|
|
|
device_name = field[0]
|
|
|
|
lsattr_cmd_args = [lsattr_cmd, '-E', '-l', device_name]
|
|
|
|
device_state = field[1]
|
|
|
|
rc, out_lsattr, err = self.module.run_command(lsattr_cmd_args)
|
|
|
|
device_type = field[2:]
|
|
|
|
for attr in out_lsattr.splitlines():
|
|
|
|
lsattr_cmd_args = [lsattr_cmd, '-E', '-l', device_name]
|
|
|
|
attr_fields = attr.split()
|
|
|
|
rc, out_lsattr, err = self.module.run_command(lsattr_cmd_args)
|
|
|
|
attr_name = attr_fields[0]
|
|
|
|
for attr in out_lsattr.splitlines():
|
|
|
|
attr_parameter = attr_fields[1]
|
|
|
|
attr_fields = attr.split()
|
|
|
|
device_attrs[attr_name] = attr_parameter
|
|
|
|
attr_name = attr_fields[0]
|
|
|
|
|
|
|
|
attr_parameter = attr_fields[1]
|
|
|
|
device_facts['devices'][device_name] = {
|
|
|
|
device_attrs[attr_name] = attr_parameter
|
|
|
|
'state': device_state,
|
|
|
|
|
|
|
|
'type': ' '.join(device_type),
|
|
|
|
device_facts['devices'][device_name] = {
|
|
|
|
'attributes': device_attrs
|
|
|
|
'state': device_state,
|
|
|
|
}
|
|
|
|
'type': ' '.join(device_type),
|
|
|
|
|
|
|
|
'attributes': device_attrs
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return device_facts
|
|
|
|
return device_facts
|
|
|
|
|
|
|
|
|
|
|
|