From 732fe7bc7c1d7b1b4ad23d261066479b2b25cf5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Wed, 23 Aug 2017 09:32:01 +0200 Subject: [PATCH] Fixed calls to do_badger to use keyword arguments for role(s) - updated call to pass multiple roles at once - updated call to pass single role with keyword arg This requires Pillar 87afbc52f6c7d5eb63f0da745625d05b01e81783 --- cloud/__init__.py | 4 ++-- cloud/cli.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cloud/__init__.py b/cloud/__init__.py index db7b79d..daa64dd 100644 --- a/cloud/__init__.py +++ b/cloud/__init__.py @@ -111,8 +111,8 @@ class CloudExtension(PillarExtension): # Avoid infinite loops while we're changing the user's roles. service.signal_user_changed_role.disconnect(self._user_changed_role) try: - for role in linked_roles: - service.do_badger(action, role, user_id=user['_id']) + if linked_roles: + service.do_badger(action, roles=linked_roles, user_id=user['_id']) finally: service.signal_user_changed_role.connect(self._user_changed_role) diff --git a/cloud/cli.py b/cloud/cli.py index e94342c..ed450a7 100644 --- a/cloud/cli.py +++ b/cloud/cli.py @@ -71,7 +71,7 @@ def reconcile_subscribers(): action = 'grant' with lock: - service.do_badger(action, 'subscriber', user_id=user['_id']) + service.do_badger(action, role='subscriber', user_id=user['_id']) with concurrent.futures.ThreadPoolExecutor(max_workers=10) as executor: future_to_user = {executor.submit(do_user, idx, user): user