Commit 1d2550c7 by Bach Dániel

Merge branch 'fix-set_hostname' into 'master'

Fix Set Hostname
parents 2b450c1f 99602bbd
......@@ -10,8 +10,9 @@
</h3>
</div>
<div class="panel-body">
{% blocktrans with owner=instance.owner fqdn=instance.primary_host %}
{{ owner }} offered to take the ownership of virtual machine {{fqdn}}.
{% blocktrans with owner=instance.owner name=instance.name id=instance.id%}
<strong>{{ owner }}</strong> offered to take the ownership of
virtual machine <strong>{{name}} ({{id}})</strong>.
Do you accept the responsility of being the host's owner?
{% endblocktrans %}
<div class="pull-right">
......
......@@ -25,7 +25,7 @@
<i class="fa {{ i.get_status_icon }}" title="{{ i.get_status_display }}"></i>
{{ i.name }}
</span>
<small class="text-muted"> {{ i.primary_host.hostname }}</small>
<small class="text-muted"> {{ i.short_hostname }}</small>
<div class="pull-right dashboard-vm-favourite" data-vm="{{ i.pk }}">
{% if i.fav %}
<i class="fa fa-star text-primary title-favourite" title="{% trans "Unfavourite" %}"></i>
......
......@@ -1883,7 +1883,7 @@ class VmList(LoginRequiredMixin, FilterMixin, ListView):
'pk': i.pk,
'name': i.name,
'icon': i.get_status_icon(),
'host': "" if not i.primary_host else i.primary_host.hostname,
'host': i.short_hostname,
'status': i.get_status_display(),
'fav': i.pk in favs,
} for i in instances]
......
......@@ -2114,13 +2114,14 @@ msgstr "Átruházás"
#, python-format
msgid ""
"\n"
" %(owner)s offered to take the ownership of virtual machine "
"%(fqdn)s.\n"
" <strong>%(owner)s</strong> offered to take the ownership of\n"
" virtual machine <strong>%(name)s (%(id)s)</strong>.\n"
" Do you accept the responsility of being the host's owner?\n"
" "
msgstr ""
"\n"
" %(owner)s kezdeményezte a(z) %(fqdn)s virtuális gép átruházását.\n"
" <strong>%(owner)s</strong> kezdeményezte a(z) <strong>%(name)s\n"
" (%(id)s)</strong> virtuális gép átruházását.\n"
" Elfogadja a gép birtoklásával járó felelősséget?\n"
" "
......
......@@ -613,6 +613,13 @@ class Instance(AclBase, VirtualMachineDescModel, StatusModel, OperatedMixin,
except:
return
@property
def short_hostname(self):
try:
return self.primary_host.hostname
except AttributeError:
return self.vm_name
def get_vm_desc(self):
"""Serialize Instance object to vmdriver.
"""
......
......@@ -46,7 +46,7 @@ def send_init_commands(instance, act):
with act.sub_activity('set_hostname',
readable_name=ugettext_noop('set hostname')):
set_hostname.apply_async(
queue=queue, args=(vm, instance.primary_host.hostname))
queue=queue, args=(vm, instance.short_hostname))
def send_networking_commands(instance, act):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment