~corey.bryant/charms/trusty/cinder-ceph/charm-proof-next

« back to all changes in this revision

Viewing changes to hooks/charmhelpers/contrib/openstack/utils.py

  • Committer: James Page
  • Date: 2014-04-02 08:01:16 UTC
  • Revision ID: james.page@canonical.com-20140402080116-kam8046iathmx7el
Resync helpers

Show diffs side-by-side

added added

removed removed

Lines of Context:
65
65
    ('1.10.0', 'havana'),
66
66
    ('1.9.1', 'havana'),
67
67
    ('1.9.0', 'havana'),
 
68
    ('1.13.0', 'icehouse'),
 
69
    ('1.12.0', 'icehouse'),
 
70
    ('1.11.0', 'icehouse'),
68
71
])
69
72
 
70
73
DEFAULT_LOOPBACK_SIZE = '5G'
420
423
    Resolves hostname for given IP, or returns the input
421
424
    if it is already a hostname.
422
425
    """
423
 
    if not is_ip(address):
424
 
        return address
425
 
 
426
 
    try:
427
 
        import dns.reversename
428
 
    except ImportError:
429
 
        apt_install('python-dnspython')
430
 
        import dns.reversename
431
 
 
432
 
    rev = dns.reversename.from_address(address)
433
 
    result = ns_query(rev)
434
 
    if not result:
435
 
        return None
 
426
    if is_ip(address):
 
427
        try:
 
428
            import dns.reversename
 
429
        except ImportError:
 
430
            apt_install('python-dnspython')
 
431
            import dns.reversename
 
432
 
 
433
        rev = dns.reversename.from_address(address)
 
434
        result = ns_query(rev)
 
435
        if not result:
 
436
            return None
 
437
    else:
 
438
        result = address
436
439
 
437
440
    if fqdn:
438
441
        # strip trailing .