Check to see if the env_role has been provisioned before disabling env_role in the csp

This commit is contained in:
leigh-mil
2019-12-03 16:19:33 -05:00
parent c501431719
commit 8330b4de24
2 changed files with 18 additions and 1 deletions

View File

@@ -105,7 +105,7 @@ class EnvironmentRoles(object):
def disable(cls, environment_role_id):
environment_role = EnvironmentRoles.get_by_id(environment_role_id)
if not environment_role.environment.is_pending:
if environment_role.csp_user_id and not environment_role.environment.is_pending:
credentials = environment_role.environment.csp_credentials
app.csp.cloud.disable_user(credentials, environment_role.csp_user_id)