focal: cherry pick 4f62ae8#764
Merged
Merged
Conversation
Collaborator
Author
|
I've confirmed this works using my test from #761. |
blackboxsw
approved these changes
Jan 11, 2021
Collaborator
blackboxsw
left a comment
There was a problem hiding this comment.
LGTM:
- Confirmed minor diff from my own cherry-pick
diff --git a/debian/changelog b/debian/changelog
index f34b4707..76d12d4a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,7 +3,7 @@ cloud-init (20.4-0ubuntu1~20.04.2) focal; urgency=medium
* cherry-pick 4f62ae8d: Fix regression with handling of IMDS ssh keys
(#760) (LP: #1910835)
- -- Daniel Watkins <oddbloke@ubuntu.com> Mon, 11 Jan 2021 17:20:13 -0500
+ -- Chad Smith <chad.smith@canonical.com> Mon, 11 Jan 2021 15:25:31 -0700
cloud-init (20.4-0ubuntu1~20.04.1) focal; urgency=medium
- build-package succeeds
- sbuilt-it succeeds
- quilt push -a applies all patches with proper diff
diff --git a/cloudinit/sources/DataSourceAzure.py b/cloudinit/sources/DataSourceAzure.py
index 04ff2131..647e3d28 100755
--- a/cloudinit/sources/DataSourceAzure.py
+++ b/cloudinit/sources/DataSourceAzure.py
@@ -651,6 +651,10 @@ class DataSourceAzure(sources.DataSource):
LOG.debug('Retrieving public SSH keys')
ssh_keys = []
try:
+ raise KeyError(
+ "Not using public SSH keys from IMDS"
+ )
+ # pylint:disable=unreachable
ssh_keys = [
public_key['keyData']
for public_key
@@ -1271,6 +1275,10 @@ class DataSourceAzure(sources.DataSource):
pubkey_info = None
try:
+ raise KeyError(
+ "Not using public SSH keys from IMDS"
+ )
+ # pylint:disable=unreachable
public_keys = self.metadata['imds']['compute']['publicKeys']
LOG.debug(
'Successfully retrieved %s key(s) from IMDS',
diff --git a/debian/changelog b/debian/changelog
index 1e858efd..76d12d4a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,7 +1,7 @@
cloud-init (20.4-0ubuntu1~20.04.2) focal; urgency=medium
* cherry-pick 4f62ae8d: Fix regression with handling of IMDS ssh keys
- (#760)
+ (#760) (LP: #1910835)
-- Chad Smith <chad.smith@canonical.com> Mon, 11 Jan 2021 15:25:31 -0700
diff --git a/tests/unittests/test_datasource/test_azure.py b/tests/unittests/test_datasource/test_azure.py
index e363c1f9..be7bc1b4 100644
--- a/tests/unittests/test_datasource/test_azure.py
+++ b/tests/unittests/test_datasource/test_azure.py
@@ -1757,7 +1757,9 @@ scbus-1 on xpt0 bus 0
dsrc.get_data()
dsrc.setup(True)
ssh_keys = dsrc.get_public_ssh_keys()
- self.assertEqual(ssh_keys, ['key1'])
+ # Temporarily alter this test so that SSH public keys
+ # from IMDS are *not* going to be in use to fix a regression.
+ self.assertEqual(ssh_keys, [])
self.assertEqual(m_parse_certificates.call_count, 0)
@mock.patch(MOCKPATH + 'get_metadata_from_imds')
- quilt pop -a removes all patches
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.