Merge ~nicolasbock/stsstack-bundles:emacs into stsstack-bundles:master

Proposed by Nicolas Bock
Status: Merged
Merged at revision: 6ea88c1a990e626b3bf23928b002b11baf937465
Proposed branch: ~nicolasbock/stsstack-bundles:emacs
Merge into: stsstack-bundles:master
Diff against target: 201 lines (+52/-48)
6 files modified
.dir-locals.el (+5/-0)
openstack/tools/configure_octavia.sh (+0/-1)
openstack/tools/create_ipv4_octavia.sh (+10/-8)
openstack/tools/float_all.sh (+14/-15)
openstack/tools/instance_launch.sh (+1/-2)
openstack/tools/upload_octavia_amphora_image.sh (+22/-22)
Reviewer Review Type Date Requested Status
Felipe Reyes Approve
Review via email: mp+392331@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Felipe Reyes (freyes) wrote :

LGTM.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/.dir-locals.el b/.dir-locals.el
2new file mode 100644
3index 0000000..a6e4f47
4--- /dev/null
5+++ b/.dir-locals.el
6@@ -0,0 +1,5 @@
7+;;; Directory Local Variables
8+;;; For more information see (info "(emacs) Directory Variables")
9+
10+((sh-mode
11+ (sh-basic-offset . 4)))
12diff --git a/openstack/tools/configure_octavia.sh b/openstack/tools/configure_octavia.sh
13index f3d0289..8416b16 100755
14--- a/openstack/tools/configure_octavia.sh
15+++ b/openstack/tools/configure_octavia.sh
16@@ -40,4 +40,3 @@ juju config octavia \
17 lb-mgmt-controller-cert="$(base64 $dout/controller_cert_bundle.pem)"
18
19 juju run-action octavia/leader configure-resources --wait
20-
21diff --git a/openstack/tools/create_ipv4_octavia.sh b/openstack/tools/create_ipv4_octavia.sh
22index c151abd..606fc6c 100755
23--- a/openstack/tools/create_ipv4_octavia.sh
24+++ b/openstack/tools/create_ipv4_octavia.sh
25@@ -1,20 +1,22 @@
26 #!/bin/bash
27
28+set -u -e -x
29+
30 # wait for services start
31 while true; do
32 [[ `juju status keystone --format json | jq -r '.applications.keystone.units."keystone/0"."workload-status".current'` = active ]] \
33- && break
34+ && break
35 if [[ `juju status keystone --format json | jq -r '.applications.keystone.units."keystone/0"."workload-status".current'` = error ]]
36 then
37- echo "ERROR: Octavia deployment failed"
38- break
39+ echo "ERROR: Octavia deployment failed"
40+ break
41 fi
42 done
43
44 echo INFO: create temp novarc.services and extract octavia password
45 touch /tmp/novarc.services
46
47-cat << EOF > /tmp/novarc.services
48+cat << EOF > /tmp/novarc.services
49 OS_PROJECT_DOMAIN_NAME=service_domain
50 OS_USERNAME=octavia
51 OS_PROJECT_NAME=services
52@@ -30,8 +32,8 @@ openstack router create lb-mgmt --tag charm-octavia
53 openstack router add subnet lb-mgmt lb-mgmt-subnet
54
55 echo INFO: add security rules
56-openstack security group create lb-mgmt-sec-grp --tag charm-octavia
57-openstack security group create lb-health-mgr-sec-grp --tag charm-octavia-health
58-openstack security group rule create lb-mgmt-sec-grp --protocol icmp
59-openstack security group rule create lb-mgmt-sec-grp --protocol tcp --protocol tcp --dst-port 22
60+openstack security group create lb-mgmt-sec-grp --tag charm-octavia
61+openstack security group create lb-health-mgr-sec-grp --tag charm-octavia-health
62+openstack security group rule create lb-mgmt-sec-grp --protocol icmp
63+openstack security group rule create lb-mgmt-sec-grp --protocol tcp --protocol tcp --dst-port 22
64 openstack security group rule create lb-mgmt-sec-grp --protocol tcp --dst-port 9443
65diff --git a/openstack/tools/float_all.sh b/openstack/tools/float_all.sh
66index ac32695..e40ef70 100755
67--- a/openstack/tools/float_all.sh
68+++ b/openstack/tools/float_all.sh
69@@ -5,8 +5,8 @@
70 echo " + Floating all instances."
71
72 function get_ip_f() {
73- # Get first unallocated floating IP
74- openstack floating ip list | awk '/None/ { print $4; exit }'
75+ # Get first unallocated floating IP
76+ openstack floating ip list | awk '/None/ { print $4; exit }'
77 }
78
79 fip_count=$(openstack floating ip list | awk '/None/ { print $4 }' | wc -l)
80@@ -14,26 +14,25 @@ instances=$(openstack server list | grep ACTIVE | grep -v '\,' | awk '{ print $2
81 inst_count=$(echo $instances | wc -w)
82
83 if [[ -z "$instances" ]]; then
84- set +x
85- echo " . It appears that no instance needs a floating IP."
86- exit 0
87+ set +x
88+ echo " . It appears that no instance needs a floating IP."
89+ exit 0
90 fi
91
92 # Create floating IPs if necessary.
93 if (( $fip_count >= $inst_count)); then
94- echo " . Already enough floating IPs."
95+ echo " . Already enough floating IPs."
96 else
97- fip_diff=$(( $inst_count - $fip_count ))
98- echo " + Creating $fip_diff more floating IPs."
99- for ((m=1; m<=$fip_diff; m++)); do
100- openstack floating ip create ext_net
101- done
102+ fip_diff=$(( $inst_count - $fip_count ))
103+ echo " + Creating $fip_diff more floating IPs."
104+ for ((m=1; m<=$fip_diff; m++)); do
105+ openstack floating ip create ext_net
106+ done
107 fi
108
109 # Allocate floating IPs to instances.
110 for instance in $instances; do
111- ip_f=$(get_ip_f)
112- echo " + Associating floating IP $ip_f to instance $instance."
113- openstack server add floating ip $instance $ip_f
114+ ip_f=$(get_ip_f)
115+ echo " + Associating floating IP $ip_f to instance $instance."
116+ openstack server add floating ip $instance $ip_f
117 done
118-
119diff --git a/openstack/tools/instance_launch.sh b/openstack/tools/instance_launch.sh
120index 0ee90bd..2b5016b 100755
121--- a/openstack/tools/instance_launch.sh
122+++ b/openstack/tools/instance_launch.sh
123@@ -42,5 +42,4 @@ fi
124 server_name="${image_name}-$(date +'%H%M%S')"
125 openstack server create --wait --image $image_name --flavor $flavor --key-name testkey --nic net-id=${net_id} --min $instance_qty --max $instance_qty $server_name
126
127-# Hint: use ssh -i ~/testkey.pem ubuntu@<ip> to access new instances (may also need a floating IP).
128-
129+echo 'Hint: use ssh -i ~/testkey.pem ubuntu@<ip> to access new instances (may also need a floating IP, see ./tools/float_all.sh).'
130diff --git a/openstack/tools/upload_octavia_amphora_image.sh b/openstack/tools/upload_octavia_amphora_image.sh
131index 21d8e7f..f72fa06 100755
132--- a/openstack/tools/upload_octavia_amphora_image.sh
133+++ b/openstack/tools/upload_octavia_amphora_image.sh
134@@ -7,17 +7,17 @@ declare release=
135 declare image_format=
136
137 while (( $# > 0 )); do
138- case $1 in
139- --release|-r)
140- release=$2
141- shift
142- ;;
143- --image-format|-f)
144- image_format=$2
145- shift
146- ;;
147- --help|-h)
148- cat <<EOF
149+ case $1 in
150+ --release|-r)
151+ release=$2
152+ shift
153+ ;;
154+ --image-format|-f)
155+ image_format=$2
156+ shift
157+ ;;
158+ --help|-h)
159+ cat <<EOF
160 Usage:
161
162 ./tools/upload_octavia_amphora_image.sh --release RELEASE [--image-format FORMAT]
163@@ -29,19 +29,19 @@ Options:
164 --image-format | -f The image format {'qcow2', 'raw'}. The default
165 is qcow2.
166 EOF
167- exit
168- ;;
169- *)
170- echo "Unknown command line option $1"
171- exit 1
172- ;;
173- esac
174- shift
175+ exit
176+ ;;
177+ *)
178+ echo "Unknown command line option $1"
179+ exit 1
180+ ;;
181+ esac
182+ shift
183 done
184
185 if [[ -z ${release} ]]; then
186- echo "Missing release. Please specify one with --release command line option"
187- exit 1
188+ echo "Missing release. Please specify one with --release command line option"
189+ exit 1
190 fi
191
192 set -x
193@@ -60,7 +60,7 @@ upload_image swift octavia-amphora $img $image_format
194
195 image_name=octavia-amphora
196 if [[ $image_format == raw ]]; then
197- image_name=${image_name}-raw
198+ image_name=${image_name}-raw
199 fi
200
201 openstack image set --tag octavia-amphora ${image_name}

Subscribers

People subscribed via source and target branches