Revision f5e97e7f

b/snf-cyclades-app/synnefo/ui/static/snf/js/models.js
1288 1288
        get_hostname: function() {
1289 1289
          var hostname = this.get_meta('hostname');
1290 1290
          if (!hostname) {
1291
            hostname = synnefo.config.vm_hostname_format.format(this.id);
1291
            if (synnefo.config.vm_hostname_format) {
1292
              hostname = synnefo.config.vm_hostname_format.format(this.id);
1293
            } else {
1294
              hostname = this.get_public_nic().get('ipv4');
1295
            }
1292 1296
          }
1293 1297
          return hostname;
1294 1298
        },
b/snf-cyclades-app/synnefo/ui/templates/synnefo-windows.rdp
35 35
promptcredentialonce:i:1
36 36
username:s:{{ username }}
37 37
domain:s:{{ domain }}
38
full address:s:{{ ip_address }}{% if extra_content %}
38
full address:s:{% if hostname %}{{ hostname }}{% else %}{{ ip_address }}{% endif %}{% if extra_content %}
39 39
{{ extra_content }}{% endif %}
b/snf-cyclades-app/synnefo/ui/views.py
98 98
VM_NAME_TEMPLATE = getattr(settings, "VM_CREATE_NAME_TPL", "My {0} server")
99 99
VM_HOSTNAME_FORMAT = getattr(settings, "UI_VM_HOSTNAME_FORMAT",
100 100
                                    'snf-%(id)s.vm.okeanos.grnet.gr')
101

  
102
if isinstance(VM_HOSTNAME_FORMAT, basestring):
103
  VM_HOSTNAME_FORMAT =  VM_HOSTNAME_FORMAT % {'id':'{0}'}
104

  
101 105
MAX_SSH_KEYS_PER_USER = getattr(settings, "USERDATA_MAX_SSH_KEYS_PER_USER")
102 106
FLAVORS_DISK_TEMPLATES_INFO = getattr(settings, "UI_FLAVORS_DISK_TEMPLATES_INFO", {})
103 107
SYSTEM_IMAGES_OWNERS = getattr(settings, "UI_SYSTEM_IMAGES_OWNERS", {})
......
208 212
               'grouped_public_network_name': json.dumps(GROUPED_PUBLIC_NETWORK_NAME),
209 213
               'group_public_networks': json.dumps(GROUP_PUBLIC_NETWORKS),
210 214
               'diagnostics_update_interval': json.dumps(DIAGNOSTICS_UPDATE_INTERVAL),
211
               'vm_hostname_format': json.dumps(VM_HOSTNAME_FORMAT % {'id':'{0}'})
215
               'vm_hostname_format': json.dumps(VM_HOSTNAME_FORMAT)
212 216
    }
213 217
    return template('home', request, context)
214 218

  
......
349 353
                'username': username,
350 354
                'domain': domain,
351 355
                'ip_address': ip_address,
356
                'hostname': hostname,
352 357
                'extra_content': extra_rdp_content
353 358
        }
354 359

  

Also available in: Unified diff