Skip to content

Commit

Permalink
review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
iakov-aws committed Jan 31, 2024
1 parent bfbf9a0 commit ea82b5b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
4 changes: 2 additions & 2 deletions cid/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,15 +245,15 @@ def init_qs(ctx, **kwargs):

@click.option('-v', '--verbose', count=True)
@cid_command
def init_cur(ctx, **kwargs):
def create_cur_table(ctx, **kwargs):
"""Initialize CUR table
\b
--view-cur-location s3://BUCKET/PATH S3 path with CUR data. We support only 2 types of CUR path: 's3://{bucket}/cur' and 's3://{bucket}/{prefix}/{cur_name}/{cur_name}'
--crawler-role ROLE Name or ARN of crawler role
"""

ctx.obj.init_cur(**kwargs)
ctx.obj.create_cur_table(**kwargs)

@click.option('-v', '--verbose', count=True)
@click.option('-y', '--yes', help='confirm all', is_flag=True, default=False)
Expand Down
6 changes: 3 additions & 3 deletions cid/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1663,9 +1663,9 @@ def create_or_update_crawler(self, crawler_name, location):
crawler_role = get_parameter(
'crawler-role',
message='Provide a crawler role name',
choices=glue_trusted_roles + ['<CREATE NEW>']
choices=glue_trusted_roles + ['CidCmdCurCrawlerRole <CREATE NEW>']
)
if crawler_role == '<CREATE NEW>':
if 'CREATE NEW' in crawler_role:
crawler_role = 'CidCmdCurCrawlerRole'
self.iam.ensure_role_for_crawler(
s3bucket=location.split('/')[2],
Expand Down Expand Up @@ -1760,7 +1760,7 @@ def init_qs(self, **kwargs):
return InitQsCommand(cid=self, **kwargs).execute()

@command
def init_cur(self, **kwargs):
def create_cur_table(self, **kwargs):
""" Initialize CUR """
if get_parameters().get('view-cur-location'):
s3path = get_parameters().get('view-cur-location')
Expand Down
6 changes: 6 additions & 0 deletions cid/helpers/iam.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
import boto3
from tqdm import tqdm

from cid.exceptions import CidCritical
from cid.base import CidBase
from cid.utils import get_parameter

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -242,6 +244,10 @@ def ensure_role_with_policy(self, role_name, assume_role_policy_document, permis
logger.info(f"No need to update '{policy_name}' the doc is the same as requested.")
else:
logger.debug(f'Updating policy {policy_arn} to {result_document}')
print(f'Updating policy {policy_arn} to :\n{json.dumps(result_document, indent=2)}')
if get_parameter(f'confirm-policy-{policy_name}', message='Please confirm', choices=['yes', 'no']) != 'yes':
raise CidCritical('User choose not to confirm challenge')

# A managed policy can have up to 5 versions.
# Before you create a new version, you must delete at least one existing version.
versions = self.client.list_policy_versions(PolicyArn=policy_arn)['Versions']
Expand Down
2 changes: 1 addition & 1 deletion cid/helpers/quicksight/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ def create_data_source(self, athena_workgroup, datasource_id: str=None, role_arn
create_status = self.client.create_data_source(**params)
logger.debug(f'Data source creation result {create_status}')
# Wait for the datasource completion
while True:
for _ in tqdm(range(60), desc='DataSet Creation', leave=False):
time.sleep(1)
datasource = self.describe_data_source(datasource_id, update=True)
logger.debug(f'Waiting for datasource {datasource_id}. current status={datasource.status}')
Expand Down

0 comments on commit ea82b5b

Please sign in to comment.