Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions cloudinit/sources/DataSourceAzure.py
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,10 @@ def get_public_ssh_keys(self):
LOG.debug('Retrieving public SSH keys')
ssh_keys = []
try:
raise KeyError(
"Not using public SSH keys from IMDS"
Comment thread
OddBloke marked this conversation as resolved.
)
# pylint:disable=unreachable
ssh_keys = [
public_key['keyData']
for public_key
Expand Down Expand Up @@ -1272,6 +1276,10 @@ def _negotiate(self):

pubkey_info = None
try:
raise KeyError(
"Not using public SSH keys from IMDS"
Comment thread
OddBloke marked this conversation as resolved.
)
# pylint:disable=unreachable
public_keys = self.metadata['imds']['compute']['publicKeys']
Comment thread
OddBloke marked this conversation as resolved.
LOG.debug(
'Successfully retrieved %s key(s) from IMDS',
Expand Down
4 changes: 3 additions & 1 deletion tests/unittests/test_datasource/test_azure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1797,7 +1797,9 @@ def test_get_public_ssh_keys_with_imds(self, m_parse_certificates):
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')
Expand Down