mirror of
https://github.com/ansible/awx.git
synced 2026-10-29 22:03:20 -02:30
fix: eliminate race condition in awxkit gateway user sync (#16658)
fix: eliminate race condition in gateway user sync poll_until confirms the user exists in controller after gateway creation, but a second GET call could return empty results under load. Return the user directly from poll_until instead. Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
5499998506
commit
bbda905e00
@@ -42,12 +42,12 @@ class User(HasCreate, base.Base):
|
||||
payload.pop("is_system_auditor")
|
||||
# Create gw user, then wait for controller sync
|
||||
gw_user = gw_users_api.post(payload)
|
||||
poll_until(
|
||||
lambda: len(ctrl_users_api.get(username=gw_user.username).results) > 0,
|
||||
interval=1,
|
||||
timeout=30,
|
||||
)
|
||||
user = ctrl_users_api.get(username=gw_user.username).results.pop()
|
||||
|
||||
def _get_synced_user():
|
||||
results = ctrl_users_api.get(username=gw_user.username).results
|
||||
return results[0] if results else None
|
||||
|
||||
user = poll_until(_get_synced_user, interval=1, timeout=30)
|
||||
user.json["password"] = payload.password
|
||||
self.update_identity(user)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user