mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Blacken changed files
This commit is contained in:
parent
5133f0d4b9
commit
c0078a5870
2 changed files with 22 additions and 15 deletions
|
@ -1646,19 +1646,26 @@ def list_repo_pkgs(*args, **kwargs): # pylint: disable=unused-import
|
|||
|
||||
|
||||
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"):
|
||||
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)
|
||||
log.debug(
|
||||
"Source %s will be included although is marked invalid",
|
||||
source.uri,
|
||||
)
|
||||
return False
|
||||
return True
|
||||
else:
|
||||
|
|
|
@ -610,14 +610,14 @@ class AptPkgTestCase(TestCase, LoaderModuleMockMixin):
|
|||
self.assertDictEqual(list_downloaded, DOWNLOADED_RET)
|
||||
|
||||
def test__skip_source(self):
|
||||
'''
|
||||
"""
|
||||
Test __skip_source.
|
||||
:return:
|
||||
'''
|
||||
"""
|
||||
# Valid source
|
||||
source_type = 'deb'
|
||||
source_uri = 'http://cdn-aws.deb.debian.org/debian'
|
||||
source_line = 'deb http://cdn-aws.deb.debian.org/debian stretch main\n'
|
||||
source_type = "deb"
|
||||
source_uri = "http://cdn-aws.deb.debian.org/debian"
|
||||
source_line = "deb http://cdn-aws.deb.debian.org/debian stretch main\n"
|
||||
|
||||
mock_source = MockSourceEntry(source_uri, source_type, source_line, False)
|
||||
|
||||
|
@ -625,9 +625,9 @@ class AptPkgTestCase(TestCase, LoaderModuleMockMixin):
|
|||
self.assertFalse(ret)
|
||||
|
||||
# Invalid source type
|
||||
source_type = 'ded'
|
||||
source_uri = 'http://cdn-aws.deb.debian.org/debian'
|
||||
source_line = 'deb http://cdn-aws.deb.debian.org/debian stretch main\n'
|
||||
source_type = "ded"
|
||||
source_uri = "http://cdn-aws.deb.debian.org/debian"
|
||||
source_line = "deb http://cdn-aws.deb.debian.org/debian stretch main\n"
|
||||
|
||||
mock_source = MockSourceEntry(source_uri, source_type, source_line, True)
|
||||
|
||||
|
@ -635,9 +635,9 @@ class AptPkgTestCase(TestCase, LoaderModuleMockMixin):
|
|||
self.assertTrue(ret)
|
||||
|
||||
# Invalid source type , not skipped
|
||||
source_type = 'deb'
|
||||
source_uri = 'http://cdn-aws.deb.debian.org/debian'
|
||||
source_line = 'deb [http://cdn-aws.deb.debian.org/debian] stretch main\n'
|
||||
source_type = "deb"
|
||||
source_uri = "http://cdn-aws.deb.debian.org/debian"
|
||||
source_line = "deb [http://cdn-aws.deb.debian.org/debian] stretch main\n"
|
||||
|
||||
mock_source = MockSourceEntry(source_uri, source_type, source_line, True)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue