Coverage for distro_tracker/core/management/commands/tracker_update_repositories.py: 0%
13 statements
« prev ^ index » next coverage.py v6.5.0, created at 2025-01-12 09:15 +0000
« prev ^ index » next coverage.py v6.5.0, created at 2025-01-12 09:15 +0000
1# Copyright 2013-2016 The Distro Tracker Developers
2# See the COPYRIGHT file at the top-level directory of this distribution and
3# at https://deb.li/DTAuthors
4#
5# This file is part of Distro Tracker. It is subject to the license terms
6# in the LICENSE file found in the top-level directory of this
7# distribution and at https://deb.li/DTLicense. No part of Distro Tracker,
8# including this file, may be copied, modified, propagated, or distributed
9# except according to the terms contained in the LICENSE file.
10"""
11Implements a command to initiate the update of package information found in
12registered repositories.
14It launches an
15:class:`UpdateRepositoriesTask
16<distro_tracker.core.retrieve_data.UpdateRepositoriesTask>` task.
17"""
18from django.core.management.base import BaseCommand
20from distro_tracker.core.retrieve_data import UpdateRepositoriesTask
21from distro_tracker.core.tasks import run_task
24class Command(BaseCommand):
25 """
26 A management command which updates package information found in all
27 registered repositories.
28 """
29 help = ( # noqa
30 "Update the package information found in registered repositories")
32 def add_arguments(self, parser):
33 parser.add_argument(
34 '--force-update',
35 action='store_true',
36 dest='force_update',
37 default=False,
38 help=(
39 'Force the update. '
40 'This clears any caches and makes a full update'
41 )
42 )
44 def handle(self, *args, **kwargs):
45 params = {}
46 if kwargs['force_update']:
47 params['force_update'] = True
49 run_task(UpdateRepositoriesTask, **params)