dede5bd1d4
OBS-URL: https://build.opensuse.org/package/show/systemsmanagement:saltstack/salt?expand=0&rev=166
55 lines
1.6 KiB
Diff
55 lines
1.6 KiB
Diff
From 615a8f8dfa8ef12eeb4c387e48309cc466b8597d 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 4ec9158476..3b0d8423db 100644
|
|
--- a/salt/modules/aptpkg.py
|
|
+++ b/salt/modules/aptpkg.py
|
|
@@ -1620,6 +1620,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
|
|
@@ -1635,7 +1656,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
|
|
|
|
|