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

Proposed by Nicolas Thomas
Status: Needs review
Proposed branch: lp:~thomnico/charms/precise/clearwater-ralf/openstack-support
Merge into: lp:~matt-williams-x/charms/precise/clearwater-ralf/trunk
Diff against target: 79 lines (+32/-13)
3 files modified
hooks/programmable-multiple-relation-changed (+2/-2)
lib/config_script (+1/-1)
lib/unit-get (+29/-10)
To merge this branch: bzr merge lp:~thomnico/charms/precise/clearwater-ralf/openstack-support
Reviewer Review Type Date Requested Status
Matt Williams Pending
Review via email: mp+233713@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.
10. By Nicolas Thomas

 OpenStack support

Unmerged revisions

10. By Nicolas Thomas

 OpenStack support

9. 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:17 +0000
+++ hooks/programmable-multiple-relation-changed 2014-09-12 15:09:35 +0000
@@ -13,9 +13,9 @@
13if [ "$(relation-get public-address)" != "" ]13if [ "$(relation-get public-address)" != "" ]
14then14then
15 echo nameserver $(relation-get public-address) > /etc/dnsmasq.resolv.conf15 echo nameserver $(relation-get public-address) > /etc/dnsmasq.resolv.conf
16 grep -v ^RESOLV_CONF= /etc/default/dnsmasq > /tmp/dnsmasq.$$16 grep -v ^RESOLV_CONF= /etc/default/dnsmasq > /tmp/dnsmasq.$$ || juju-log "WARNING RESOLV_CONF not found"
17 mv /tmp/dnsmasq.$$ /etc/default/dnsmasq17 mv /tmp/dnsmasq.$$ /etc/default/dnsmasq
18 echo RESOLV_CONF=/etc/dnsmasq.resolv.conf > /etc/default/dnsmasq18 echo RESOLV_CONF=/etc/dnsmasq.resolv.conf >> /etc/default/dnsmasq
19 service dnsmasq restart19 service dnsmasq restart
20fi20fi
2121
2222
=== modified file 'lib/config_script'
--- lib/config_script 2014-06-06 14:38:17 +0000
+++ lib/config_script 2014-09-12 15:09:35 +0000
@@ -9,7 +9,7 @@
9hs_hostname=homestead.$(config-get zone):88889hs_hostname=homestead.$(config-get zone):8888
10hs_provisioning_hostname=homestead.$(config-get zone):888910hs_provisioning_hostname=homestead.$(config-get zone):8889
11xdms_hostname=homer.$(config-get zone):788811xdms_hostname=homer.$(config-get zone):7888
12ralf_hostname=12ralf_hostname=ralf.$(config-get zone):10888
13sas_server=0.0.0.013sas_server=0.0.0.0
14enum_server=14enum_server=
1515
1616
=== modified file 'lib/unit-get'
--- lib/unit-get 2014-06-07 07:10:02 +0000
+++ lib/unit-get 2014-09-12 15:09:35 +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: