sts-sponsors team mailing list archive
-
sts-sponsors team
-
Mailing list archive
-
Message #03497
[Merge] ~ack/maas:region-refresh-no-retry into maas:master
Alberto Donato has proposed merging ~ack/maas:region-refresh-no-retry into maas:master.
Commit message:
disable request retries for controller script results reporting to region
The logic used for the refresh is the same used by scrips reporting for
machines, but there's no need to retry for controllers refresh, since the
service runs every 30s anyway
Requested reviews:
MAAS Maintainers (maas-maintainers)
For more details, see:
https://code.launchpad.net/~ack/maas/+git/maas/+merge/433526
--
Your team MAAS Committers is subscribed to branch maas:master.
diff --git a/src/provisioningserver/refresh/__init__.py b/src/provisioningserver/refresh/__init__.py
index 5cd55da..d2922eb 100644
--- a/src/provisioningserver/refresh/__init__.py
+++ b/src/provisioningserver/refresh/__init__.py
@@ -69,12 +69,17 @@ def refresh(
creds,
tmpdir=tmpdir,
post_process_hook=post_process_hook,
+ retry=False,
)
if failed_scripts:
- signal_wrapper(url, creds, "FAILED", f"Failed refreshing {system_id}")
+ signal_wrapper(
+ url, creds, "FAILED", f"Failed refreshing {system_id}", retry=False
+ )
else:
- signal_wrapper(url, creds, "OK", f"Finished refreshing {system_id}")
+ signal_wrapper(
+ url, creds, "OK", f"Finished refreshing {system_id}", retry=False
+ )
SCRIPTS_BASE_PATH = os.path.dirname(__file__)
@@ -82,7 +87,9 @@ SCRIPTS_BASE_PATH = os.path.dirname(__file__)
# XXX: This method should download the scripts from the region, instead
# of relying on the scripts being available locally.
-def runscripts(scripts, url, creds, tmpdir, post_process_hook=None):
+def runscripts(
+ scripts, url, creds, tmpdir, post_process_hook=None, retry=True
+):
in_snap = running_in_snap()
total_scripts = len(scripts)
@@ -98,6 +105,7 @@ def runscripts(scripts, url, creds, tmpdir, post_process_hook=None):
creds,
"WORKING",
f"Starting {script_name} [{current_script}/{total_scripts}]",
+ retry=retry,
)
script_path = os.path.join(SCRIPTS_BASE_PATH, script_name)
@@ -154,6 +162,7 @@ def runscripts(scripts, url, creds, tmpdir, post_process_hook=None):
exit_status=exit_status,
error="Failed to execute %s [%d/%d]: %d"
% (script_name, current_script, total_scripts, exit_status),
+ retry=retry,
)
failed_scripts.append(script_name)
except TimeoutExpired:
@@ -169,6 +178,7 @@ def runscripts(scripts, url, creds, tmpdir, post_process_hook=None):
files=files,
error="Timeout(%s) expired on %s [%d/%d]"
% (str(timeout), script_name, current_script, total_scripts),
+ retry=retry,
)
failed_scripts.append(script_name)
else:
@@ -196,6 +206,7 @@ def runscripts(scripts, url, creds, tmpdir, post_process_hook=None):
total_scripts,
proc.returncode,
),
+ retry=retry,
)
if proc.returncode != 0:
failed_scripts.append(script_name)
diff --git a/src/provisioningserver/refresh/maas_api_helper.py b/src/provisioningserver/refresh/maas_api_helper.py
index 160fafc..1cbefdb 100644
--- a/src/provisioningserver/refresh/maas_api_helper.py
+++ b/src/provisioningserver/refresh/maas_api_helper.py
@@ -325,6 +325,7 @@ def signal(
script_version_id=None,
power_type=None,
power_params=None,
+ retry=True,
):
"""Send a node signal to a given maas_url."""
params = {b"op": b"signal", b"status": status.encode("utf-8")}
@@ -382,7 +383,13 @@ def signal(
data, headers = encode_multipart_data(params, files=files)
try:
- ret = geturl(url, credentials=credentials, headers=headers, data=data)
+ ret = geturl(
+ url,
+ credentials=credentials,
+ headers=headers,
+ data=data,
+ retry=retry,
+ )
if ret.status != 200:
raise SignalException(
"Unexpected status(%d) sending region commissioning data: %s"
Follow ups