From f8cd593c6ee65ff1bc85bfa7ad66fd02eff2a51f Mon Sep 17 00:00:00 2001 From: Brendan Moran Date: Tue, 11 Sep 2018 12:10:58 +0100 Subject: [PATCH] BUGFIX: Remove account management API calls Developer API keys don't have the privileges required to get information about their owners. To correct for this, remove user name reporting and use the API key `owner_id` directly. Fixes: IOTAUTH-1686 --- tools/device_management.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tools/device_management.py b/tools/device_management.py index 14733f2c02..7c4d16b856 100644 --- a/tools/device_management.py +++ b/tools/device_management.py @@ -85,15 +85,14 @@ def wrap_init(func): api_key = accounts.list_api_keys(filter={ 'key': getenv("MBED_CLOUD_SDK_API_KEY") }).next() - user = accounts.get_user(api_key.owner_id) certificates_owned = list(certs.list_certificates()) dev_cert_info = None for certif in certificates_owned: - if certif.type == "developer" and (certif.owner_id == user.id or + if certif.type == "developer" and (certif.owner_id == api_key.owner_id or certif.owner_id == api_key.id): dev_cert_info = certs.get_certificate(certif.id) - LOG.info("Found developer certificate onwed by %s named %s", - user.full_name, dev_cert_info.name) + LOG.info("Found developer certificate named %s", + dev_cert_info.name) break else: LOG.warning(