Merge lp:~pwlars/charms/precise/uci-engine-key-secret-subordinate/key-secret-lpkey into lp:~canonical-ci-engineering/charms/precise/uci-engine-key-secret-subordinate/trunk

Proposed by Paul Larson on 2014-12-04
Status: Merged
Merged at revision: 3
Proposed branch: lp:~pwlars/charms/precise/uci-engine-key-secret-subordinate/key-secret-lpkey
Merge into: lp:~canonical-ci-engineering/charms/precise/uci-engine-key-secret-subordinate/trunk
Diff against target: 52 lines (+10/-3)
3 files modified
config.yaml (+3/-0)
hooks/hooks.py (+2/-0)
unit_tests/test_hooks.py (+5/-3)
To merge this branch: bzr merge lp:~pwlars/charms/precise/uci-engine-key-secret-subordinate/key-secret-lpkey
Reviewer Review Type Date Requested Status
Celso Providelo (community) 2014-12-04 Approve on 2014-12-04
Paul Larson Resubmit on 2014-12-04
Review via email: mp+243705@code.launchpad.net

Commit message

Add optional launchpad credentials

Description of the change

Add optional launchpad credentials

To post a comment you must log in.
Celso Providelo (cprov) wrote :

Thanks for working on this Paul,

I personally would not lay the lp creds as a hidden file (.launchpad.credentials), it will just make it hard to notice this file in production. What about simply 'launchpad.credentials' ?

Also, from what I've looked it seems pretty simple to adjust the charm unittests to cover this new option. Can you do that, please ?

review: Needs Fixing
4. By Paul Larson on 2014-12-04

use unhidden version of launchpad.credentials file

Paul Larson (pwlars) wrote :

done

review: Resubmit
Celso Providelo (cprov) wrote :

Missing tests, as discussed on IRC.

review: Needs Fixing
5. By Paul Larson on 2014-12-04

Add launchpad.credentials to the testcase

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 'config.yaml'
2--- config.yaml 2014-11-25 16:46:29 +0000
3+++ config.yaml 2014-12-04 19:04:34 +0000
4@@ -15,3 +15,6 @@
5 gpg-public-keyring:
6 type: string
7 description: Public GPG keyring (gpg.pub)
8+ launchpad-credentials:
9+ type: string
10+ description: Launchpad credentials
11
12=== modified file 'hooks/hooks.py'
13--- hooks/hooks.py 2014-11-25 16:46:29 +0000
14+++ hooks/hooks.py 2014-12-04 19:04:34 +0000
15@@ -63,6 +63,8 @@
16 _install_key(config['gpg-secret-keyring'], keys_dir, 'gpg.sec')
17 _install_key(config['ssh-public-key'], keys_dir, 'id_rsa.pub')
18 _install_key(config['ssh-private-key'], keys_dir, 'id_rsa')
19+ _install_key(config['launchpad-credentials'], keys_dir,
20+ 'launchpad.credentials')
21 except IOError as exc:
22 juju_info('Cannot install keys: {}'.format(exc))
23 if os.path.exists(keys_dir):
24
25=== modified file 'unit_tests/test_hooks.py'
26--- unit_tests/test_hooks.py 2014-11-25 16:46:29 +0000
27+++ unit_tests/test_hooks.py 2014-12-04 19:04:34 +0000
28@@ -101,6 +101,7 @@
29 'ssh-public-key': base64.b64encode('public?'),
30 'gpg-secret-keyring': base64.b64encode('secret!'),
31 'gpg-public-keyring': base64.b64encode('public?'),
32+ 'launchpad-credentials': base64.b64encode('launchpad!'),
33 }
34 self.config.return_value.update(config)
35
36@@ -108,12 +109,13 @@
37 self.assertEqual(['keys'], os.listdir(self.service_dir))
38 keys = sorted(os.listdir(self.keys_dir))
39 self.assertEqual(
40- ['gpg.pub', 'gpg.sec', 'id_rsa', 'id_rsa.pub'], keys)
41+ ['gpg.pub', 'gpg.sec', 'id_rsa', 'id_rsa.pub',
42+ 'launchpad.credentials'], keys)
43
44 def test_juju_info_joined(self):
45- # Keys are placed immediatelly when the subordinate charm is bound.
46+ # Keys are placed immediately when the subordinate charm is bound.
47 os.makedirs(self.service_dir)
48- self.config.return_value['ssh-private-key'] = base64.b64encode(
49+ self.config.return_value['ssh-private-key'] = base64.b64encode(
50 'secret!')
51
52 hooks.hooks.execute(['hooks/juju-info-relation-joined'])

Subscribers

People subscribed via source and target branches