Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decide if the source should be actually skipped #55402

Merged
merged 14 commits into from
May 4, 2020
23 changes: 22 additions & 1 deletion salt/modules/aptpkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -1575,6 +1575,27 @@ def list_repo_pkgs(*args, **kwargs): # pylint: disable=unused-import
return ret


def _skip_source(source):
garethgreenaway marked this conversation as resolved.
Show resolved Hide resolved
'''
Decide to skip source or not.

:param source:
:return:
'''
if source.invalid:
if source.uri and source.type and source.type in ("deb", "deb-src", "rpm", "rpm-src"):
pieces = source.mysplit(source.line)
if pieces[1].strip()[0] == "[":
options = pieces.pop(1).strip("[]").split()
if len(options) > 0:
log.debug("Source %s will be included although is marked invalid", source.uri)
return False
return True
else:
return True
return False


def list_repos():
'''
Lists all repos in the sources.list (and sources.lists.d) files
Expand All @@ -1590,7 +1611,7 @@ def list_repos():
repos = {}
sources = sourceslist.SourcesList()
for source in sources.list:
if source.invalid:
if _skip_source(source):
continue
repo = {}
repo['file'] = source.file
Expand Down