mirror of
https://github.com/ansible/awx.git
synced 2026-10-30 06:13:24 -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")
|
payload.pop("is_system_auditor")
|
||||||
# Create gw user, then wait for controller sync
|
# Create gw user, then wait for controller sync
|
||||||
gw_user = gw_users_api.post(payload)
|
gw_user = gw_users_api.post(payload)
|
||||||
poll_until(
|
|
||||||
lambda: len(ctrl_users_api.get(username=gw_user.username).results) > 0,
|
def _get_synced_user():
|
||||||
interval=1,
|
results = ctrl_users_api.get(username=gw_user.username).results
|
||||||
timeout=30,
|
return results[0] if results else None
|
||||||
)
|
|
||||||
user = ctrl_users_api.get(username=gw_user.username).results.pop()
|
user = poll_until(_get_synced_user, interval=1, timeout=30)
|
||||||
user.json["password"] = payload.password
|
user.json["password"] = payload.password
|
||||||
self.update_identity(user)
|
self.update_identity(user)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user