Skip to content

Commit

Permalink
chore: Remove broken maas code (#5219)
Browse files Browse the repository at this point in the history
  • Loading branch information
holmanb committed Apr 29, 2024
1 parent 70e87f7 commit 7eb5a1d
Showing 1 changed file with 10 additions and 18 deletions.
28 changes: 10 additions & 18 deletions cloudinit/sources/DataSourceMAAS.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ class DataSourceMAAS(sources.DataSource):
id_hash = None
_oauth_helper = None

# Setup read_url parameters per get_url_params.
url_max_wait = 120
url_timeout = 50

def __init__(self, sys_cfg, distro, paths):
sources.DataSource.__init__(self, sys_cfg, distro, paths)
self.base_url = None
Expand Down Expand Up @@ -116,30 +120,18 @@ def _get_subplatform(self):
return "seed-dir (%s)" % self.base_url

def wait_for_metadata_service(self, url):
mcfg = self.ds_cfg
max_wait = 120
try:
max_wait = int(mcfg.get("max_wait", max_wait))
except Exception:
util.logexc(LOG, "Failed to get max wait. using %s", max_wait)

if max_wait == 0:
url_params = self.get_url_params()
if url_params.max_wait_seconds == 0:
return False

timeout = 50
try:
if timeout in mcfg:
timeout = int(mcfg.get("timeout", timeout))
except Exception:
LOG.warning("Failed to get timeout, using %s", timeout)

starttime = time.time()
if url.endswith("/"):
url = url[:-1]
url = url.rstrip("/")
check_url = "%s/%s/meta-data/instance-id" % (url, MD_VERSION)
urls = [check_url]
url, _response = self.oauth_helper.wait_for_url(
urls=urls, max_wait=max_wait, timeout=timeout
urls=urls,
max_wait=url_params.max_wait_seconds,
timeout=url_params.timeout_seconds,
)

if url:
Expand Down

0 comments on commit 7eb5a1d

Please sign in to comment.