Skip to content

Commit

Permalink
FIX Azure#7135 - Fixing the output format
Browse files Browse the repository at this point in the history
  Issue is fixed for that particular command. But the issue might still
  be there for other commands.
  • Loading branch information
dbroeglin committed Dec 30, 2023
1 parent a0b8a52 commit c8b6c77
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ def __init__(self, cmd, target_id, target_type, auth_info, connection_name, skip
self.auth_type = auth_info['auth_type']
self.auth_info = auth_info
self.login_username = run_cli_cmd(
'az account show').get("user").get("name")
'az account show -o json').get("user").get("name")
self.login_usertype = run_cli_cmd(
'az account show').get("user").get("type") # servicePrincipal, user
'az account show -o json').get("user").get("type") # servicePrincipal, user
if (self.login_usertype not in ['servicePrincipal', 'user']):
e = CLIInternalError(
f'{self.login_usertype} is not supported. Please login as user or servicePrincipal')
Expand Down Expand Up @@ -654,15 +654,15 @@ def check_db_existence(self):

def enable_target_aad_auth(self):
target = run_cli_cmd(
'az postgres flexible-server show -g {} -n {} --subscription {}'.format(
'az postgres flexible-server show -g {} -n {} --subscription {} -o json'.format(
self.resource_group, self.db_server, self.subscription))
if target.get('authConfig').get('activeDirectoryAuth') == "Enabled":
return
run_cli_cmd('az postgres flexible-server update --ids {} --active-directory-auth Enabled'.format(
self.target_id))

def set_user_admin(self, user_object_id, **kwargs):
admins = run_cli_cmd('az postgres flexible-server ad-admin list -g {} -s {} --subscription {}'.format(
admins = run_cli_cmd('az postgres flexible-server ad-admin list -g {} -s {} --subscription {} -o json'.format(
self.resource_group, self.db_server, self.subscription))

if not user_object_id:
Expand Down Expand Up @@ -797,7 +797,7 @@ def create_aad_user_in_pg(self, conn_string, query_list):

def get_connection_string(self):
password = run_cli_cmd(
'az account get-access-token --resource-type oss-rdbms').get('accessToken')
'az account get-access-token --resource-type oss-rdbmsi -o json').get('accessToken')

# extension functions require the extension to be available, which is the case for postgres (default) database.
conn_string = "host={} user={} dbname=postgres password={} sslmode=require".format(
Expand Down Expand Up @@ -1046,14 +1046,14 @@ def get_identity_name(self):
def get_identity_pid(self):
logger.warning('Checking if Container App enables System Identity...')
identity = run_cli_cmd(
'az containerapp identity show --ids {}'.format(self.source_id))
'az containerapp identity show --ids {} -o json'.format(self.source_id))
if (identity is None or "SystemAssigned" not in identity.get('type')):
# assign system identity for spring-cloud
logger.warning('Enabling Container App System Identity...')
run_cli_cmd(
'az containerapp identity assign --ids {} --system-assigned'.format(self.source_id))
identity = run_cli_cmd(
'az containerapp identity show --ids {}'.format(self.source_id), 15, 5, output_is_none)
'az containerapp identity show --ids {} -o json'.format(self.source_id), 15, 5, output_is_none)

if identity is None:
ex = CLIInternalError(
Expand Down

0 comments on commit c8b6c77

Please sign in to comment.