diff options
Diffstat (limited to 'cloudinit/sources/helpers/azure.py')
-rw-r--r-- | cloudinit/sources/helpers/azure.py | 57 |
1 files changed, 1 insertions, 56 deletions
diff --git a/cloudinit/sources/helpers/azure.py b/cloudinit/sources/helpers/azure.py index d4fc04e2..c0ffd760 100644 --- a/cloudinit/sources/helpers/azure.py +++ b/cloudinit/sources/helpers/azure.py @@ -1,6 +1,5 @@ # This file is part of cloud-init. See LICENSE file for license information. import base64 -import enum import json import logging import os @@ -17,7 +16,7 @@ from typing import Callable, List, Optional, TypeVar, Union from xml.etree import ElementTree from xml.sax.saxutils import escape -from cloudinit import distros, dmi, subp, temp_utils, url_helper, util, version +from cloudinit import distros, subp, temp_utils, url_helper, util, version from cloudinit.reporting import events from cloudinit.settings import CFG_BUILTIN @@ -65,34 +64,6 @@ def azure_ds_telemetry_reporter(func: Callable[..., T]) -> Callable[..., T]: return impl -def is_byte_swapped(previous_id, current_id): - """ - Azure stores the instance ID with an incorrect byte ordering for the - first parts. This corrects the byte order such that it is consistent with - that returned by the metadata service. - """ - if previous_id == current_id: - return False - - def swap_bytestring(s, width=2): - dd = [byte for byte in textwrap.wrap(s, 2)] - dd.reverse() - return "".join(dd) - - parts = current_id.split("-") - swapped_id = "-".join( - [ - swap_bytestring(parts[0]), - swap_bytestring(parts[1]), - swap_bytestring(parts[2]), - parts[3], - parts[4], - ] - ) - - return previous_id == swapped_id - - @azure_ds_telemetry_reporter def get_boot_telemetry(): """Report timestamps related to kernel initialization and systemd @@ -1079,32 +1050,6 @@ class NonAzureDataSource(Exception): pass -class ChassisAssetTag(enum.Enum): - AZURE_CLOUD = "7783-7084-3265-9085-8269-3286-77" - - @classmethod - def query_system(cls) -> Optional["ChassisAssetTag"]: - """Check platform environment to report if this datasource may run. - - :returns: ChassisAssetTag if matching tag found, else None. - """ - asset_tag = dmi.read_dmi_data("chassis-asset-tag") - try: - tag = cls(asset_tag) - except ValueError: - report_diagnostic_event( - "Non-Azure chassis asset tag: %r" % asset_tag, - logger_func=LOG.debug, - ) - return None - - report_diagnostic_event( - "Azure chassis asset tag: %r (%s)" % (asset_tag, tag.name), - logger_func=LOG.debug, - ) - return tag - - class OvfEnvXml: NAMESPACES = { "ovf": "http://schemas.dmtf.org/ovf/environment/1", |