-
Notifications
You must be signed in to change notification settings - Fork 3
/
openshift_mirror
executable file
·70 lines (61 loc) · 1.81 KB
/
openshift_mirror
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env python3
"""
Utility for mirroring OpenShift 4 content.
"""
import logging
import logging.config
import os
from app.bundle import OpenShiftMirrorBundle
from app.cli import CLI
from app.runtime import OpenShiftMirrorRuntime
LOGGING_CONFIG = {
'version': 1,
'formatters': {
'simple': {
'format':
'%(asctime)-8s | %(levelname)-8s | %(name)-10s | %(message)s',
'datefmt': '%H:%M:%S',
},
},
'handlers': {
'console': {
'class': 'logging.StreamHandler',
'level': os.environ.get('OPENSHIFT_MIRROR_LOGLEVEL', 'INFO'),
'formatter': 'simple',
},
},
'loggers': {
'app': {
'level': os.environ.get('OPENSHIFT_MIRROR_LOGLEVEL', 'INFO'),
'handlers': [
'console',
],
'propagate': 'no',
},
},
}
logging.config.dictConfig(LOGGING_CONFIG)
logger = logging.getLogger('app')
if __name__ == '__main__':
cli = CLI()
known_args, extra_args = cli.parse_known_args()
if known_args.action == 'bundle':
b = OpenShiftMirrorBundle(
openshift_version=known_args.openshift_version,
pull_secret=known_args.pull_secret,
platform=known_args.platform,
catalogs=known_args.catalogs,
bundle_dir=known_args.bundle_dir,
skip_existing=known_args.skip_existing,
skip_release=known_args.skip_release,
skip_catalogs=known_args.skip_catalogs,
skip_rhcos=known_args.skip_rhcos,
)
b.bundle()
b.delete_pull_secret()
elif known_args.action == 'build':
r = OpenShiftMirrorRuntime()
r.build_container()
elif known_args.action == 'shell':
r = OpenShiftMirrorRuntime()
r.shell()