From 830232f9e991b68a05ea6bdc80f05d66988bd87e Mon Sep 17 00:00:00 2001 From: jeanluc Date: Wed, 21 Jun 2023 22:16:30 +0200 Subject: [PATCH] run pre-commit upgrade code for Py3.8+ again --- salt/states/saltutil.py | 10 +++++----- tests/pytests/unit/states/test_saltutil.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/salt/states/saltutil.py b/salt/states/saltutil.py index 703b9989f67..e99ace9be77 100644 --- a/salt/states/saltutil.py +++ b/salt/states/saltutil.py @@ -29,18 +29,18 @@ def _sync_single(name, module, **kwargs): if __opts__["test"]: ret["result"] = None - ret["comment"] = "saltutil.sync_{} would have been run".format(module) + ret["comment"] = f"saltutil.sync_{module} would have been run" return ret try: - sync_status = __salt__["saltutil.sync_{}".format(module)](**kwargs) + sync_status = __salt__[f"saltutil.sync_{module}"](**kwargs) if sync_status: ret["changes"][module] = sync_status - ret["comment"] = "Updated {}.".format(module) + ret["comment"] = f"Updated {module}." except Exception as e: # pylint: disable=broad-except log.error("Failed to run saltutil.sync_%s: %s", module, e) ret["result"] = False - ret["comment"] = "Failed to run sync_{}: {}".format(module, e) + ret["comment"] = f"Failed to run sync_{module}: {e}" return ret if not ret["changes"]: @@ -76,7 +76,7 @@ def sync_all(name, **kwargs): except Exception as e: # pylint: disable=broad-except log.error("Failed to run saltutil.sync_all: %s", e) ret["result"] = False - ret["comment"] = "Failed to run sync_all: {}".format(e) + ret["comment"] = f"Failed to run sync_all: {e}" return ret if not ret["changes"]: diff --git a/tests/pytests/unit/states/test_saltutil.py b/tests/pytests/unit/states/test_saltutil.py index 76facca1fcf..23f91caa054 100644 --- a/tests/pytests/unit/states/test_saltutil.py +++ b/tests/pytests/unit/states/test_saltutil.py @@ -142,4 +142,4 @@ def test_saltutil_sync_states_should_match_saltutil_module(): for fn in module_functions: assert ( fn in state_functions - ), "modules.saltutil.{} has no matching state in states.saltutil".format(fn) + ), f"modules.saltutil.{fn} has no matching state in states.saltutil"