Commit bfef57dd authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

update: fix logger

parent 558d07db
Pipeline #1895 failed with stages
in 1 minute and 1 second
import logging
from django.conf import settings
from django.core.management import call_command
from django.core.management.base import BaseCommand
......@@ -8,34 +6,36 @@ from django.db.models import F, Q
from rainboard.models import Branch, Project, Repo, Robotpkg
from rainboard.utils import update_robotpkg
logger = logging.getLogger('rainboard.management.update')
class Command(BaseCommand):
help = 'Update the DB'
def handle(self, *args, **options):
logger.info(f'\nUpdating all repos\n')
def log(message):
if int(options['verbosity']) > 1:
self.stdout.write(message)
log(f'\nUpdating all repos\n')
for repo in Repo.objects.all():
logger.info(f' {repo}')
log(f' {repo}')
repo.update()
logger.info(f'\nUpdating all branches\n')
log(f'\nUpdating all branches\n')
for branch in Branch.objects.all():
logger.info(f' {branch}')
log(f' {branch}')
branch.update(pull=False)
logger.info(f'\nPulling Robotpkg\n')
log(f'\nPulling Robotpkg\n')
update_robotpkg(settings.RAINBOARD_RPKG)
logger.info(f'\nUpdating Robotpkg\n')
log(f'\nUpdating Robotpkg\n')
for robotpkg in Robotpkg.objects.all():
logger.info(f' {robotpkg}')
log(f' {robotpkg}')
robotpkg.update(pull=False)
logger.info(f'\nUpdating all projects\n')
log(f'\nUpdating all projects\n')
for project in Project.objects.all():
logger.info(f' {project}')
log(f' {project}')
project.update()
Branch.objects.filter(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment