Merge lp:~thomnico/charms/precise/clearwater-bono/openstack-support into lp:~matt-williams-x/charms/precise/clearwater-bono/trunk

Proposed by Nicolas Thomas
Status: Needs review
Proposed branch: lp:~thomnico/charms/precise/clearwater-bono/openstack-support
Merge into: lp:~matt-williams-x/charms/precise/clearwater-bono/trunk
Diff against target: 66 lines (+31/-12)
2 files modified
hooks/programmable-multiple-relation-changed (+2/-2)
lib/unit-get (+29/-10)
To merge this branch: bzr merge lp:~thomnico/charms/precise/clearwater-bono/openstack-support
Reviewer Review Type Date Requested Status
Matt Williams Pending
Review via email: mp+233719@code.launchpad.net

Description of the change

Adding OpenStack support

linked to : https://code.launchpad.net/~thomnico/charms/precise/dns/openstack-support

Should not impact EC2

To post a comment you must log in.
12. By Nicolas Thomas

 OpenStack support

Unmerged revisions

12. By Nicolas Thomas

 OpenStack support

11. By Nicolas Thomas

 OpenStack support

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'hooks/programmable-multiple-relation-changed'
--- hooks/programmable-multiple-relation-changed 2014-06-06 14:38:15 +0000
+++ hooks/programmable-multiple-relation-changed 2014-09-12 15:09:17 +0000
@@ -17,9 +17,9 @@
17if [ "$(relation-get public-address)" != "" ]17if [ "$(relation-get public-address)" != "" ]
18then18then
19 echo nameserver $(relation-get public-address) > /etc/dnsmasq.resolv.conf19 echo nameserver $(relation-get public-address) > /etc/dnsmasq.resolv.conf
20 grep -v ^RESOLV_CONF= /etc/default/dnsmasq > /tmp/dnsmasq.$$20 grep -v ^RESOLV_CONF= /etc/default/dnsmasq > /tmp/dnsmasq.$$ || juju-log "WARNING RESOLV_CONF not found"
21 mv /tmp/dnsmasq.$$ /etc/default/dnsmasq21 mv /tmp/dnsmasq.$$ /etc/default/dnsmasq
22 echo RESOLV_CONF=/etc/dnsmasq.resolv.conf > /etc/default/dnsmasq22 echo RESOLV_CONF=/etc/dnsmasq.resolv.conf >> /etc/default/dnsmasq
23 service dnsmasq restart23 service dnsmasq restart
24fi24fi
2525
2626
=== modified file 'lib/unit-get'
--- lib/unit-get 2014-06-07 07:10:01 +0000
+++ lib/unit-get 2014-09-12 15:09:17 +0000
@@ -1,17 +1,36 @@
1#!/bin/bash1#!/bin/bash
2set -e2set -ex
33onEC2=false
4key=$14key=$1
5val=$(unit-get $1)5val=$(unit-get $1)
66
7if [ "$key" = "public-address" ] &&7if [ -f $CHARM_DIR/lib/provider.txt ]
8 [ -n "$(dig +short $val | head -1)" ]8then
9then9 PROVIDER=`cat $CHARM_DIR/lib/provider.txt `
10 val=$(curl http://169.254.169.254/latest/meta-data/public-ipv4)10else
11elif [ "$key" = "private-address" ]11 #checking dirty ec2 hack will work
12then12 wget -q http://169.254.169.254/latest/meta-data/public-ipv4 && onEC2=true
13 val_ip=$(dig +short $val | head -1)13 if ( "$onEC2" == true )
14 [ -z "$val_ip" ] || val=$val_ip14 then
15 echo "EC2" > $CHARM_DIR/lib/provider.txt
16 else
17 echo "NOTEC2" > $CHARM_DIR/lib/provider.txt
18 fi
19fi
20
21if [ "$PROVIDER" == "EC2" ]
22then
23 if [ "$key" = "public-address" ] && [ -n "$(dig +short $val | head -1)" ]
24 then
25 val=$(curl http://169.254.169.254/latest/meta-data/public-ipv4)
26 elif [ "$key" = "private-address" ]
27 then
28 val_ip=$(dig +short $val | head -1)
29 [ -z "$val_ip" ] || val=$val_ip
30 ##if val_ip is empty getting the system IP
31 [ -z "$val_ip" ] && val=`ip route | grep src | cut -d " " -f 12`
32 fi
15fi33fi
1634
17echo $val35echo $val
36

Subscribers

People subscribed via source and target branches

to all changes: