Closed sspans-sbp closed 1 year ago
Not sure what's the best solution here, can the credential_type variable be replaced?
LOGGER.warning('Could not dynamically load credential with type : "%s", trying a generic one.',
credential_type)
Assuming that the get_credential_type_by_id
is well behaved, then we can check at line 198 if we actually have a value before we try to do stuff to it.
Do you mind giving https://github.com/schubergphilis/towerlib/tree/fix-unboundlocalerror a spin?
If run the diff with the code with that crashed and it works fine.
Unfortunately I cannot seem to reproduce the exact edge-case reliably - but this seems like a reasonable solution for the issue. I'll pull in the new version once relased and will let it run for a while with a production workload.
Should be fixed by v3.13.1 uploaded a short while ago.
The exception message in Credential.new uses a variable 'credential_type' defined in the try block. Depending on the behaviour of the remote AWX the following UnboundLocalError might be triggered.