Merge lp:~cprov/charms/trusty/adt-cloud-worker/keypair-name into lp:~canonical-ci-engineering/charms/trusty/adt-cloud-worker/trunk

Proposed by Celso Providelo
Status: Merged
Approved by: Celso Providelo
Approved revision: 12
Merged at revision: 11
Proposed branch: lp:~cprov/charms/trusty/adt-cloud-worker/keypair-name
Merge into: lp:~canonical-ci-engineering/charms/trusty/adt-cloud-worker/trunk
Diff against target: 28 lines (+4/-5)
1 file modified
hooks/actions.py (+4/-5)
To merge this branch: bzr merge lp:~cprov/charms/trusty/adt-cloud-worker/keypair-name
Reviewer Review Type Date Requested Status
Thomi Richards (community) Approve
Review via email: mp+252525@code.launchpad.net

Commit message

Nova keypair setup naming changes to accommodate the kill of [adt] configuration section.

Description of the change

Nova keypair setup naming changes to accommodate https://code.launchpad.net/~cprov/adt-cloud-worker/kill-adt-config/+merge/252524.

Worker exclusive keypair is named after the machine security-group name (hostname.replace('-machine', '')) instead of adt.name configuration variable (which is gone).

To post a comment you must log in.
12. By Celso Providelo

Duh, missing renaming.

Revision history for this message
Thomi Richards (thomir-deactivatedaccount) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'hooks/actions.py'
2--- hooks/actions.py 2015-03-10 23:15:24 +0000
3+++ hooks/actions.py 2015-03-11 00:38:03 +0000
4@@ -65,20 +65,19 @@
5 continue
6 os.environ[k.upper()] = str(v)
7
8- worker_name = config.get('adt', 'name')
9- hookenv.log('Resetting keypair "%s" ...' % worker_name)
10+ worker_secgroup = socket.gethostname().replace('-machine', '')
11+ hookenv.log('Resetting keypair "%s" ...' % worker_secgroup)
12 try:
13- cmd = 'nova keypair-delete %s' % worker_name
14+ cmd = 'nova keypair-delete %s' % worker_secgroup
15 subprocess.check_call(cmd, shell=True)
16 except subprocess.CalledProcessError:
17 # It may not exist.
18 pass
19- cmd = 'nova keypair-add --pub-key %s %s' % (pubkey_path, worker_name)
20+ cmd = 'nova keypair-add --pub-key %s %s' % (pubkey_path, worker_secgroup)
21 subprocess.check_call(cmd, shell=True)
22
23 # Ensure there is a "restrictive" security group named after the
24 # worker hostname (e.g.: 'juju-bootstack-1-testbed').
25- worker_secgroup = socket.gethostname().replace('-machine', '')
26 testbed_secgroup = '%s-testbed' % worker_secgroup
27
28 try:

Subscribers

People subscribed via source and target branches