Treat xmlrpc error 504 differently

The error message for the error 504 reads:
<Fault 504: 'The name XXX is not a valid username. Either you misspelled
it, or the person has not registered for a ... Bugzilla ... account.'>
In other words, the request succeeded but the user does not exist. So
in those situation there are no reasons to keep on trying, it won't work
at the next attempt either.

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
This commit is contained in:
Pierre-Yves Chibon 2019-12-18 15:27:38 +01:00
parent ad98b9e294
commit 87cbf38a29

View file

@ -453,6 +453,10 @@ class BugzillaProxy:
self.server.editcomponent(data)
break
except Exception as e:
if isinstance(e, xmlrpc.client.Fault) and e.faultCode == 504:
if self.config['verbose']:
print(f" ERROR {e}")
raise
if i >= num_attempts - 1:
raise
if self.config['verbose']:
@ -523,6 +527,10 @@ class BugzillaProxy:
self.server.addcomponent(data)
break
except Exception as e:
if isinstance(e, xmlrpc.client.Fault) and e.faultCode == 504:
if self.config['verbose']:
print(f" ERROR {e}")
raise
if i >= num_attempts - 1:
raise
if self.config['verbose']: