mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
[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:
parent
afb5e02c19
commit
701cf25891
2 changed files with 8 additions and 5 deletions
|
@ -0,0 +1,2 @@
|
||||||
|
minor_changes:
|
||||||
|
- cosmetic change, simplify FC WWN facts gathering on Solaris
|
|
@ -46,19 +46,20 @@ class FcWwnInitiatorFactCollector(BaseFactCollector):
|
||||||
elif sys.platform.startswith('sunos'):
|
elif sys.platform.startswith('sunos'):
|
||||||
"""
|
"""
|
||||||
on solaris 10 or solaris 11 should use `fcinfo hba-port`
|
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 = module.get_bin_path('fcinfo')
|
||||||
cmd = cmd + " hba-port | grep 'Port WWN'"
|
cmd = cmd + " hba-port"
|
||||||
rc, fcinfo_out, err = module.run_command(cmd, use_unsafe_shell=True)
|
rc, fcinfo_out, err = module.run_command(cmd)
|
||||||
"""
|
"""
|
||||||
# fcinfo hba-port | grep "Port WWN"
|
# fcinfo hba-port | grep "Port WWN"
|
||||||
HBA Port WWN: 10000090fa1658de
|
HBA Port WWN: 10000090fa1658de
|
||||||
"""
|
"""
|
||||||
if fcinfo_out:
|
if fcinfo_out:
|
||||||
for line in fcinfo_out.splitlines():
|
for line in fcinfo_out.splitlines():
|
||||||
data = line.split(' ')
|
if 'Port WWN' in line:
|
||||||
fc_facts['fibre_channel_wwn'].append(data[-1].rstrip())
|
data = line.split(' ')
|
||||||
|
fc_facts['fibre_channel_wwn'].append(data[-1].rstrip())
|
||||||
elif sys.platform.startswith('aix'):
|
elif sys.platform.startswith('aix'):
|
||||||
# get list of available fibre-channel devices (fcs)
|
# get list of available fibre-channel devices (fcs)
|
||||||
cmd = module.get_bin_path('lsdev')
|
cmd = module.get_bin_path('lsdev')
|
||||||
|
|
Loading…
Reference in a new issue