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

guess_clone_name fix. should check hostname, not fqdn.

guess_clone_name calls guess_mac_address in instance view
This commit is contained in:
Ing. Jan KRCMAR 2016-06-08 13:37:26 +02:00
parent 14e8418472
commit 08cc19900c
2 changed files with 3 additions and 1 deletions

View file

@ -1052,6 +1052,7 @@
guessed_name = data['name'].split(".")[0]; guessed_name = data['name'].split(".")[0];
$('#clone_name').val(guessed_name); $('#clone_name').val(guessed_name);
update_clone_disk_name(guessed_name); update_clone_disk_name(guessed_name);
guess_mac_address('#clone_name', 0);
}); });
} }
</script> </script>

View file

@ -790,7 +790,8 @@ def guess_clone_name(request):
for line in f: for line in f:
line = line.strip() line = line.strip()
if "host %s" % prefix in line: if "host %s" % prefix in line:
hostname = line.split(' ')[1] fqdn = line.split(' ')[1]
hostname = fqdn.split('.')[0]
if hostname.startswith(prefix) and hostname not in instance_names: if hostname.startswith(prefix) and hostname not in instance_names:
return HttpResponse(json.dumps({'name': hostname})) return HttpResponse(json.dumps({'name': hostname}))
return HttpResponse(json.dumps({})); return HttpResponse(json.dumps({}));