diff --git a/changelogs/fragments/fibre_channel_wwn_fact_solaris_minor.yaml b/changelogs/fragments/fibre_channel_wwn_fact_solaris_minor.yaml new file mode 100644 index 00000000000..ed482e62910 --- /dev/null +++ b/changelogs/fragments/fibre_channel_wwn_fact_solaris_minor.yaml @@ -0,0 +1,2 @@ +minor_changes: + - cosmetic change, simplify FC WWN facts gathering on Solaris diff --git a/lib/ansible/module_utils/facts/network/fc_wwn.py b/lib/ansible/module_utils/facts/network/fc_wwn.py index 4f6ca67fe99..9d9bfc5bc03 100644 --- a/lib/ansible/module_utils/facts/network/fc_wwn.py +++ b/lib/ansible/module_utils/facts/network/fc_wwn.py @@ -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')