Skip to content

Commit

Permalink
Fix for issue integralstor#443
Browse files Browse the repository at this point in the history
  • Loading branch information
fractalram committed Jul 30, 2019
1 parent c0ca1c7 commit 0ba75ac
Showing 1 changed file with 9 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -246,14 +246,14 @@ def update_scan_schedule(request):
if 'scan_configuration_id' not in req_ret:
raise Exception('Malformed request. Please use the menus.')
scan_configuration_id = int(req_ret['scan_configuration_id'])
configurations, err = scan_utils.get_scan_configurations(scan_configuration_id=scan_configuration_id)
if err:
raise Exception(err)
if not configurations:
raise Exception('Invalid configuration specified. Please us the menus.')

if request.method == "GET":
# Return the conf page
configurations, err = scan_utils.get_scan_configurations(scan_configuration_id=scan_configuration_id)
if err:
raise Exception(err)
if not configurations:
raise Exception('Invalid configuration specified. Please us the menus.')

return_dict['configuration'] = configurations[0]
return_dict['scan_configuration_id'] = req_ret['scan_configuration_id']
return django.shortcuts.render_to_response("schedule_scan.html", return_dict, context_instance=django.template.context.RequestContext(request))
Expand All @@ -262,22 +262,10 @@ def update_scan_schedule(request):
raise Exception("Invalid request, please use the menus.")
scheduler = req_ret['scheduler']
schedule = scheduler.split()
app_root, err = config.get_application_root(app_tag='storage_insights')
if err:
raise Exception(err)
cmd = 'python %s/scripts/python/storage_insights_scanner.py -d -s %d'%(app_root, scan_configuration_id)

cron_description = 'Storage Insights scanner'

cron_task_id, err = scheduler_utils.create_cron_task(
cmd, cron_description, schedule[0], schedule[1], schedule[2], schedule[3], schedule[4], task_type_id=6)
if err:
raise Exception(err)
ret, err = scan_utils.update_cron_schedule(scan_configuration_id, cron_task_id)
if err:
raise Exception(err)
result, err = scheduler_utils.update_cron_schedule(configurations[0]['cron_task_id'], 'root',
schedule[0], schedule[1], schedule[2], schedule[3], schedule[4])

cron_task_list, err = scheduler_utils.get_cron_tasks(cron_task_id, task_type_id=6)
cron_task_list, err = scheduler_utils.get_cron_tasks(configurations[0]['cron_task_id'], task_type_id=6)
if err:
raise Exception(err)

Expand Down

0 comments on commit 0ba75ac

Please sign in to comment.