~openstack-charm-testers/+junk/neutron-snabbswitch

« back to all changes in this revision

Viewing changes to bin/post-deploy-config

  • Committer: Edward Hope-Morley
  • Date: 2015-05-12 08:49:33 UTC
  • Revision ID: edward.hope-morley@canonical.com-20150512084933-ll0olnott54l1bjx
updates for 2015.5 build

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 
3
3
import subprocess
4
4
import yaml
5
 
 
 
5
import os
 
6
import sys
 
7
 
 
8
cmd_out = subprocess.check_output(['neutron', 'net-list'])
 
9
 
 
10
try:
 
11
    net_id = os.environ['NET_ID']
 
12
except KeyError:
 
13
    net_id = None
 
14
 
 
15
if net_id:
 
16
    # Use OSCI / Jenkins environment variable if defined.
 
17
    print 'Using NET_ID environment variable: {}'.format(net_id)
 
18
else:
 
19
    # Preserve existing default behavior (eg. manual testing)
 
20
    net_name = os.environ['OS_USERNAME'] + '_admin_net'
 
21
    print 'Using default network name: {}'.format(net_name)
 
22
    for line in cmd_out.split('\n'):
 
23
        if net_name in line:
 
24
            net_id = line.split('|')[1].replace(' ','')
6
25
 
7
26
gateway_config = yaml.load(subprocess.check_output(['juju', 'status', 'neutron-gateway']))
8
27
 
12
31
 
13
32
if len(uuids) > 0:
14
33
    for uuid in uuids:
15
 
        subprocess.check_call(['nova', 'interface-attach', uuid])
 
34
        subprocess.check_call(['nova', 'interface-attach', '--net-id', net_id, uuid])
16
35
    subprocess.check_call(['juju', 'set', 'neutron-gateway', 'ext-port=eth1'])