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
1=== modified file 'hooks/programmable-multiple-relation-changed'
2--- hooks/programmable-multiple-relation-changed 2014-06-06 14:38:17 +0000
3+++ hooks/programmable-multiple-relation-changed 2014-09-12 15:09:35 +0000
4@@ -13,9 +13,9 @@
5 if [ "$(relation-get public-address)" != "" ]
6 then
7 echo nameserver $(relation-get public-address) > /etc/dnsmasq.resolv.conf
8- grep -v ^RESOLV_CONF= /etc/default/dnsmasq > /tmp/dnsmasq.$$
9+ grep -v ^RESOLV_CONF= /etc/default/dnsmasq > /tmp/dnsmasq.$$ || juju-log "WARNING RESOLV_CONF not found"
10 mv /tmp/dnsmasq.$$ /etc/default/dnsmasq
11- echo RESOLV_CONF=/etc/dnsmasq.resolv.conf > /etc/default/dnsmasq
12+ echo RESOLV_CONF=/etc/dnsmasq.resolv.conf >> /etc/default/dnsmasq
13 service dnsmasq restart
14 fi
15
16
17=== modified file 'lib/config_script'
18--- lib/config_script 2014-06-06 14:38:17 +0000
19+++ lib/config_script 2014-09-12 15:09:35 +0000
20@@ -9,7 +9,7 @@
21 hs_hostname=homestead.$(config-get zone):8888
22 hs_provisioning_hostname=homestead.$(config-get zone):8889
23 xdms_hostname=homer.$(config-get zone):7888
24-ralf_hostname=
25+ralf_hostname=ralf.$(config-get zone):10888
26 sas_server=0.0.0.0
27 enum_server=
28
29
30=== modified file 'lib/unit-get'
31--- lib/unit-get 2014-06-07 07:10:02 +0000
32+++ lib/unit-get 2014-09-12 15:09:35 +0000
33@@ -1,17 +1,36 @@
34 #!/bin/bash
35-set -e
36-
37+set -ex
38+onEC2=false
39 key=$1
40 val=$(unit-get $1)
41
42-if [ "$key" = "public-address" ] &&
43- [ -n "$(dig +short $val | head -1)" ]
44-then
45- val=$(curl http://169.254.169.254/latest/meta-data/public-ipv4)
46-elif [ "$key" = "private-address" ]
47-then
48- val_ip=$(dig +short $val | head -1)
49- [ -z "$val_ip" ] || val=$val_ip
50+if [ -f $CHARM_DIR/lib/provider.txt ]
51+then
52+ PROVIDER=`cat $CHARM_DIR/lib/provider.txt `
53+else
54+ #checking dirty ec2 hack will work
55+ wget -q http://169.254.169.254/latest/meta-data/public-ipv4 && onEC2=true
56+ if ( "$onEC2" == true )
57+ then
58+ echo "EC2" > $CHARM_DIR/lib/provider.txt
59+ else
60+ echo "NOTEC2" > $CHARM_DIR/lib/provider.txt
61+ fi
62+fi
63+
64+if [ "$PROVIDER" == "EC2" ]
65+then
66+ if [ "$key" = "public-address" ] && [ -n "$(dig +short $val | head -1)" ]
67+ then
68+ val=$(curl http://169.254.169.254/latest/meta-data/public-ipv4)
69+ elif [ "$key" = "private-address" ]
70+ then
71+ val_ip=$(dig +short $val | head -1)
72+ [ -z "$val_ip" ] || val=$val_ip
73+ ##if val_ip is empty getting the system IP
74+ [ -z "$val_ip" ] && val=`ip route | grep src | cut -d " " -f 12`
75+ fi
76 fi
77
78 echo $val
79+

Subscribers

People subscribed via source and target branches

to all changes: