-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreconcile_shared_drives.py
More file actions
45 lines (35 loc) · 1.26 KB
/
reconcile_shared_drives.py
File metadata and controls
45 lines (35 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Copyright 2025 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
import logging
import sys
from django.core.management.base import BaseCommand
from endorsement.dao.shared_drive import Reconciler
logger = logging.getLogger(__name__)
class Command(BaseCommand):
help = "Loop over all shared drives verifying lifecycle and subscriptions"
def add_arguments(self, parser):
parser.add_argument(
'--no-move-drive',
action='store_true',
default=False,
help="If provided no drives will be moved.",
)
parser.add_argument(
'--missing-drive-threshold',
type=int,
default=500,
help="Skip missing drive deletion if missing drive count greater.",
)
def handle(self, *args, **options):
logger.setLevel(logging.INFO)
params = {
'no_move_drive': options['no_move_drive'],
'missing_drive_threshold': options['missing_drive_threshold'],
}
try:
Reconciler(**params).reconcile()
except Exception as ex:
logger.error(
"Reconcile shared drives failed: {}".format(ex),
exc_info=True, stack_info=True)
sys.exit(1)