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 import call_command
from 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('')
class Command(BaseCommand):
help = 'Update the DB'
def handle(self, *args, **options):'\nUpdating all repos\n')
def log(message):
if int(options['verbosity']) > 1:
log(f'\nUpdating all repos\n')
for repo in Repo.objects.all():' {repo}')
log(f' {repo}')
repo.update()'\nUpdating all branches\n')
log(f'\nUpdating all branches\n')
for branch in Branch.objects.all():' {branch}')
log(f' {branch}')
branch.update(pull=False)'\nPulling Robotpkg\n')
log(f'\nPulling Robotpkg\n')
update_robotpkg(settings.RAINBOARD_RPKG)'\nUpdating Robotpkg\n')
log(f'\nUpdating Robotpkg\n')
for robotpkg in Robotpkg.objects.all():' {robotpkg}')
log(f' {robotpkg}')
robotpkg.update(pull=False)'\nUpdating all projects\n')
log(f'\nUpdating all projects\n')
for project in Project.objects.all():' {project}')
log(f' {project}')
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