Remove deprecation warning which turned into an error on Jan 2024

Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
Pedro Algarvio 2024-01-02 14:15:34 +00:00 committed by Daniel Wozniak
parent 1d0dfdecbd
commit bdf9b6b6e2
2 changed files with 3 additions and 37 deletions

View file

@ -47,7 +47,6 @@ from salt.exceptions import (
SaltInvocationError,
)
from salt.modules.cmdmod import _parse_env
from salt.utils.versions import warn_until_date
log = logging.getLogger(__name__)
@ -3116,39 +3115,6 @@ def _expand_repo_def(os_name, os_codename=None, **kwargs):
return sanitized
def expand_repo_def(**kwargs):
"""
Take a repository definition and expand it to the full pkg repository dict
that can be used for comparison. This is a helper function to make
the Debian/Ubuntu apt sources sane for comparison in the pkgrepo states.
This is designed to be called from pkgrepo states and will have little use
being called on the CLI.
CLI Examples:
.. code-block:: bash
NOT USABLE IN THE CLI
"""
warn_until_date(
"20240101",
"The pkg.expand_repo_def function is deprecated and set for removal "
"after {date}. This is only unsed internally by the apt pkg state "
"module. If that's not the case, please file an new issue requesting "
"the removal of this deprecation warning",
stacklevel=3,
)
if "os_name" not in kwargs:
kwargs["os_name"] = __grains__["os"]
if "os_codename" not in kwargs:
if "lsb_distrib_codename" in kwargs:
kwargs["os_codename"] = kwargs["lsb_distrib_codename"]
else:
kwargs["os_codename"] = __grains__.get("oscodename")
return _expand_repo_def(**kwargs)
def _parse_selections(dpkgselection):
"""
Parses the format from ``dpkg --get-selections`` and return a format that

View file

@ -1269,8 +1269,8 @@ def test_expand_repo_def_cdrom():
# Valid source
repo = "# deb cdrom:[Debian GNU/Linux 11.4.0 _Bullseye_ - Official amd64 NETINST 20220709-10:31]/ bullseye main\n"
sanitized = aptpkg.expand_repo_def(os_name="debian", repo=repo, file=source_file)
log.warning("SAN: %s", sanitized)
sanitized = aptpkg._expand_repo_def(os_name="debian", repo=repo, file=source_file)
log.debug("SAN: %s", sanitized)
assert isinstance(sanitized, dict)
assert "uri" in sanitized
@ -1280,7 +1280,7 @@ def test_expand_repo_def_cdrom():
# Pass the architecture and make sure it is added the the line attribute
repo = "deb http://cdn-aws.deb.debian.org/debian/ stretch main\n"
sanitized = aptpkg.expand_repo_def(
sanitized = aptpkg._expand_repo_def(
os_name="debian", repo=repo, file=source_file, architectures="amd64"
)