diff --git a/changelog/64909.deprecated.md b/changelog/64909.deprecated.md new file mode 100644 index 00000000000..c26549c5926 --- /dev/null +++ b/changelog/64909.deprecated.md @@ -0,0 +1 @@ +Deprecate all the Apache modules diff --git a/salt/modules/deb_apache.py b/salt/modules/deb_apache.py index 0266cbc72eb..9382af153c6 100644 --- a/salt/modules/deb_apache.py +++ b/salt/modules/deb_apache.py @@ -16,6 +16,12 @@ log = logging.getLogger(__name__) __virtualname__ = "apache" +__deprecated__ = ( + 3009, + "apache", + "https://github.com/salt-extensions/saltext-apache", +) + SITE_ENABLED_DIR = "/etc/apache2/sites-enabled" @@ -59,12 +65,10 @@ def check_site_enabled(site): if site.endswith(".conf"): site_file = site else: - site_file = "{}.conf".format(site) - if os.path.islink("{}/{}".format(SITE_ENABLED_DIR, site_file)): + site_file = f"{site}.conf" + if os.path.islink(f"{SITE_ENABLED_DIR}/{site_file}"): return True - elif site == "default" and os.path.islink( - "{}/000-{}".format(SITE_ENABLED_DIR, site_file) - ): + elif site == "default" and os.path.islink(f"{SITE_ENABLED_DIR}/000-{site_file}"): return True else: return False @@ -95,9 +99,9 @@ def a2ensite(site): ret["Site"] = site if status == 1: - ret["Status"] = "Site {} Not found".format(site) + ret["Status"] = f"Site {site} Not found" elif status == 0: - ret["Status"] = "Site {} enabled".format(site) + ret["Status"] = f"Site {site} enabled" else: ret["Status"] = status @@ -129,9 +133,9 @@ def a2dissite(site): ret["Site"] = site if status == 256: - ret["Status"] = "Site {} Not found".format(site) + ret["Status"] = f"Site {site} Not found" elif status == 0: - ret["Status"] = "Site {} disabled".format(site) + ret["Status"] = f"Site {site} disabled" else: ret["Status"] = status @@ -156,8 +160,8 @@ def check_mod_enabled(mod): if mod.endswith(".load") or mod.endswith(".conf"): mod_file = mod else: - mod_file = "{}.load".format(mod) - return os.path.islink("/etc/apache2/mods-enabled/{}".format(mod_file)) + mod_file = f"{mod}.load" + return os.path.islink(f"/etc/apache2/mods-enabled/{mod_file}") def a2enmod(mod): @@ -185,9 +189,9 @@ def a2enmod(mod): ret["Mod"] = mod if status == 1: - ret["Status"] = "Mod {} Not found".format(mod) + ret["Status"] = f"Mod {mod} Not found" elif status == 0: - ret["Status"] = "Mod {} enabled".format(mod) + ret["Status"] = f"Mod {mod} enabled" else: ret["Status"] = status @@ -219,9 +223,9 @@ def a2dismod(mod): ret["Mod"] = mod if status == 256: - ret["Status"] = "Mod {} Not found".format(mod) + ret["Status"] = f"Mod {mod} Not found" elif status == 0: - ret["Status"] = "Mod {} disabled".format(mod) + ret["Status"] = f"Mod {mod} disabled" else: ret["Status"] = status @@ -247,8 +251,8 @@ def check_conf_enabled(conf): if conf.endswith(".conf"): conf_file = conf else: - conf_file = "{}.conf".format(conf) - return os.path.islink("/etc/apache2/conf-enabled/{}".format(conf_file)) + conf_file = f"{conf}.conf" + return os.path.islink(f"/etc/apache2/conf-enabled/{conf_file}") @salt.utils.decorators.path.which("a2enconf") @@ -279,9 +283,9 @@ def a2enconf(conf): ret["Conf"] = conf if status == 1: - ret["Status"] = "Conf {} Not found".format(conf) + ret["Status"] = f"Conf {conf} Not found" elif status == 0: - ret["Status"] = "Conf {} enabled".format(conf) + ret["Status"] = f"Conf {conf} enabled" else: ret["Status"] = status @@ -316,9 +320,9 @@ def a2disconf(conf): ret["Conf"] = conf if status == 256: - ret["Status"] = "Conf {} Not found".format(conf) + ret["Status"] = f"Conf {conf} Not found" elif status == 0: - ret["Status"] = "Conf {} disabled".format(conf) + ret["Status"] = f"Conf {conf} disabled" else: ret["Status"] = status diff --git a/salt/modules/suse_apache.py b/salt/modules/suse_apache.py index 7c599b34a83..b1296b0d6f1 100644 --- a/salt/modules/suse_apache.py +++ b/salt/modules/suse_apache.py @@ -14,6 +14,12 @@ log = logging.getLogger(__name__) __virtualname__ = "apache" +__deprecated__ = ( + 3009, + "apache", + "https://github.com/salt-extensions/saltext-apache", +) + def __virtual__(): """ @@ -73,9 +79,9 @@ def a2enmod(mod): ret["Mod"] = mod if status == 1: - ret["Status"] = "Mod {} Not found".format(mod) + ret["Status"] = f"Mod {mod} Not found" elif status == 0: - ret["Status"] = "Mod {} enabled".format(mod) + ret["Status"] = f"Mod {mod} enabled" else: ret["Status"] = status @@ -104,9 +110,9 @@ def a2dismod(mod): ret["Mod"] = mod if status == 256: - ret["Status"] = "Mod {} Not found".format(mod) + ret["Status"] = f"Mod {mod} Not found" elif status == 0: - ret["Status"] = "Mod {} disabled".format(mod) + ret["Status"] = f"Mod {mod} disabled" else: ret["Status"] = status diff --git a/salt/states/apache.py b/salt/states/apache.py index 8b340b7de48..9bd7779e9fc 100644 --- a/salt/states/apache.py +++ b/salt/states/apache.py @@ -90,6 +90,12 @@ import os import salt.utils.files import salt.utils.stringutils +__deprecated__ = ( + 3009, + "apache", + "https://github.com/salt-extensions/saltext-apache", +) + def __virtual__(): if "apache.config" in __salt__: diff --git a/salt/states/apache_conf.py b/salt/states/apache_conf.py index 3521ebbeb15..7773da5e58f 100644 --- a/salt/states/apache_conf.py +++ b/salt/states/apache_conf.py @@ -18,6 +18,12 @@ Enable and disable apache confs. import salt.utils.path +__deprecated__ = ( + 3009, + "apache", + "https://github.com/salt-extensions/saltext-apache", +) + def __virtual__(): """ @@ -40,7 +46,7 @@ def enabled(name): is_enabled = __salt__["apache.check_conf_enabled"](name) if not is_enabled: if __opts__["test"]: - msg = "Apache conf {} is set to be enabled.".format(name) + msg = f"Apache conf {name} is set to be enabled." ret["comment"] = msg ret["changes"]["old"] = None ret["changes"]["new"] = name @@ -53,12 +59,12 @@ def enabled(name): ret["changes"]["new"] = name else: ret["result"] = False - ret["comment"] = "Failed to enable {} Apache conf".format(name) + ret["comment"] = f"Failed to enable {name} Apache conf" if isinstance(status, str): - ret["comment"] = ret["comment"] + " ({})".format(status) + ret["comment"] = ret["comment"] + f" ({status})" return ret else: - ret["comment"] = "{} already enabled.".format(name) + ret["comment"] = f"{name} already enabled." return ret @@ -74,7 +80,7 @@ def disabled(name): is_enabled = __salt__["apache.check_conf_enabled"](name) if is_enabled: if __opts__["test"]: - msg = "Apache conf {} is set to be disabled.".format(name) + msg = f"Apache conf {name} is set to be disabled." ret["comment"] = msg ret["changes"]["old"] = name ret["changes"]["new"] = None @@ -87,10 +93,10 @@ def disabled(name): ret["changes"]["new"] = None else: ret["result"] = False - ret["comment"] = "Failed to disable {} Apache conf".format(name) + ret["comment"] = f"Failed to disable {name} Apache conf" if isinstance(status, str): - ret["comment"] = ret["comment"] + " ({})".format(status) + ret["comment"] = ret["comment"] + f" ({status})" return ret else: - ret["comment"] = "{} already disabled.".format(name) + ret["comment"] = f"{name} already disabled." return ret diff --git a/salt/states/apache_module.py b/salt/states/apache_module.py index a61de00223b..3317d39d14a 100644 --- a/salt/states/apache_module.py +++ b/salt/states/apache_module.py @@ -16,6 +16,12 @@ Enable and disable apache modules. - name: cgi """ +__deprecated__ = ( + 3009, + "apache", + "https://github.com/salt-extensions/saltext-apache", +) + def __virtual__(): """ @@ -40,7 +46,7 @@ def enabled(name): is_enabled = __salt__["apache.check_mod_enabled"](name) if not is_enabled: if __opts__["test"]: - msg = "Apache module {} is set to be enabled.".format(name) + msg = f"Apache module {name} is set to be enabled." ret["comment"] = msg ret["changes"]["old"] = None ret["changes"]["new"] = name @@ -53,12 +59,12 @@ def enabled(name): ret["changes"]["new"] = name else: ret["result"] = False - ret["comment"] = "Failed to enable {} Apache module".format(name) + ret["comment"] = f"Failed to enable {name} Apache module" if isinstance(status, str): - ret["comment"] = ret["comment"] + " ({})".format(status) + ret["comment"] = ret["comment"] + f" ({status})" return ret else: - ret["comment"] = "{} already enabled.".format(name) + ret["comment"] = f"{name} already enabled." return ret @@ -76,7 +82,7 @@ def disabled(name): is_enabled = __salt__["apache.check_mod_enabled"](name) if is_enabled: if __opts__["test"]: - msg = "Apache module {} is set to be disabled.".format(name) + msg = f"Apache module {name} is set to be disabled." ret["comment"] = msg ret["changes"]["old"] = name ret["changes"]["new"] = None @@ -89,10 +95,10 @@ def disabled(name): ret["changes"]["new"] = None else: ret["result"] = False - ret["comment"] = "Failed to disable {} Apache module".format(name) + ret["comment"] = f"Failed to disable {name} Apache module" if isinstance(status, str): - ret["comment"] = ret["comment"] + " ({})".format(status) + ret["comment"] = ret["comment"] + f" ({status})" return ret else: - ret["comment"] = "{} already disabled.".format(name) + ret["comment"] = f"{name} already disabled." return ret diff --git a/salt/states/apache_site.py b/salt/states/apache_site.py index 6ba92b2a3cc..353e65e95b3 100644 --- a/salt/states/apache_site.py +++ b/salt/states/apache_site.py @@ -16,6 +16,12 @@ Enable and disable apache sites. - name: default """ +__deprecated__ = ( + 3009, + "apache", + "https://github.com/salt-extensions/saltext-apache", +) + def __virtual__(): """ @@ -38,7 +44,7 @@ def enabled(name): is_enabled = __salt__["apache.check_site_enabled"](name) if not is_enabled: if __opts__["test"]: - msg = "Apache site {} is set to be enabled.".format(name) + msg = f"Apache site {name} is set to be enabled." ret["comment"] = msg ret["changes"]["old"] = None ret["changes"]["new"] = name @@ -51,12 +57,12 @@ def enabled(name): ret["changes"]["new"] = name else: ret["result"] = False - ret["comment"] = "Failed to enable {} Apache site".format(name) + ret["comment"] = f"Failed to enable {name} Apache site" if isinstance(status, str): - ret["comment"] = ret["comment"] + " ({})".format(status) + ret["comment"] = ret["comment"] + f" ({status})" return ret else: - ret["comment"] = "{} already enabled.".format(name) + ret["comment"] = f"{name} already enabled." return ret @@ -72,7 +78,7 @@ def disabled(name): is_enabled = __salt__["apache.check_site_enabled"](name) if is_enabled: if __opts__["test"]: - msg = "Apache site {} is set to be disabled.".format(name) + msg = f"Apache site {name} is set to be disabled." ret["comment"] = msg ret["changes"]["old"] = name ret["changes"]["new"] = None @@ -85,10 +91,10 @@ def disabled(name): ret["changes"]["new"] = None else: ret["result"] = False - ret["comment"] = "Failed to disable {} Apache site".format(name) + ret["comment"] = f"Failed to disable {name} Apache site" if isinstance(status, str): - ret["comment"] = ret["comment"] + " ({})".format(status) + ret["comment"] = ret["comment"] + f" ({status})" return ret else: - ret["comment"] = "{} already disabled.".format(name) + ret["comment"] = f"{name} already disabled." return ret