mirror of
https://github.com/saltstack/salt.git
synced 2025-04-16 09:40:20 +00:00
Replace lsb_distrib_codename by oscodename
Signed-off-by: Benjamin Drung <bdrung@ubuntu.com>
This commit is contained in:
parent
13d4751270
commit
733c68646b
4 changed files with 17 additions and 17 deletions
|
@ -1947,7 +1947,7 @@ def get_repo(repo, **kwargs):
|
|||
if repo.startswith("ppa:") and __grains__["os"] in ("Ubuntu", "Mint", "neon"):
|
||||
# This is a PPA definition meaning special handling is needed
|
||||
# to derive the name.
|
||||
dist = __grains__["lsb_distrib_codename"]
|
||||
dist = __grains__["oscodename"]
|
||||
owner_name, ppa_name = repo[4:].split("/")
|
||||
if ppa_auth:
|
||||
auth_info = "{}@".format(ppa_auth)
|
||||
|
@ -2029,7 +2029,7 @@ def del_repo(repo, **kwargs):
|
|||
# This is a PPA definition meaning special handling is needed
|
||||
# to derive the name.
|
||||
is_ppa = True
|
||||
dist = __grains__["lsb_distrib_codename"]
|
||||
dist = __grains__["oscodename"]
|
||||
if not HAS_SOFTWAREPROPERTIES:
|
||||
_warn_software_properties(repo)
|
||||
owner_name, ppa_name = repo[4:].split("/")
|
||||
|
@ -2664,7 +2664,7 @@ def mod_repo(repo, saltenv="base", aptkey=True, **kwargs):
|
|||
"(e.g. saltstack/salt) not found. Received "
|
||||
"'{}' instead.".format(repo[4:])
|
||||
)
|
||||
dist = __grains__["lsb_distrib_codename"]
|
||||
dist = __grains__["oscodename"]
|
||||
# ppa has a lot of implicit arguments. Make them explicit.
|
||||
# These will defer to any user-defined variants
|
||||
kwargs["dist"] = dist
|
||||
|
@ -3007,7 +3007,7 @@ def file_dict(*packages, **kwargs):
|
|||
return __salt__["lowpkg.file_dict"](*packages)
|
||||
|
||||
|
||||
def _expand_repo_def(os_name, lsb_distrib_codename=None, **kwargs):
|
||||
def _expand_repo_def(os_name, os_codename=None, **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
|
||||
|
@ -3022,7 +3022,7 @@ def _expand_repo_def(os_name, lsb_distrib_codename=None, **kwargs):
|
|||
sanitized = {}
|
||||
repo = kwargs["repo"]
|
||||
if repo.startswith("ppa:") and os_name in ("Ubuntu", "Mint", "neon"):
|
||||
dist = lsb_distrib_codename
|
||||
dist = os_codename
|
||||
owner_name, ppa_name = repo[4:].split("/", 1)
|
||||
if "ppa_auth" in kwargs:
|
||||
auth_info = "{}@".format(kwargs["ppa_auth"])
|
||||
|
@ -3134,8 +3134,11 @@ def expand_repo_def(**kwargs):
|
|||
)
|
||||
if "os_name" not in kwargs:
|
||||
kwargs["os_name"] = __grains__["os"]
|
||||
if "lsb_distrib_codename" not in kwargs:
|
||||
kwargs["lsb_distrib_codename"] = __grains__.get("lsb_distrib_codename")
|
||||
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)
|
||||
|
||||
|
||||
|
|
|
@ -474,13 +474,10 @@ def managed(name, ppa=None, copr=None, aptkey=True, **kwargs):
|
|||
from salt.modules.aptpkg import _expand_repo_def
|
||||
|
||||
os_name = __grains__["os"]
|
||||
lsb_distrib_codename = __grains__["lsb_distrib_codename"]
|
||||
os_codename = __grains__["oscodename"]
|
||||
|
||||
sanitizedkwargs = _expand_repo_def(
|
||||
os_name=os_name,
|
||||
lsb_distrib_codename=lsb_distrib_codename,
|
||||
repo=repo,
|
||||
**kwargs
|
||||
os_name=os_name, os_codename=os_codename, repo=repo, **kwargs
|
||||
)
|
||||
else:
|
||||
sanitizedkwargs = kwargs
|
||||
|
|
|
@ -218,7 +218,7 @@ def test__expand_repo_def(grains):
|
|||
test_repo, comps = get_current_repo()
|
||||
ret = aptpkg._expand_repo_def(
|
||||
os_name=grains["os"],
|
||||
lsb_distrib_codename=grains.get("lsb_distrib_codename"),
|
||||
os_codename=grains.get("oscodename"),
|
||||
repo=test_repo,
|
||||
)
|
||||
for key in [
|
||||
|
|
|
@ -971,7 +971,7 @@ def test__expand_repo_def():
|
|||
# Valid source
|
||||
repo = "deb http://cdn-aws.deb.debian.org/debian/ stretch main\n"
|
||||
sanitized = aptpkg._expand_repo_def(
|
||||
os_name="debian", lsb_distrib_codename="stretch", repo=repo, file=source_file
|
||||
os_name="debian", os_codename="stretch", repo=repo, file=source_file
|
||||
)
|
||||
|
||||
assert isinstance(sanitized, dict)
|
||||
|
@ -984,7 +984,7 @@ def test__expand_repo_def():
|
|||
repo = "deb http://cdn-aws.deb.debian.org/debian/ stretch main\n"
|
||||
sanitized = aptpkg._expand_repo_def(
|
||||
os_name="debian",
|
||||
lsb_distrib_codename="stretch",
|
||||
os_codename="stretch",
|
||||
repo=repo,
|
||||
file=source_file,
|
||||
architectures="amd64",
|
||||
|
@ -1010,7 +1010,7 @@ 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", lsb_distrib_codename="bullseye", repo=repo, file=source_file
|
||||
os_name="debian", os_codename="bullseye", repo=repo, file=source_file
|
||||
)
|
||||
|
||||
assert isinstance(sanitized, dict)
|
||||
|
@ -1023,7 +1023,7 @@ def test__expand_repo_def_cdrom():
|
|||
repo = "deb http://cdn-aws.deb.debian.org/debian/ stretch main\n"
|
||||
sanitized = aptpkg._expand_repo_def(
|
||||
os_name="debian",
|
||||
lsb_distrib_codename="stretch",
|
||||
os_codename="stretch",
|
||||
repo=repo,
|
||||
file=source_file,
|
||||
architectures="amd64",
|
||||
|
|
Loading…
Add table
Reference in a new issue