Commit e67cae73 authored by Matthias's avatar Matthias
Browse files

adapt to new interface of deleteService

parent 2abb8bb3
Pipeline #27967 passed with stages
in 2 minutes and 36 seconds
...@@ -13,10 +13,8 @@ class DeleteService(Resource): ...@@ -13,10 +13,8 @@ class DeleteService(Resource):
'deleteObject': 'record', 'deleteObject': 'record',
'deleteId': record_id 'deleteId': record_id
} }
if dryrun:
set_values['dryrun'] = '--dry-run'
try: try:
self.do_helm_install(set_values, session_id) self.do_helm_install(set_values, session_id, dryrun)
except Exception as ex: except Exception as ex:
message = str(ex) message = str(ex)
current_app.logger.error(message) current_app.logger.error(message)
...@@ -30,10 +28,8 @@ class DeleteService(Resource): ...@@ -30,10 +28,8 @@ class DeleteService(Resource):
'deleteObject': 'record-set', 'deleteObject': 'record-set',
'deleteId': recordset_id 'deleteId': recordset_id
} }
if dryrun:
set_values['dryrun'] = '--dry-run'
try: try:
self.do_helm_install(set_values, session_id) self.do_helm_install(set_values, session_id, dryrun)
except Exception as ex: except Exception as ex:
message = str(ex) message = str(ex)
current_app.logger.error(message) current_app.logger.error(message)
...@@ -47,10 +43,8 @@ class DeleteService(Resource): ...@@ -47,10 +43,8 @@ class DeleteService(Resource):
'deleteObject': 'institution', 'deleteObject': 'institution',
'deleteId': institution_id, 'deleteId': institution_id,
} }
if dryrun:
set_values['dryrun'] = '--dry-run'
try: try:
self.do_helm_install(set_values, session_id) self.do_helm_install(set_values, session_id, dryrun)
except Exception as ex: except Exception as ex:
message = str(ex) message = str(ex)
current_app.logger.error(message) current_app.logger.error(message)
...@@ -59,17 +53,25 @@ class DeleteService(Resource): ...@@ -59,17 +53,25 @@ class DeleteService(Resource):
return 0 return 0
@staticmethod @staticmethod
def do_helm_install(set_values, session_id): def do_helm_install(set_values, session_id, dryrun):
current_app.logger.debug( current_app.logger.debug(
'calling delete service: type=' + 'calling delete service: type=' +
set_values['deleteObject'] + set_values['deleteObject'] +
' / id=' + set_values['deleteId'] + ' / id=' + set_values['deleteId'] +
' / session=' + set_values['sessionId']) ' / session=' + set_values['sessionId'])
jobArgs = [
'--'+set_values['deleteObject']+'-filter',
set_values['deleteId'],
set_values['sessionId']
]
if dryrun:
jobArgs.append('--dry-run')
jobArgs = {'jobArgs': jobArgs}
helm = Helm() helm = Helm()
response = helm.install( # noqa: F841 response = helm.install( # noqa: F841
chart=os.path.join(current_app.root_path, "charts", 'import-process-delete'), chart=os.path.join(current_app.root_path, "charts", 'import-process-delete'),
name='import-process-delete-' + session_id, name='import-process-delete-' + session_id,
namespace=current_app.config['NAMESPACE'], namespace=current_app.config['NAMESPACE'],
set_values=set_values, set_values=jobArgs,
fail_on_err=False fail_on_err=False
) )
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment