mirror of
https://github.com/saltstack/salt.git
synced 2025-04-10 23:01:39 +00:00
Fix some failing tests
Some checks failed
CI / Prepare Workflow Run (push) Has been cancelled
CI / Pre-Commit (push) Has been cancelled
CI / Lint (push) Has been cancelled
CI / NSIS Tests (push) Has been cancelled
CI / Prepare Release: (push) Has been cancelled
CI / Documentation (push) Has been cancelled
CI / Build Source Tarball (push) Has been cancelled
CI / Build Onedir Dependencies (push) Has been cancelled
CI / Build Salt Onedir (push) Has been cancelled
CI / Build Packages (push) Has been cancelled
CI / CI Deps (push) Has been cancelled
CI / Test Package (push) Has been cancelled
CI / Test Salt (push) Has been cancelled
CI / Combine Code Coverage (push) Has been cancelled
CI / Set the Pipeline Exit Status (push) Has been cancelled
Some checks failed
CI / Prepare Workflow Run (push) Has been cancelled
CI / Pre-Commit (push) Has been cancelled
CI / Lint (push) Has been cancelled
CI / NSIS Tests (push) Has been cancelled
CI / Prepare Release: (push) Has been cancelled
CI / Documentation (push) Has been cancelled
CI / Build Source Tarball (push) Has been cancelled
CI / Build Onedir Dependencies (push) Has been cancelled
CI / Build Salt Onedir (push) Has been cancelled
CI / Build Packages (push) Has been cancelled
CI / CI Deps (push) Has been cancelled
CI / Test Package (push) Has been cancelled
CI / Test Salt (push) Has been cancelled
CI / Combine Code Coverage (push) Has been cancelled
CI / Set the Pipeline Exit Status (push) Has been cancelled
This commit is contained in:
parent
dd2c86d844
commit
4fa83b77a4
2 changed files with 23 additions and 10 deletions
|
@ -367,7 +367,15 @@ def list_repo_pkgs(*args, saltenv="base", **kwargs):
|
|||
# Generate a list of packages and their available versions
|
||||
repo_pkgs = {}
|
||||
for pkg in pkgs:
|
||||
repo_pkgs.update({pkg: list(pkgs[pkg].keys())})
|
||||
repo_pkgs.update(
|
||||
{
|
||||
pkg: sorted(
|
||||
list(pkgs[pkg].keys()),
|
||||
key=cmp_to_key(_reverse_cmp_pkg_versions),
|
||||
reverse=True,
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
# If no args passed, just return everything
|
||||
if not args:
|
||||
|
@ -376,13 +384,17 @@ def list_repo_pkgs(*args, saltenv="base", **kwargs):
|
|||
# Loop through the args and return info for each specified package
|
||||
ret = {}
|
||||
for arg in args:
|
||||
if "=" in arg:
|
||||
pkg_name, pkg_version = arg.split("=")
|
||||
else:
|
||||
pkg_name = arg
|
||||
pkg_version = ""
|
||||
for pkg in repo_pkgs:
|
||||
if fnmatch(pkg, arg):
|
||||
ret.update({pkg: repo_pkgs[pkg]})
|
||||
|
||||
# If ret is empty, return everything
|
||||
if not ret:
|
||||
ret = repo_pkgs
|
||||
if fnmatch(pkg, pkg_name):
|
||||
if pkg_version and pkg_version in repo_pkgs[pkg]:
|
||||
ret.setdefault(pkg, []).append(pkg_version)
|
||||
else:
|
||||
ret.setdefault(pkg, []).extend(repo_pkgs[pkg])
|
||||
|
||||
return ret
|
||||
|
||||
|
|
|
@ -76,10 +76,11 @@ def test_list_available(pkg, repo, as_dict, reverse, expected):
|
|||
@pytest.mark.parametrize(
|
||||
"pkg_name, expected",
|
||||
[
|
||||
("my-software", {"my-software": ["1.0.1", "1.0.2"]}),
|
||||
("my-soft*", {"my-software": ["1.0.1", "1.0.2"]}),
|
||||
("my-software", {"my-software": ["1.0.2", "1.0.1"]}),
|
||||
("my-software=1.0.1", {"my-software": ["1.0.1"]}),
|
||||
("my-soft*", {"my-software": ["1.0.2", "1.0.1"]}),
|
||||
("your-software", {"your-software": ["1.0.0"]}),
|
||||
(None, {"my-software": ["1.0.1", "1.0.2"], "your-software": ["1.0.0"]}),
|
||||
(None, {"my-software": ["1.0.2", "1.0.1"], "your-software": ["1.0.0"]}),
|
||||
],
|
||||
)
|
||||
def test_list_repo_pkgs(pkg, repo, pkg_name, expected):
|
||||
|
|
Loading…
Add table
Reference in a new issue