Skip to content

Commit

Permalink
review changes
Browse files Browse the repository at this point in the history
Signed-off-by: Mahesh Shetty <[email protected]>
  • Loading branch information
mashetty330 committed Apr 10, 2024
1 parent daf5b84 commit 6f5cd9a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
14 changes: 9 additions & 5 deletions ocs_ci/ocs/resources/cloud_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
CommandFailed,
TimeoutExpiredError,
ResourceWrongStatusException,
ClusterNotInSTSModeException,
)
from ocs_ci.ocs.resources.rgw import RGW
from ocs_ci.utility import templating
Expand Down Expand Up @@ -103,11 +104,14 @@ def __init__(self):
setattr(self, "rgw_client", None)

# set the client for STS enabled cluster
role_arn = get_role_arn_from_sub()
cred_dict["AWS"]["ROLE_ARN"] = role_arn
setattr(
self, "aws_sts_client", cloud_map["AWS_STS"](auth_dict=cred_dict["AWS"])
)
try:
role_arn = get_role_arn_from_sub()
cred_dict["AWS"]["ROLE_ARN"] = role_arn
setattr(
self, "aws_sts_client", cloud_map["AWS_STS"](auth_dict=cred_dict["AWS"])
)
except ClusterNotInSTSModeException:
setattr(self, "aws_sts_client", None)


class CloudClient(ABC):
Expand Down
4 changes: 2 additions & 2 deletions ocs_ci/ocs/resources/cloud_uls.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ def cloud_uls_factory(request, cld_mgr):

try:
ulsMap["aws-sts"] = cld_mgr.aws_sts_client
except Exception:
log.info("Cluster is not deployed STS mode")
except AttributeError:
log.warning("Cluster is not deployed STS mode")

def _create_uls(uls_dict):
"""
Expand Down
7 changes: 7 additions & 0 deletions ocs_ci/utility/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4745,6 +4745,13 @@ def get_role_arn_from_sub():
"""
Get the RoleARN from the OCS subscription
Returns:
role_arn (str): Role ARN used for ODF deployment
Raises:
ClusterNotInSTSModeException (Exception) if cluster
not in STS mode
"""
from ocs_ci.ocs.ocp import OCP

Expand Down

0 comments on commit 6f5cd9a

Please sign in to comment.