[cosmetic] solaris wwn fix (#55154)

* Solaris WWN parsing cosmetic fix (commit 924f5b5467)

* simplify module.run_command by removing use_unsafe_shell and remove calling of external grep

* add changelog fragment
This commit is contained in:
Anatoly Pugachev 2019-04-18 23:31:40 +03:00 committed by Brian Coca
parent afb5e02c19
commit 701cf25891
2 changed files with 8 additions and 5 deletions

View file

@ -0,0 +1,2 @@
minor_changes:
- cosmetic change, simplify FC WWN facts gathering on Solaris

View file

@ -46,19 +46,20 @@ class FcWwnInitiatorFactCollector(BaseFactCollector):
elif sys.platform.startswith('sunos'):
"""
on solaris 10 or solaris 11 should use `fcinfo hba-port`
on solaris 9, `prtconf -pv`
TBD (not implemented): on solaris 9 use `prtconf -pv`
"""
cmd = module.get_bin_path('fcinfo')
cmd = cmd + " hba-port | grep 'Port WWN'"
rc, fcinfo_out, err = module.run_command(cmd, use_unsafe_shell=True)
cmd = cmd + " hba-port"
rc, fcinfo_out, err = module.run_command(cmd)
"""
# fcinfo hba-port | grep "Port WWN"
HBA Port WWN: 10000090fa1658de
"""
if fcinfo_out:
for line in fcinfo_out.splitlines():
data = line.split(' ')
fc_facts['fibre_channel_wwn'].append(data[-1].rstrip())
if 'Port WWN' in line:
data = line.split(' ')
fc_facts['fibre_channel_wwn'].append(data[-1].rstrip())
elif sys.platform.startswith('aix'):
# get list of available fibre-channel devices (fcs)
cmd = module.get_bin_path('lsdev')