Skip to content

Commit

Permalink
Merge pull request #8079 from bremoran/patch-3
Browse files Browse the repository at this point in the history
BUGFIX: Remove account management API calls from DM
  • Loading branch information
Cruz Monrreal committed Sep 12, 2018
2 parents 8d9e2e5 + 989f394 commit c6fef82
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions tools/device_management.py
Expand Up @@ -85,23 +85,22 @@ def inner(options):
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(
"Could not find developer certificate for this account."
" Generting a new developer certificate."
)
dev_cert_info = CertificatesAPI().add_developer_certificate(
"mbed-cli-auto {}".format(user.full_name),
"mbed-cli-auto {}".format(api_key.name),
description="cetificate auto-generated by Mbed CLI"
)
LOG.info("Writing developer certificate %s into c file "
Expand Down

0 comments on commit c6fef82

Please sign in to comment.