1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-12-25 15:45:23 +00:00

instance poweron checks is_template attribute. templates should not be e started. by @honza801

This commit is contained in:
catborise 2018-10-24 16:56:05 +03:00
parent e80bbfd85b
commit 1b913fd4d6

View file

@ -313,10 +313,14 @@ def instance(request, compute_id, vname):
if request.method == 'POST': if request.method == 'POST':
if 'poweron' in request.POST: if 'poweron' in request.POST:
conn.start() if instance.is_template:
msg = _("Power On") msg = _("Templates cannot be started.")
addlogmsg(request.user.username, instance.name, msg) error_messages.append(msg)
return HttpResponseRedirect(request.get_full_path() + '#poweron') else:
conn.start()
msg = _("Power On")
addlogmsg(request.user.username, instance.name, msg)
return HttpResponseRedirect(request.get_full_path() + '#poweron')
if 'powercycle' in request.POST: if 'powercycle' in request.POST:
conn.force_shutdown() conn.force_shutdown()
@ -904,10 +908,14 @@ def instances_actions(request):
instance.compute.password, instance.compute.password,
instance.compute.type) instance.compute.type)
if 'poweron' in request.POST: if 'poweron' in request.POST:
msg = _("Power On") if instance.is_template:
addlogmsg(request.user.username, instance.name, msg) msg = _("Templates cannot be started.")
conn.start(name) messages.error(request, msg)
return HttpResponseRedirect(request.get_full_path()) else:
msg = _("Power On")
addlogmsg(request.user.username, instance.name, msg)
conn.start(name)
return HttpResponseRedirect(request.get_full_path())
if 'poweroff' in request.POST: if 'poweroff' in request.POST:
msg = _("Power Off") msg = _("Power Off")