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
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) Approve
Paul Larson Needs Resubmitting
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.
Revision history for this message
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

use unhidden version of launchpad.credentials file

Revision history for this message
Paul Larson (pwlars) wrote :

done

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

Missing tests, as discussed on IRC.

review: Needs Fixing
5. By Paul Larson

Add launchpad.credentials to the testcase

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
=== modified file 'config.yaml'
--- config.yaml 2014-11-25 16:46:29 +0000
+++ config.yaml 2014-12-04 19:04:34 +0000
@@ -15,3 +15,6 @@
15 gpg-public-keyring:15 gpg-public-keyring:
16 type: string16 type: string
17 description: Public GPG keyring (gpg.pub)17 description: Public GPG keyring (gpg.pub)
18 launchpad-credentials:
19 type: string
20 description: Launchpad credentials
1821
=== modified file 'hooks/hooks.py'
--- hooks/hooks.py 2014-11-25 16:46:29 +0000
+++ hooks/hooks.py 2014-12-04 19:04:34 +0000
@@ -63,6 +63,8 @@
63 _install_key(config['gpg-secret-keyring'], keys_dir, 'gpg.sec')63 _install_key(config['gpg-secret-keyring'], keys_dir, 'gpg.sec')
64 _install_key(config['ssh-public-key'], keys_dir, 'id_rsa.pub')64 _install_key(config['ssh-public-key'], keys_dir, 'id_rsa.pub')
65 _install_key(config['ssh-private-key'], keys_dir, 'id_rsa')65 _install_key(config['ssh-private-key'], keys_dir, 'id_rsa')
66 _install_key(config['launchpad-credentials'], keys_dir,
67 'launchpad.credentials')
66 except IOError as exc:68 except IOError as exc:
67 juju_info('Cannot install keys: {}'.format(exc))69 juju_info('Cannot install keys: {}'.format(exc))
68 if os.path.exists(keys_dir):70 if os.path.exists(keys_dir):
6971
=== modified file 'unit_tests/test_hooks.py'
--- unit_tests/test_hooks.py 2014-11-25 16:46:29 +0000
+++ unit_tests/test_hooks.py 2014-12-04 19:04:34 +0000
@@ -101,6 +101,7 @@
101 'ssh-public-key': base64.b64encode('public?'),101 'ssh-public-key': base64.b64encode('public?'),
102 'gpg-secret-keyring': base64.b64encode('secret!'),102 'gpg-secret-keyring': base64.b64encode('secret!'),
103 'gpg-public-keyring': base64.b64encode('public?'),103 'gpg-public-keyring': base64.b64encode('public?'),
104 'launchpad-credentials': base64.b64encode('launchpad!'),
104 }105 }
105 self.config.return_value.update(config)106 self.config.return_value.update(config)
106107
@@ -108,12 +109,13 @@
108 self.assertEqual(['keys'], os.listdir(self.service_dir))109 self.assertEqual(['keys'], os.listdir(self.service_dir))
109 keys = sorted(os.listdir(self.keys_dir))110 keys = sorted(os.listdir(self.keys_dir))
110 self.assertEqual(111 self.assertEqual(
111 ['gpg.pub', 'gpg.sec', 'id_rsa', 'id_rsa.pub'], keys)112 ['gpg.pub', 'gpg.sec', 'id_rsa', 'id_rsa.pub',
113 'launchpad.credentials'], keys)
112114
113 def test_juju_info_joined(self):115 def test_juju_info_joined(self):
114 # Keys are placed immediatelly when the subordinate charm is bound.116 # Keys are placed immediately when the subordinate charm is bound.
115 os.makedirs(self.service_dir)117 os.makedirs(self.service_dir)
116 self.config.return_value['ssh-private-key'] = base64.b64encode(118 self.config.return_value['ssh-private-key'] = base64.b64encode(
117 'secret!')119 'secret!')
118120
119 hooks.hooks.execute(['hooks/juju-info-relation-joined'])121 hooks.hooks.execute(['hooks/juju-info-relation-joined'])

Subscribers

People subscribed via source and target branches