Merge lp:~ev/adt-cloud-worker/uci-nova into lp:~canonical-ci-engineering/adt-cloud-worker/uci-nova

Proposed by Evan
Status: Merged
Approved by: Celso Providelo
Approved revision: 13
Merged at revision: 8
Proposed branch: lp:~ev/adt-cloud-worker/uci-nova
Merge into: lp:~canonical-ci-engineering/adt-cloud-worker/uci-nova
Diff against target: 87 lines (+27/-21)
1 file modified
uci-nova (+27/-21)
To merge this branch: bzr merge lp:~ev/adt-cloud-worker/uci-nova
Reviewer Review Type Date Requested Status
Celso Providelo (community) Approve
Review via email: mp+256687@code.launchpad.net

Commit message

Suppressing noisy output.

Description of the change

When neutron isn't installed, we produce error messages that look as though they are fatal:

Creating new SSH key on /tmp/adt-nova-8TjfiS
Creating specific nova keypair: adt-nova-8TjfiS
/usr/share/autopkgtest/ssh-setup/uci-nova: 188: /usr/share/autopkgtest/ssh-setup/uci-nova: neutron: not found
Creating specific nova security-group: adt-nova-8TjfiS
Allowing ingress SSH ...

To post a comment you must log in.
lp:~ev/adt-cloud-worker/uci-nova updated
11. By Evan

Not actually a comment.

Revision history for this message
Celso Providelo (cprov) wrote :

Thanks for preserving the "#cloud-config" watermark, I am not sure if it would work with the extra space.

Other than that, thanks for suppressing the confusing "neutron not found" message and make the output saner.

review: Approve
lp:~ev/adt-cloud-worker/uci-nova updated
12. By Evan

Be less noisy.

13. By Evan

Less noisy still.

Revision history for this message
Celso Providelo (cprov) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'uci-nova'
2--- uci-nova 2015-04-15 18:53:01 +0000
3+++ uci-nova 2015-04-17 16:03:49 +0000
4@@ -1,4 +1,4 @@
5-#!/bin/sh
6+#!/bin/sh -eu
7 #
8 # This script is part of autopkgtest
9 # autopkgtest is a tool for testing Debian binary packages
10@@ -122,13 +122,15 @@
11 }
12
13 security_setup_nova() {
14- debug "Creating specific nova security-group: $SRVNAME"
15- nova secgroup-create $SRVNAME "$SRVNAME testbed"
16-
17- debug "Allowing ingress SSH ..."
18- nova secgroup-add-rule $SRVNAME tcp 22 22 0.0.0.0/0
19-
20- debug "Egress traffic will respect external Firewall rules ..."
21+ if ! nova secgroup-create $SRVNAME "$SRVNAME testbed" >/dev/null 2&>1; then
22+ debug "Could not create specific nova security-group: $SRVNAME"
23+ exit 1
24+ fi
25+
26+ if ! nova secgroup-add-rule $SRVNAME tcp 22 22 0.0.0.0/0 >/dev/null 2&>1; then
27+ debug "Could not allow ingress SSH."
28+ exit 1
29+ fi
30 }
31
32 security_setup_neutron() {
33@@ -141,7 +143,7 @@
34 --format csv -c id -c security_group --quote none \
35 | grep $SRVNAME | cut -d',' -f1)
36 for rule_id in $DEFAULT_RULES; do
37- neutron security-group-rule-delete $rule_id
38+ neutron security-group-rule-delete $rule_id
39 done
40
41 debug "Allowing ingress SSH ..."
42@@ -185,10 +187,11 @@
43
44 # Setup testbed security with nova or neutron according to their
45 # availability in the target cloud.
46- if ! neutron security-group-list; then
47- security_setup_nova
48+ if type neutron >/dev/null && neutron security-group-list; then
49+ debug "Setting up neutron secgroup"
50+ security_setup_neutron
51 else
52- security_setup_neutron
53+ security_setup_nova
54 fi
55
56 # generate cloud-init user data; mostly for manage_etc_hosts, but also get
57@@ -315,18 +318,21 @@
58 nova console-log $SRVNAME > $CONSOLE
59 fi
60
61- debug "Deleting $SRVNAME instance"
62- nova delete $SRVNAME || true
63-
64- debug "Deleting $SRVNAME keypair"
65- nova keypair-delete $SRVNAME || true
66-
67- debug "Deleting /tmp/$SRVNAME SSH keys"
68- rm -rf /tmp/$SRVNAME || true
69+ if ! nova delete $SRVNAME >/dev/null >2&1; then
70+ error "Could not delete $SRVNAME instance."
71+ fi
72+
73+ if ! nova keypair-delete $SRVNAME >2&1; then
74+ error "Could not delete $SRVNAME keypair."
75+ fi
76+
77+ if ! rm -rf /tmp/$SRVNAME; then
78+ debug "Could not delete /tmp/$SRVNAME SSH keys"
79+ fi
80
81 DELETE_CMD="neutron security-group-delete $SRVNAME"
82 if ! neutron security-group-list; then
83- DELETE_CMD="nova secgroup-delete $SRVNAME"
84+ DELETE_CMD="nova secgroup-delete $SRVNAME"
85 fi
86
87 debug "Deleting $SRVNAME security-group"

Subscribers

People subscribed via source and target branches

to all changes: