-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
67 lines (50 loc) · 1.77 KB
/
main.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
56
57
58
59
60
61
62
63
64
65
66
67
from dotenv import load_dotenv
from platforms import *
import logging
import os
load_dotenv()
class Inventoryst:
def __init__(self):
self.init_logger()
def init_logger(self):
this_logger = logging.getLogger()
if not this_logger.hasHandlers():
c_handler = logging.StreamHandler()
if os.getenv('STAGE', False) == 'dev':
c_handler.setLevel(logging.DEBUG)
this_logger.setLevel(logging.DEBUG)
else:
c_handler.setLevel(logging.INFO)
this_logger.setLevel(logging.INFO)
log_format = '%(asctime)s %(levelname)-8s %(message)s'
c_format = logging.Formatter(log_format, datefmt='%Y-%m-%d %H:%M:%S')
c_handler.setFormatter(c_format)
this_logger.addHandler(c_handler)
return this_logger
def inventorize(self):
inventories_to_fetch = os.getenv('FETCH_INVENTORIES')
# ReadTheDocs
if 'readthedocs' in inventories_to_fetch:
obj_rtd = ReadtheDocs()
obj_rtd.inventorize()
# Netlify
if 'netlify' in inventories_to_fetch:
obj_nlf = Netlify()
obj_nlf.inventorize()
# DNS (EPIK, Namecheap)
if 'dns' in inventories_to_fetch:
obj_dns = DNS()
obj_dns.inventorize()
# MySQL
if 'mysql' in inventories_to_fetch:
obj_mysql = MySQL()
obj_mysql.inventorize()
# Zoom
if 'zoom' in inventories_to_fetch:
obj_zoom = Zoom()
obj_zoom.inventorize()
if 'discourse' in inventories_to_fetch:
obj_discourse = Discourse()
obj_discourse.inventorize()
obj_inventoryst = Inventoryst()
obj_inventoryst.inventorize()