carlospolop/PurplePanda

KeyError: 'displayName' error on GCP disc_sa.disc_sas

carlosmaroot opened this issue · 2 comments

For some reason the display name doesn't come in some cases an throw the following error:

Google disc_sa._disc_sas ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0% • 2 • 0:00:06 ⠹
Traceback (most recent call last):
File "/opt/PurplePanda/main.py", line 215, in
main()
File "/opt/PurplePanda/main.py", line 188, in main
PurplePanda().start_discovery(functions)
File "/opt/PurplePanda/core/utils/purplepanda.py", line 178, in start_discovery
t.result()
File "/usr/lib/python3.9/concurrent/futures/_base.py", line 439, in result
return self.__get_result()
File "/usr/lib/python3.9/concurrent/futures/_base.py", line 391, in __get_result
raise self._exception
File "/usr/lib/python3.9/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "/opt/PurplePanda/intel/google/purplepanda_google.py", line 70, in discover
DiscoverSaas(
File "/opt/PurplePanda/core/utils/discover_saas.py", line 17, in do_discovery
self._call_f(f)
File "/opt/PurplePanda/core/utils/discover_saas.py", line 39, in _call_f
func()
File "/opt/PurplePanda/core/utils/discover_saas.py", line 17, in do_discovery
self._call_f(f)
File "/opt/PurplePanda/core/utils/discover_saas.py", line 39, in _call_f
func()
File "/opt/PurplePanda/core/utils/purplepanda.py", line 52, in discover
self._disc()
File "/opt/PurplePanda/intel/google/discovery/disc_sa.py", line 24, in _disc
self._disc_loop(projects, self._disc_sas, name.split(".")[-1]+"._disc_sas")
File "/opt/PurplePanda/core/utils/purplepanda.py", line 64, in _disc_loop
func(item, **kwargs)
File "/opt/PurplePanda/intel/google/discovery/disc_sa.py", line 43, in _disc_sas
displayName = sa["displayName"],
KeyError: 'displayName'

I used this workaround to solve it.

replace line 44 on /PurplePanda/intel/google/discovery/disc_sa.py for:

            displayName = sa["displayName"] if "displayName" in sa.keys() else None,

thanks for letting me know! This should be fixed now