Skip to content

Commit

Permalink
👌 IMPROVE: Token update method
Browse files Browse the repository at this point in the history
  • Loading branch information
caiovfernandes committed Apr 16, 2023
1 parent c56bd73 commit 9662472
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/swap_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def main(BLUE_ENV_NAME, GREEN_ENV_NAME, S3_ARTIFACTS_BUCKET, BEANSTALK_APP_NAME,
print("Blue env URL: " + str(blue_env_url))


green_env_info, beanstalkclient = get_environment_information(beanstalkclient, boto_authenticated_client, GREEN_ENV_NAME)
green_env_info, beanstalkclient = get_environment_information(beanstalkclient, GREEN_ENV_NAME)
green_env_cname = green_env_info["Environments"][0]["CNAME"]

applications_response = get_ssm_parameter(ssm_client, BEANSTALK_APP_NAME)
Expand Down Expand Up @@ -53,7 +53,7 @@ def get_env_address(BLUE_CNAME_CONFIG_FILE, S3_ARTIFACTS_BUCKET, s3client):
blue_env_url = data["BlueEnvUrl"]
return blue_env_url

def get_environment_information(beanstalkclient, boto_authenticated_client, EnvName):
def get_environment_information(beanstalkclient, EnvName):
env_count = 0
env_count_for_credentials = 0

Expand All @@ -73,7 +73,8 @@ def get_environment_information(beanstalkclient, boto_authenticated_client, EnvN
env_count+=1
if env_count_for_credentials == 12:
print("Renewing security token...")
beanstalkclient = boto_authenticated_client.client("elasticbeanstalk", region_name="ap-southeast-2")
boto_client = aws_authentication.get_boto_client()
beanstalkclient = boto_client.client("elasticbeanstalk", region_name="ap-southeast-2")
env_count_for_credentials=0
else:
env_count_for_credentials+=1
Expand Down

0 comments on commit 9662472

Please sign in to comment.