Skip to content

focal: cherry pick 4f62ae8#764

Merged
OddBloke merged 4 commits into
canonical:ubuntu/focalfrom
OddBloke:ubuntu/focal
Jan 11, 2021
Merged

focal: cherry pick 4f62ae8#764
OddBloke merged 4 commits into
canonical:ubuntu/focalfrom
OddBloke:ubuntu/focal

Conversation

@OddBloke
Copy link
Copy Markdown
Collaborator

No description provided.

@OddBloke
Copy link
Copy Markdown
Collaborator Author

I've confirmed this works using my test from #761.

Copy link
Copy Markdown
Collaborator

@blackboxsw blackboxsw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM:

  1. 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
 
  1. build-package succeeds
  2. sbuilt-it succeeds
  3. 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')
  1. quilt pop -a removes all patches

@OddBloke OddBloke merged commit 1f5e050 into canonical:ubuntu/focal Jan 11, 2021
@OddBloke OddBloke deleted the ubuntu/focal branch January 11, 2021 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants