Merge ~daniel-thewatkins/cloud-init/+git/cloud-init:bugfix/gce-ssh-key-attributes into cloud-init:master

Proposed by Dan Watkins on 2017-05-25
Status: Merged
Merged at revision: d27c49391df343d25bd2e24045d2be6bf39c30d2
Proposed branch: ~daniel-thewatkins/cloud-init/+git/cloud-init:bugfix/gce-ssh-key-attributes
Merge into: cloud-init:master
Diff against target: 35 lines (+3/-3)
2 files modified
cloudinit/sources/DataSourceGCE.py (+1/-1)
tests/unittests/test_datasource/test_gce.py (+2/-2)
Reviewer Review Type Date Requested Status
Scott Moser 2017-05-25 Approve on 2017-05-25
Server Team CI bot continuous-integration Approve on 2017-05-25
Review via email: mp+324642@code.launchpad.net

Commit Message

Update the attribute used to find instance SSH keys in GCE

Per the documentation at
https://cloud.google.com/compute/docs/storing-retrieving-metadata

The project-level SSH key attribute has not changed in GCE, so is intentionally not changed in this change.

LP: #1693582

To post a comment you must log in.
Scott Moser (smoser) wrote :

it seems odd that they would change :
  instance/attributes/sshKeys
to
  instance/attributes/ssh-keys
while leaving the camelCase entry in project:
  project/attributes/sshKeys

Has this always been broken? Please explain that, and fix your commit message to suit.

Is 'ssh-keys' also present in project/attributes now?

It just seems odd that they'd change the name in instance/ but not in project/, but that is what your bug implies.

review: Needs Fixing
Scott Moser (smoser) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/cloudinit/sources/DataSourceGCE.py b/cloudinit/sources/DataSourceGCE.py
2index e9afda9..684eac8 100644
3--- a/cloudinit/sources/DataSourceGCE.py
4+++ b/cloudinit/sources/DataSourceGCE.py
5@@ -71,7 +71,7 @@ class DataSourceGCE(sources.DataSource):
6 ('availability-zone', ('instance/zone',), True, True),
7 ('local-hostname', ('instance/hostname',), True, True),
8 ('public-keys', ('project/attributes/sshKeys',
9- 'instance/attributes/sshKeys'), False, True),
10+ 'instance/attributes/ssh-keys'), False, True),
11 ('user-data', ('instance/attributes/user-data',), False, False),
12 ('user-data-encoding', ('instance/attributes/user-data-encoding',),
13 False, True),
14diff --git a/tests/unittests/test_datasource/test_gce.py b/tests/unittests/test_datasource/test_gce.py
15index 3eaa58e..6fd1341 100644
16--- a/tests/unittests/test_datasource/test_gce.py
17+++ b/tests/unittests/test_datasource/test_gce.py
18@@ -140,7 +140,7 @@ class TestDataSourceGCE(test_helpers.HttprettyTestCase):
19 def test_instance_level_ssh_keys_are_used(self):
20 key_content = 'ssh-rsa JustAUser root@server'
21 meta = GCE_META.copy()
22- meta['instance/attributes/sshKeys'] = 'user:{0}'.format(key_content)
23+ meta['instance/attributes/ssh-keys'] = 'user:{0}'.format(key_content)
24
25 _set_mock_metadata(meta)
26 self.ds.get_data()
27@@ -150,7 +150,7 @@ class TestDataSourceGCE(test_helpers.HttprettyTestCase):
28 def test_instance_level_keys_replace_project_level_keys(self):
29 key_content = 'ssh-rsa JustAUser root@server'
30 meta = GCE_META.copy()
31- meta['instance/attributes/sshKeys'] = 'user:{0}'.format(key_content)
32+ meta['instance/attributes/ssh-keys'] = 'user:{0}'.format(key_content)
33
34 _set_mock_metadata(meta)
35 self.ds.get_data()

Subscribers

People subscribed via source and target branches