51d9b78cf8
OBS-URL: https://build.opensuse.org/package/show/systemsmanagement:saltstack/salt?expand=0&rev=156
55 lines
1.6 KiB
Diff
55 lines
1.6 KiB
Diff
From 263c8c98a5601179a53c00523a1579883e705f1f Mon Sep 17 00:00:00 2001
|
|
From: Bo Maryniuk <bo@suse.de>
|
|
Date: Tue, 4 Dec 2018 16:39:08 +0100
|
|
Subject: [PATCH] Decide if the source should be actually skipped
|
|
|
|
---
|
|
salt/modules/aptpkg.py | 23 ++++++++++++++++++++++-
|
|
1 file changed, 22 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/salt/modules/aptpkg.py b/salt/modules/aptpkg.py
|
|
index 64620647c2..4a331444c9 100644
|
|
--- a/salt/modules/aptpkg.py
|
|
+++ b/salt/modules/aptpkg.py
|
|
@@ -1574,6 +1574,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
|
|
@@ -1589,7 +1610,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
|
|
--
|
|
2.16.4
|
|
|
|
|