Commit a59784a5 by Boris Manojlovic

don't use full path to command instead use module.get_bin_path

parent 0f4cf8cb
...@@ -2179,35 +2179,40 @@ class AIXNetwork(GenericBsdIfconfigNetwork, Network): ...@@ -2179,35 +2179,40 @@ class AIXNetwork(GenericBsdIfconfigNetwork, Network):
self.parse_inet6_line(words, current_if, ips) self.parse_inet6_line(words, current_if, ips)
else: else:
self.parse_unknown_line(words, current_if, ips) self.parse_unknown_line(words, current_if, ips)
uname_path = module.get_bin_path('uname')
rc, out, err = module.run_command(['/usr/bin/uname', '-W']) if uname_path:
# don't bother with wpars it does not work rc, out, err = module.run_command([uname_path, '-W'])
# zero means not in wpar # don't bother with wpars it does not work
if out.split()[0] == '0': # zero means not in wpar
if current_if['macaddress'] == 'unknown' and re.match('^en', current_if['device']): if out.split()[0] == '0':
rc, out, err = module.run_command(['/usr/bin/entstat', current_if['device'] ]) if current_if['macaddress'] == 'unknown' and re.match('^en', current_if['device']):
if rc != 0: entstat_path = module.get_bin_path('entstat')
break if entstat_path:
for line in out.split('\n'): rc, out, err = module.run_command([entstat_path, current_if['device'] ])
if not line: if rc != 0:
pass break
buff = re.match('^Hardware Address: (.*)', line) for line in out.split('\n'):
if buff: if not line:
current_if['macaddress'] = buff.group(1) pass
buff = re.match('^Hardware Address: (.*)', line)
buff = re.match('^Device Type:', line) if buff:
if buff and re.match('.*Ethernet', line): current_if['macaddress'] = buff.group(1)
current_if['type'] = 'ether'
# device must have mtu attribute in ODM buff = re.match('^Device Type:', line)
if 'mtu' not in current_if: if buff and re.match('.*Ethernet', line):
rc, out, err = module.run_command(['/usr/sbin/lsattr','-El', current_if['device'] ]) current_if['type'] = 'ether'
if rc != 0: # device must have mtu attribute in ODM
break if 'mtu' not in current_if:
for line in out.split('\n'): lsattr_path = module.get_bin_path('lsattr')
if line: if lsattr_path:
words = line.split() rc, out, err = module.run_command([lsattr_path,'-El', current_if['device'] ])
if words[0] == 'mtu': if rc != 0:
current_if['mtu'] = words[1] break
for line in out.split('\n'):
if line:
words = line.split()
if words[0] == 'mtu':
current_if['mtu'] = words[1]
return interfaces, ips return interfaces, ips
# AIX 'ifconfig -a' does not inform about MTU, so remove current_if['mtu'] here # AIX 'ifconfig -a' does not inform about MTU, so remove current_if['mtu'] here
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment