-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
related to jira ticket: RHOAIENG-2683
- Loading branch information
Showing
5 changed files
with
134 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,23 @@ | ||
from logging import log | ||
from time import sleep | ||
|
||
from logger import log | ||
from util import execute_command | ||
|
||
|
||
def aws_configure(aws_access_key_id, aws_secret_access_key, aws_region): | ||
""" | ||
Runs aws configure and set the configuration required | ||
for OpenShift/ROSA Installation | ||
""" | ||
cmd_aws_configure_key_id = [ | ||
"aws", | ||
"configure", | ||
"set", | ||
"default.aws_access_key_id", | ||
aws_access_key_id, | ||
] | ||
ret = execute_command(" ".join(cmd_aws_configure_key_id)) | ||
def aws_configure_execute_cmd(aws_key, aws_value, aws_profile): | ||
aws_configure_cmd = ["aws", "configure", "set", aws_key, aws_value, "--profile", aws_profile] | ||
ret = execute_command(" ".join(aws_configure_cmd)) | ||
if ret is None: | ||
print("Failed to configure aws_access_key_id") | ||
log.error(f"Failed to configure {aws_key}") | ||
return ret | ||
sleep(1) | ||
|
||
cmd_aws_configure_access_id = [ | ||
"aws", | ||
"configure", | ||
"set", | ||
"default.aws_secret_access_key", | ||
aws_secret_access_key, | ||
] | ||
ret = execute_command(" ".join(cmd_aws_configure_access_id)) | ||
if ret is None: | ||
print("Failed to configure aws_secret_access_key") | ||
return ret | ||
sleep(1) | ||
|
||
cmd_aws_configure_region = ["aws", "configure", "set", "default.region", aws_region] | ||
ret = execute_command(" ".join(cmd_aws_configure_region)) | ||
if ret is None: | ||
print("Failed to configure region") | ||
return ret | ||
def aws_configure(aws_access_key_id, aws_secret_access_key, aws_region, aws_profile="default"): | ||
""" | ||
Runs aws configure and set the configuration required | ||
for OpenShift/ROSA Installation | ||
""" | ||
aws_configure_execute_cmd(aws_key="aws_access_key_id", aws_value=aws_access_key_id, aws_profile=aws_profile) | ||
aws_configure_execute_cmd(aws_key="aws_secret_access_key", aws_value=aws_secret_access_key, aws_profile=aws_profile) | ||
aws_configure_execute_cmd(aws_key="region", aws_value=aws_region, aws_profile=aws_profile) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.