Skip to content

Commit

Permalink
Merge branch 'fix-definitions-scan' into fix-tao
Browse files Browse the repository at this point in the history
  • Loading branch information
iakov-aws committed Nov 8, 2024
2 parents e000e08 + 16c81d8 commit 7305696
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions cid/helpers/quicksight/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,22 +261,18 @@ def _safe_int(value, default=None):
logger.info(f'Unable to describe template for {dashboardId}, {exc}')
else:
logger.info("Minimum template version could not be found for Dashboard {dashboardId}: {_template_arn}, deployed template could not be described")

if _template_arn is None:
else: # Dashboard is not template based but definition based
try:
dashboard.deployedDefinition = self.describe_dashboard_definition(dashboard_id=dashboardId, refresh=refresh)
except CidError as exc:
logger.info('Exception on reading dashboard definition {dashboardId}: {exc}. Not critical. Continue.')

if 'data' in _definition:
# Resolve source definition (the latest definition publicly available)
data_stream = io.StringIO(_definition["data"])
definition_data = yaml.safe_load(data_stream)
dashboard.sourceDefinition = CidQsDefinition(definition_data)

# Resolve deployed dashboard definition
params = {
"dashboard_id": dashboardId,
"refresh": refresh
}
_deployed_definition = self.describe_dashboard_definition(**params)
# Assign property deployedDefinition to the retrieved dashboard definition
dashboard.deployedDefinition = _deployed_definition

# Fetch datasets (works for both TEMPLATE and DEFINITION based dashboards)
for dataset in dashboard.version.get('DataSetArns', []):
dataset_id = dataset.split('/')[-1]
Expand Down Expand Up @@ -1415,10 +1411,10 @@ def _build_params_for_create_update_dash(self, definition: dict, permissions: bo
dataset_declarations = create_parameters['Definition'].get('DataSetIdentifierDeclarations', [])
for ds_dec in dataset_declarations:
if identifier == ds_dec['Identifier']:
logger.debug('Dataset {identifier} matched by Name')
logger.debug(f'Dataset {identifier} matched by Name')
break # all good
elif arn.split('/')[-1] == ds_dec['DataSetArn'].split('/')[-1]:
logger.debug('Dataset {identifier} matched by Id')
logger.debug(f'Dataset {identifier} matched by Id')
identifier = ds_dec['Identifier']
break
else:
Expand Down

0 comments on commit 7305696

Please sign in to comment.