~corey.bryant/charms/trusty/neutron-api/db-stamp

« back to all changes in this revision

Viewing changes to hooks/neutron_api_utils.py

  • Committer: james.page at ubuntu
  • Date: 2014-10-01 21:05:24 UTC
  • mfrom: (39.3.25 ipv6)
  • Revision ID: james.page@ubuntu.com-20141001210524-z6uqyljzorphrhy6
[xianghui,dosaboy,r=james-page,t=gema] Add IPv6 support using prefer-ipv6 flag

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
    config,
18
18
    log,
19
19
)
20
 
from charmhelpers.fetch import apt_update, apt_install, apt_upgrade
 
20
 
 
21
from charmhelpers.fetch import (
 
22
    apt_update,
 
23
    apt_install,
 
24
    apt_upgrade,
 
25
    add_source
 
26
)
 
27
 
 
28
from charmhelpers.core.host import (
 
29
    lsb_release
 
30
)
 
31
 
21
32
import neutron_api_context
22
33
import subprocess
23
34
 
62
73
                     context.PostgresqlDBContext(database=config('database')),
63
74
                     neutron_api_context.IdentityServiceContext(),
64
75
                     neutron_api_context.NeutronCCContext(),
65
 
                     context.SyslogContext()],
 
76
                     context.SyslogContext(),
 
77
                     context.BindHostContext()],
66
78
    }),
67
79
    (NEUTRON_DEFAULT, {
68
80
        'services': ['neutron-server'],
212
224
           'upgrade',
213
225
           'head']
214
226
    subprocess.check_output(cmd)
 
227
 
 
228
 
 
229
def setup_ipv6():
 
230
    ubuntu_rel = lsb_release()['DISTRIB_CODENAME'].lower()
 
231
    if ubuntu_rel < "trusty":
 
232
        raise Exception("IPv6 is not supported in the charms for Ubuntu "
 
233
                        "versions less than Trusty 14.04")
 
234
 
 
235
    # NOTE(xianghui): Need to install haproxy(1.5.3) from trusty-backports
 
236
    # to support ipv6 address, so check is required to make sure not
 
237
    # breaking other versions, IPv6 only support for >= Trusty
 
238
    if ubuntu_rel == 'trusty':
 
239
        add_source('deb http://archive.ubuntu.com/ubuntu trusty-backports'
 
240
                   ' main')
 
241
        apt_update()
 
242
        apt_install('haproxy/trusty-backports', fatal=True)