-
Notifications
You must be signed in to change notification settings - Fork 12
/
qwalk.py
executable file
·55 lines (48 loc) · 1.41 KB
/
qwalk.py
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
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import os
import sys
from qwalk_worker import QTASKS, QWalkWorker
def main() -> None:
parser = argparse.ArgumentParser(
description="Walk Qumulo filesystem and do that thing."
)
parser.add_argument("-s", help="Qumulo hostname", required=True)
parser.add_argument(
"-u", help="Qumulo API user", default=os.getenv("QUSER") or "admin"
)
parser.add_argument(
"-p", help="Qumulo API password", default=os.getenv("QPASS") or "admin"
)
parser.add_argument("-d", help="Starting directory", required=True)
parser.add_argument("-g", help="Run with filesystem changes", action="store_true")
parser.add_argument("-l", help="Log file", default="output-walk-log.txt")
parser.add_argument(
"-c",
help="Class to run.",
choices=list(QTASKS.keys()),
required=True,
)
parser.add_argument("--snap", help="Snapshot id")
try:
# Will fail with missing args, but unknown args will all fall through.
args, other_args = parser.parse_known_args()
except:
print("-" * 80)
parser.print_help()
print("-" * 80)
sys.exit(0)
QWalkWorker.run_all(
args.s,
args.u,
args.p,
args.d,
args.g,
args.l,
args.c,
args.snap,
other_args,
)
if __name__ == "__main__":
main()