~xianghui/charms/trusty/ceph/support-ipv6

« back to all changes in this revision

Viewing changes to hooks/utils.py

  • Committer: Hui Xiang
  • Date: 2014-09-18 14:25:16 UTC
  • Revision ID: hui.xiang@canonical.com-20140918142516-ts1cx9rlompte22s
Do IPv6 check for supported version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
    filter_installed_packages
20
20
)
21
21
 
 
22
from charmhelpers.core.host import (
 
23
    lsb_release
 
24
)
 
25
 
22
26
from charmhelpers.contrib.network import ip
23
27
from charmhelpers.contrib.network.ip import (
24
 
    get_ipv6_addr,
 
28
    get_ipv6_addr
25
29
)
26
30
 
27
31
TEMPLATES_DIR = 'templates'
87
91
def get_public_addr():
88
92
    return ip.get_address_in_network(config('ceph-public-network'),
89
93
                                     fallback=get_host_ip())
 
94
 
 
95
 
 
96
def setup_ipv6():
 
97
    ubuntu_rel = float(lsb_release()['DISTRIB_RELEASE'])
 
98
    if ubuntu_rel < 14.04:
 
99
        raise Exception("IPv6 is not supported for Ubuntu "
 
100
                        "versions less than Trusty 14.04")