Skip to content

Commit

Permalink
Minor fixes after review.
Browse files Browse the repository at this point in the history
  • Loading branch information
seriva committed Feb 17, 2022
1 parent e6b38af commit c3f91fa
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions cli/src/providers/any/APIProxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ def get_ips_for_feature(self, component_key):
return result

def login(self, env=None):
# Pass to match the interface of the 'any' provider APIProxy. For 'any' provider we don't need a login.
pass
2 changes: 2 additions & 0 deletions cli/src/providers/aws/APIProxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ def get_ips_for_feature(self, component_key):
return result

def login(self, env=None):
# Pass to match the interface of the 'aws' provider APIProxy. For 'was' provider we already login with
# key and secret when we create the BOTO3 session.
pass

def get_image_id(self, os_full_name):
Expand Down
8 changes: 4 additions & 4 deletions cli/src/providers/azure/APIProxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def login_sp(self, sp_data):
tenant = sp_data['tenant']
return self.run(self, f'az login --service-principal -u \'{appId}\' -p \'{password}\' --tenant \'{tenant}\'', False)

def set_active_subscribtion(self, subscription_id):
def set_active_subscription(self, subscription_id):
self.run(self, f'az account set --subscription {subscription_id}')

def get_active_subscribtion(self):
Expand Down Expand Up @@ -85,14 +85,14 @@ def login(self, env=None):
if not self.cluster_model.specification.cloud.use_service_principal:
# Account
subscription = self.login_account()
self.set_active_subscribtion(subscription['id'])
self.set_active_subscription(subscription['id'])
else:
# Service principal
sp_file = os.path.join(get_terraform_path(self.cluster_model.specification.name), SP_FILE_NAME)
if not os.path.exists(sp_file):
# If no service principal exists or is defined we created one and for that we need to login using an account
subscription = self.login_account()
self.set_active_subscribtion(subscription['id'])
self.set_active_subscription(subscription['id'])

# Create the service principal, for now we use the default subscription
self.logger.info('Creating service principal')
Expand All @@ -111,7 +111,7 @@ def login(self, env=None):

if 'subscriptionId' in sp:
# Set active subscription if sp contains it.
self.set_active_subscribtion(sp['subscriptionId'])
self.set_active_subscription(sp['subscriptionId'])
env['ARM_SUBSCRIPTION_ID'] = sp['subscriptionId']
else:
# No subscriptionId in sp.yml so use the default one from Azure SP login.
Expand Down

0 comments on commit c3f91fa

Please sign in to comment.