mirror of
https://github.com/retspen/webvirtcloud
synced 2025-02-06 04:25:18 +00:00
instance poweron checks is_template attribute. templates should not be started.
This commit is contained in:
parent
cdb5c4f412
commit
dd3dc08614
1 changed files with 16 additions and 8 deletions
|
@ -138,10 +138,14 @@ def instances(request):
|
|||
instance.compute.password,
|
||||
instance.compute.type)
|
||||
if 'poweron' in request.POST:
|
||||
msg = _("Power On")
|
||||
addlogmsg(request.user.username, instance.name, msg)
|
||||
conn.start(name)
|
||||
return HttpResponseRedirect(request.get_full_path())
|
||||
if instance.is_template:
|
||||
msg = _("Templates cannot be started.")
|
||||
error_messages.append(msg)
|
||||
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:
|
||||
msg = _("Power Off")
|
||||
|
@ -412,10 +416,14 @@ def instance(request, compute_id, vname):
|
|||
|
||||
if request.method == 'POST':
|
||||
if 'poweron' in request.POST:
|
||||
conn.start()
|
||||
msg = _("Power On")
|
||||
addlogmsg(request.user.username, instance.name, msg)
|
||||
return HttpResponseRedirect(request.get_full_path() + '#poweron')
|
||||
if instance.is_template:
|
||||
msg = _("Templates cannot be started.")
|
||||
error_messages.append(msg)
|
||||
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:
|
||||
conn.force_shutdown()
|
||||
|
|
Loading…
Reference in a new issue