Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if hasattr(settings, 'MAX_MIRRORS') and \
isinstance(settings.MAX_MIRRORS, int):
max_mirrors = settings.MAX_MIRRORS
# only add X mirrors, where X = max_mirrors
q = Q(mirrorlist=False, refresh=True)
existing = mirror.repo.mirror_set.filter(q).count()
if existing >= max_mirrors:
text = '{0!s} mirrors already '.format(max_mirrors)
text += 'exist, not adding {0!s}'.format(mirror_url)
warning_message.send(sender=None, text=text)
continue
from repos.models import Mirror
m, c = Mirror.objects.get_or_create(repo=mirror.repo, url=mirror_url)
if c:
text = 'Added mirror - {0!s}'.format(mirror_url)
info_message.send(sender=None, text=text)
if line.startswith('%ARCH%'):
arch_sec = True
continue
if arch_sec:
arch_sec = False
arch = line
continue
package = PackageString(name=name.lower(),
epoch=epoch,
version=version,
release=release,
arch=arch,
packagetype='A')
packages.add(package)
else:
info_message.send(sender=None, text='No packages found in repo')
return packages