summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Watkins <daniel.watkins@canonical.com>2017-05-25 10:21:21 -0800
committerScott Moser <smoser@brickies.net>2017-05-25 15:34:49 -0400
commitd27c49391df343d25bd2e24045d2be6bf39c30d2 (patch)
treebcd84badada315d4d724e1a68d4a45b5ef212e99
parent910ed46124e992eb20e49ea156b7127cd3ebbe9d (diff)
downloadvyos-cloud-init-d27c49391df343d25bd2e24045d2be6bf39c30d2.tar.gz
vyos-cloud-init-d27c49391df343d25bd2e24045d2be6bf39c30d2.zip
GCE: Update the attribute used to find instance SSH keys.
Per the documentation at https://cloud.google.com/compute/docs/storing-retrieving-metadata The instance-level SSH key was named 'sshKeys' and now is 'ssh-keys'. The project-level SSH key attribute has not changed so is intentionally not changed here. LP: #1693582
-rw-r--r--cloudinit/sources/DataSourceGCE.py2
-rw-r--r--tests/unittests/test_datasource/test_gce.py4
2 files changed, 3 insertions, 3 deletions
diff --git a/cloudinit/sources/DataSourceGCE.py b/cloudinit/sources/DataSourceGCE.py
index e9afda9c..684eac86 100644
--- a/cloudinit/sources/DataSourceGCE.py
+++ b/cloudinit/sources/DataSourceGCE.py
@@ -71,7 +71,7 @@ class DataSourceGCE(sources.DataSource):
('availability-zone', ('instance/zone',), True, True),
('local-hostname', ('instance/hostname',), True, True),
('public-keys', ('project/attributes/sshKeys',
- 'instance/attributes/sshKeys'), False, True),
+ 'instance/attributes/ssh-keys'), False, True),
('user-data', ('instance/attributes/user-data',), False, False),
('user-data-encoding', ('instance/attributes/user-data-encoding',),
False, True),
diff --git a/tests/unittests/test_datasource/test_gce.py b/tests/unittests/test_datasource/test_gce.py
index 3eaa58e3..6fd1341d 100644
--- a/tests/unittests/test_datasource/test_gce.py
+++ b/tests/unittests/test_datasource/test_gce.py
@@ -140,7 +140,7 @@ class TestDataSourceGCE(test_helpers.HttprettyTestCase):
def test_instance_level_ssh_keys_are_used(self):
key_content = 'ssh-rsa JustAUser root@server'
meta = GCE_META.copy()
- meta['instance/attributes/sshKeys'] = 'user:{0}'.format(key_content)
+ meta['instance/attributes/ssh-keys'] = 'user:{0}'.format(key_content)
_set_mock_metadata(meta)
self.ds.get_data()
@@ -150,7 +150,7 @@ class TestDataSourceGCE(test_helpers.HttprettyTestCase):
def test_instance_level_keys_replace_project_level_keys(self):
key_content = 'ssh-rsa JustAUser root@server'
meta = GCE_META.copy()
- meta['instance/attributes/sshKeys'] = 'user:{0}'.format(key_content)
+ meta['instance/attributes/ssh-keys'] = 'user:{0}'.format(key_content)
_set_mock_metadata(meta)
self.ds.get_data()