Skip to content

Commit

Permalink
Merge pull request #81 from whdalsrnt/master
Browse files Browse the repository at this point in the history
fix: fix bug when sync data source of USE_SERVICE_ACCOUNT_SECRET type
  • Loading branch information
whdalsrnt authored Aug 11, 2023
2 parents 6f98d4b + 6a6b08d commit e433f9b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
3 changes: 3 additions & 0 deletions src/spaceone/cost_analysis/error/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ class ERROR_JOB_STATE(ERROR_UNKNOWN):
class ERROR_DUPLICATE_JOB(ERROR_UNKNOWN):
_message = 'The same job is already running. (data_source_id = {data_source_id})'


class ERROR_GET_JOB_TASKS(ERROR_UNKNOWN):
_message = 'Failed to get job tasks. (secret_id={secret_id}, data_source_id={data_source_id}, reason={reason})'
16 changes: 11 additions & 5 deletions src/spaceone/cost_analysis/service/job_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,11 +286,17 @@ def create_cost_job(self, data_source_vo: DataSource, job_options):
start, last_synchronized_at = self.get_start_last_synchronized_at(params)

for secret_id in secret_ids:
secret_data = self._get_secret_data(secret_id, domain_id)
single_tasks, single_changed = self.ds_plugin_mgr.get_tasks(options, secret_id, secret_data, schema, start,
last_synchronized_at, domain_id)
tasks.extend(single_tasks)
changed.extend(single_changed)
try:
secret_data = self._get_secret_data(secret_id, domain_id)
single_tasks, single_changed = self.ds_plugin_mgr.get_tasks(options, secret_id, secret_data, schema, start,
last_synchronized_at, domain_id)
tasks.extend(single_tasks)
changed.extend(single_changed)
except Exception as e:
_LOGGER.error(f'[create_cost_job] get_tasks error: {e}', exc_info=True)

if secret_type == 'MANUAL':
raise ERROR_GET_JOB_TASKS(secret_id=secret_id, data_source_id=data_source_id, reason=e)

_LOGGER.debug(f'[sync] get_tasks: {tasks}')
_LOGGER.debug(f'[sync] changed: {changed}')
Expand Down

0 comments on commit e433f9b

Please sign in to comment.