mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Decide if the source should be actually skipped
This commit is contained in:
parent
c6638f7229
commit
7c70497eeb
1 changed files with 22 additions and 1 deletions
|
@ -1645,6 +1645,27 @@ def list_repo_pkgs(*args, **kwargs): # pylint: disable=unused-import
|
|||
return ret
|
||||
|
||||
|
||||
def _skip_source(source):
|
||||
'''
|
||||
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
|
||||
|
@ -1660,7 +1681,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
|
||||
|
|
Loading…
Add table
Reference in a new issue