|
|
@ -137,488 +137,6 @@ def update_db_v_3_4_5_22():
|
|
|
|
print('Cannot insert version %s' % e)
|
|
|
|
print('Cannot insert version %s' % e)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def update_db_v_41(**kwargs):
|
|
|
|
|
|
|
|
cursor = conn.cursor()
|
|
|
|
|
|
|
|
sql = """
|
|
|
|
|
|
|
|
ALTER TABLE `servers` ADD COLUMN nginx INTEGER NOT NULL DEFAULT 0;
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
cursor.execute(sql)
|
|
|
|
|
|
|
|
except Exception as e:
|
|
|
|
|
|
|
|
if kwargs.get('silent') != 1:
|
|
|
|
|
|
|
|
if e.args[0] == 'duplicate column name: nginx' or str(e) == '(1060, "Duplicate column name \'nginx\'")':
|
|
|
|
|
|
|
|
print('Updating... one more for version 4.0.0')
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
print("An error occurred:", e)
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
print("Updating... one more for version 4.0.0")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def update_db_v_42(**kwargs):
|
|
|
|
|
|
|
|
cursor = conn.cursor()
|
|
|
|
|
|
|
|
sql = """
|
|
|
|
|
|
|
|
ALTER TABLE `servers` ADD COLUMN haproxy INTEGER NOT NULL DEFAULT 0;
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
cursor.execute(sql)
|
|
|
|
|
|
|
|
except Exception as e:
|
|
|
|
|
|
|
|
if kwargs.get('silent') != 1:
|
|
|
|
|
|
|
|
if e.args[0] == 'duplicate column name: haproxy' or str(e) == '(1060, "Duplicate column name \'haproxy\'")':
|
|
|
|
|
|
|
|
print('Updating... go to version 4.2.3')
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
print("An error occurred:", e)
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
print("Updating... go to version 4.2.3")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def update_db_v_4_3_0(**kwargs):
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
UserGroups.insert_from(User.select(User.user_id, User.groups),
|
|
|
|
|
|
|
|
fields=[UserGroups.user_id, UserGroups.user_group_id]).on_conflict_ignore().execute()
|
|
|
|
|
|
|
|
except Exception as e:
|
|
|
|
|
|
|
|
if kwargs.get('silent') != 1:
|
|
|
|
|
|
|
|
if e.args[0] == 'duplicate column name: haproxy' or str(e) == '(1060, "Duplicate column name \'haproxy\'")':
|
|
|
|
|
|
|
|
print('Updating... go to version 4.3.1')
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
print("An error occurred:", e)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def update_db_v_4_3_1(**kwargs):
|
|
|
|
|
|
|
|
cursor = conn.cursor()
|
|
|
|
|
|
|
|
sql = """
|
|
|
|
|
|
|
|
ALTER TABLE `servers` ADD COLUMN pos INTEGER NOT NULL DEFAULT 0;
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
cursor.execute(sql)
|
|
|
|
|
|
|
|
except Exception as e:
|
|
|
|
|
|
|
|
if kwargs.get('silent') != 1:
|
|
|
|
|
|
|
|
if e.args[0] == 'duplicate column name: pos' or str(e) == '(1060, "Duplicate column name \'pos\'")':
|
|
|
|
|
|
|
|
print('Updating... go to version 4.3.2')
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
print("An error occurred:", e)
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
print("DB has been updated to 4.3.1")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def update_db_v_4_4_2_1(**kwargs):
|
|
|
|
|
|
|
|
cursor = conn.cursor()
|
|
|
|
|
|
|
|
sql = """ALTER TABLE `settings` ADD COLUMN `group` INTEGER NOT NULL DEFAULT 1;"""
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
cursor.execute(sql)
|
|
|
|
|
|
|
|
except Exception as e:
|
|
|
|
|
|
|
|
if kwargs.get('silent') != 1:
|
|
|
|
|
|
|
|
if e.args[0] == 'duplicate column name: group' or str(e) == '(1060, "Duplicate column name \'group\'")':
|
|
|
|
|
|
|
|
print('Updating... go to version 4.4.2')
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
print("An error occurred:", e)
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
print("DB has been updated to 4.4.2")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def update_db_v_4_5_1(**kwargs):
|
|
|
|
|
|
|
|
cursor = conn.cursor()
|
|
|
|
|
|
|
|
sql = """ select name from role where name = 'superAdmin';"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
cursor.execute(sql)
|
|
|
|
|
|
|
|
except Exception as e:
|
|
|
|
|
|
|
|
out_error(e)
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
role = cursor.fetchall()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if not role:
|
|
|
|
|
|
|
|
sql = list()
|
|
|
|
|
|
|
|
sql.append("update role set name = 'superAdmin' where id = '1';")
|
|
|
|
|
|
|
|
sql.append("update role set name = 'admin', `description` = 'Has access everywhere except the Admin area' where id = '2';")
|
|
|
|
|
|
|
|
sql.append("update role set id = '4' where id = '3';")
|
|
|
|
|
|
|
|
sql.append("INSERT INTO role (id, name, `description`) values('3', 'editor', 'Has the same as the admin except the Servers page');")
|
|
|
|
|
|
|
|
sql.append("update user set role = 'superAdmin' where role = 'admin';")
|
|
|
|
|
|
|
|
sql.append("update user set role = 'admin' where role = 'editor';")
|
|
|
|
|
|
|
|
for i in sql:
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
cursor.execute(i)
|
|
|
|
|
|
|
|
except:
|
|
|
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
if kwargs.get('silent') != 1:
|
|
|
|
|
|
|
|
print('DB has been updated to 4.5.0')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def update_db_v_4_5_4(**kwargs):
|
|
|
|
|
|
|
|
cursor = conn.cursor()
|
|
|
|
|
|
|
|
sql = list()
|
|
|
|
|
|
|
|
sql.append("ALTER TABLE `servers` ADD COLUMN `nginx_active` INTEGER NOT NULL DEFAULT 0;")
|
|
|
|
|
|
|
|
sql.append("ALTER TABLE `servers` ADD COLUMN `firewall_enable` INTEGER NOT NULL DEFAULT 0;")
|
|
|
|
|
|
|
|
sql.append("delete from settings where param = 'firewall_enable';")
|
|
|
|
|
|
|
|
for i in sql:
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
cursor.execute(i)
|
|
|
|
|
|
|
|
except Exception as e:
|
|
|
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
if kwargs.get('silent') != 1:
|
|
|
|
|
|
|
|
print('Updating... go to version 4.5.7')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def update_db_v_4_5_7(**kwargs):
|
|
|
|
|
|
|
|
cursor = conn.cursor()
|
|
|
|
|
|
|
|
sql = """
|
|
|
|
|
|
|
|
ALTER TABLE `servers` ADD COLUMN nginx_alert INTEGER NOT NULL DEFAULT 0;
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
cursor.execute(sql)
|
|
|
|
|
|
|
|
except Exception as e:
|
|
|
|
|
|
|
|
if kwargs.get('silent') != 1:
|
|
|
|
|
|
|
|
if e.args[0] == 'duplicate column name: nginx_alert' or str(e) == '(1060, "Duplicate column name \'nginx_alert\'")':
|
|
|
|
|
|
|
|
print('Updating... go to version 4.5.8')
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
print("An error occurred:", e)
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
print("DB has been updated to 4.3.1")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def update_db_v_4_5_8_1(**kwargs):
|
|
|
|
|
|
|
|
data_source = [
|
|
|
|
|
|
|
|
{'code': 'RW', 'name': 'Rwanda'},
|
|
|
|
|
|
|
|
{'code': 'SO', 'name': 'Somalia'},
|
|
|
|
|
|
|
|
{'code': 'YE', 'name': 'Yemen'},
|
|
|
|
|
|
|
|
{'code': 'IQ', 'name': 'Iraq'},
|
|
|
|
|
|
|
|
{'code': 'SA', 'name': 'Saudi Arabia'},
|
|
|
|
|
|
|
|
{'code': 'IR', 'name': 'Iran'},
|
|
|
|
|
|
|
|
{'code': 'CY', 'name': 'Cyprus'},
|
|
|
|
|
|
|
|
{'code': 'TZ', 'name': 'Tanzania'},
|
|
|
|
|
|
|
|
{'code': 'SY', 'name': 'Syria'},
|
|
|
|
|
|
|
|
{'code': 'AM', 'name': 'Armenia'},
|
|
|
|
|
|
|
|
{'code': 'KE', 'name': 'Kenya'},
|
|
|
|
|
|
|
|
{'code': 'CD', 'name': 'DR Congo'},
|
|
|
|
|
|
|
|
{'code': 'DJ', 'name': 'Djibouti'},
|
|
|
|
|
|
|
|
{'code': 'UG', 'name': 'Uganda'},
|
|
|
|
|
|
|
|
{'code': 'CF', 'name': 'Central African Republic'},
|
|
|
|
|
|
|
|
{'code': 'SC', 'name': 'Seychelles'},
|
|
|
|
|
|
|
|
{'code': 'JO', 'name': 'Hashemite Kingdom of Jordan'},
|
|
|
|
|
|
|
|
{'code': 'LB', 'name': 'Lebanon'},
|
|
|
|
|
|
|
|
{'code': 'KW', 'name': 'Kuwait'},
|
|
|
|
|
|
|
|
{'code': 'OM', 'name': 'Oman'},
|
|
|
|
|
|
|
|
{'code': 'QA', 'name': 'Qatar'},
|
|
|
|
|
|
|
|
{'code': 'BH', 'name': 'Bahrain'},
|
|
|
|
|
|
|
|
{'code': 'AE', 'name': 'United Arab Emirates'},
|
|
|
|
|
|
|
|
{'code': 'IL', 'name': 'Israel'},
|
|
|
|
|
|
|
|
{'code': 'TR', 'name': 'Turkey'},
|
|
|
|
|
|
|
|
{'code': 'ET', 'name': 'Ethiopia'},
|
|
|
|
|
|
|
|
{'code': 'ER', 'name': 'Eritrea'},
|
|
|
|
|
|
|
|
{'code': 'EG', 'name': 'Egypt'},
|
|
|
|
|
|
|
|
{'code': 'SD', 'name': 'Sudan'},
|
|
|
|
|
|
|
|
{'code': 'GR', 'name': 'Greece'},
|
|
|
|
|
|
|
|
{'code': 'BI', 'name': 'Burundi'},
|
|
|
|
|
|
|
|
{'code': 'EE', 'name': 'Estonia'},
|
|
|
|
|
|
|
|
{'code': 'LV', 'name': 'Latvia'},
|
|
|
|
|
|
|
|
{'code': 'AZ', 'name': 'Azerbaijan'},
|
|
|
|
|
|
|
|
{'code': 'LT', 'name': 'Republic of Lithuania'},
|
|
|
|
|
|
|
|
{'code': 'SJ', 'name': 'Svalbard and Jan Mayen'},
|
|
|
|
|
|
|
|
{'code': 'GE', 'name': 'Georgia'},
|
|
|
|
|
|
|
|
{'code': 'MD', 'name': 'Republic of Moldova'},
|
|
|
|
|
|
|
|
{'code': 'BY', 'name': 'Belarus'},
|
|
|
|
|
|
|
|
{'code': 'FI', 'name': 'Finland'},
|
|
|
|
|
|
|
|
{'code': 'AX', 'name': 'Åland'},
|
|
|
|
|
|
|
|
{'code': 'UA', 'name': 'Ukraine'},
|
|
|
|
|
|
|
|
{'code': 'MK', 'name': 'North Macedonia'},
|
|
|
|
|
|
|
|
{'code': 'HU', 'name': 'Hungary'},
|
|
|
|
|
|
|
|
{'code': 'BG', 'name': 'Bulgaria'},
|
|
|
|
|
|
|
|
{'code': 'AL', 'name': 'Albania'},
|
|
|
|
|
|
|
|
{'code': 'PL', 'name': 'Poland'},
|
|
|
|
|
|
|
|
{'code': 'RO', 'name': 'Romania'},
|
|
|
|
|
|
|
|
{'code': 'XK', 'name': 'Kosovo'},
|
|
|
|
|
|
|
|
{'code': 'ZW', 'name': 'Zimbabwe'},
|
|
|
|
|
|
|
|
{'code': 'ZM', 'name': 'Zambia'},
|
|
|
|
|
|
|
|
{'code': 'KM', 'name': 'Comoros'},
|
|
|
|
|
|
|
|
{'code': 'MW', 'name': 'Malawi'},
|
|
|
|
|
|
|
|
{'code': 'LS', 'name': 'Lesotho'},
|
|
|
|
|
|
|
|
{'code': 'BW', 'name': 'Botswana'},
|
|
|
|
|
|
|
|
{'code': 'MU', 'name': 'Mauritius'},
|
|
|
|
|
|
|
|
{'code': 'SZ', 'name': 'Eswatini'},
|
|
|
|
|
|
|
|
{'code': 'RE', 'name': 'Réunion'},
|
|
|
|
|
|
|
|
{'code': 'ZA', 'name': 'South Africa'},
|
|
|
|
|
|
|
|
{'code': 'YT', 'name': 'Mayotte'},
|
|
|
|
|
|
|
|
{'code': 'MZ', 'name': 'Mozambique'},
|
|
|
|
|
|
|
|
{'code': 'MG', 'name': 'Madagascar'},
|
|
|
|
|
|
|
|
{'code': 'AF', 'name': 'Afghanistan'},
|
|
|
|
|
|
|
|
{'code': 'PK', 'name': 'Pakistan'},
|
|
|
|
|
|
|
|
{'code': 'BD', 'name': 'Bangladesh'},
|
|
|
|
|
|
|
|
{'code': 'TM', 'name': 'Turkmenistan'},
|
|
|
|
|
|
|
|
{'code': 'TJ', 'name': 'Tajikistan'},
|
|
|
|
|
|
|
|
{'code': 'LK', 'name': 'Sri Lanka'},
|
|
|
|
|
|
|
|
{'code': 'BT', 'name': 'Bhutan'},
|
|
|
|
|
|
|
|
{'code': 'IN', 'name': 'India'},
|
|
|
|
|
|
|
|
{'code': 'MV', 'name': 'Maldives'},
|
|
|
|
|
|
|
|
{'code': 'IO', 'name': 'British Indian Ocean Territory'},
|
|
|
|
|
|
|
|
{'code': 'NP', 'name': 'Nepal'},
|
|
|
|
|
|
|
|
{'code': 'MM', 'name': 'Myanmar'},
|
|
|
|
|
|
|
|
{'code': 'UZ', 'name': 'Uzbekistan'},
|
|
|
|
|
|
|
|
{'code': 'KZ', 'name': 'Kazakhstan'},
|
|
|
|
|
|
|
|
{'code': 'KG', 'name': 'Kyrgyzstan'},
|
|
|
|
|
|
|
|
{'code': 'TF', 'name': 'French Southern Territories'},
|
|
|
|
|
|
|
|
{'code': 'HM', 'name': 'Heard Island and McDonald Islands'},
|
|
|
|
|
|
|
|
{'code': 'CC', 'name': 'Cocos [Keeling] Islands'},
|
|
|
|
|
|
|
|
{'code': 'PW', 'name': 'Palau'},
|
|
|
|
|
|
|
|
{'code': 'VN', 'name': 'Vietnam'},
|
|
|
|
|
|
|
|
{'code': 'TH', 'name': 'Thailand'},
|
|
|
|
|
|
|
|
{'code': 'ID', 'name': 'Indonesia'},
|
|
|
|
|
|
|
|
{'code': 'LA', 'name': 'Laos'},
|
|
|
|
|
|
|
|
{'code': 'TW', 'name': 'Taiwan'},
|
|
|
|
|
|
|
|
{'code': 'PH', 'name': 'Philippines'},
|
|
|
|
|
|
|
|
{'code': 'MY', 'name': 'Malaysia'},
|
|
|
|
|
|
|
|
{'code': 'CN', 'name': 'China'},
|
|
|
|
|
|
|
|
{'code': 'HK', 'name': 'Hong Kong'},
|
|
|
|
|
|
|
|
{'code': 'BN', 'name': 'Brunei'},
|
|
|
|
|
|
|
|
{'code': 'MO', 'name': 'Macao'},
|
|
|
|
|
|
|
|
{'code': 'KH', 'name': 'Cambodia'},
|
|
|
|
|
|
|
|
{'code': 'KR', 'name': 'South Korea'},
|
|
|
|
|
|
|
|
{'code': 'JP', 'name': 'Japan'},
|
|
|
|
|
|
|
|
{'code': 'KP', 'name': 'North Korea'},
|
|
|
|
|
|
|
|
{'code': 'SG', 'name': 'Singapore'},
|
|
|
|
|
|
|
|
{'code': 'CK', 'name': 'Cook Islands'},
|
|
|
|
|
|
|
|
{'code': 'TL', 'name': 'East Timor'},
|
|
|
|
|
|
|
|
{'code': 'RU', 'name': 'Russia'},
|
|
|
|
|
|
|
|
{'code': 'MN', 'name': 'Mongolia'},
|
|
|
|
|
|
|
|
{'code': 'AU', 'name': 'Australia'},
|
|
|
|
|
|
|
|
{'code': 'CX', 'name': 'Christmas Island'},
|
|
|
|
|
|
|
|
{'code': 'MH', 'name': 'Marshall Islands'},
|
|
|
|
|
|
|
|
{'code': 'FM', 'name': 'Federated States of Micronesia'},
|
|
|
|
|
|
|
|
{'code': 'PG', 'name': 'Papua New Guinea'},
|
|
|
|
|
|
|
|
{'code': 'SB', 'name': 'Solomon Islands'},
|
|
|
|
|
|
|
|
{'code': 'TV', 'name': 'Tuvalu'},
|
|
|
|
|
|
|
|
{'code': 'NR', 'name': 'Nauru'},
|
|
|
|
|
|
|
|
{'code': 'VU', 'name': 'Vanuatu'},
|
|
|
|
|
|
|
|
{'code': 'NC', 'name': 'New Caledonia'},
|
|
|
|
|
|
|
|
{'code': 'NF', 'name': 'Norfolk Island'},
|
|
|
|
|
|
|
|
{'code': 'NZ', 'name': 'New Zealand'},
|
|
|
|
|
|
|
|
{'code': 'FJ', 'name': 'Fiji'},
|
|
|
|
|
|
|
|
{'code': 'LY', 'name': 'Libya'},
|
|
|
|
|
|
|
|
{'code': 'CM', 'name': 'Cameroon'},
|
|
|
|
|
|
|
|
{'code': 'SN', 'name': 'Senegal'},
|
|
|
|
|
|
|
|
{'code': 'CG', 'name': 'Congo Republic'},
|
|
|
|
|
|
|
|
{'code': 'PT', 'name': 'Portugal'},
|
|
|
|
|
|
|
|
{'code': 'LR', 'name': 'Liberia'},
|
|
|
|
|
|
|
|
{'code': 'CI', 'name': 'Ivory Coast'},
|
|
|
|
|
|
|
|
{'code': 'GH', 'name': 'Ghana'},
|
|
|
|
|
|
|
|
{'code': 'GQ', 'name': 'Equatorial Guinea'},
|
|
|
|
|
|
|
|
{'code': 'NG', 'name': 'Nigeria'},
|
|
|
|
|
|
|
|
{'code': 'BF', 'name': 'Burkina Faso'},
|
|
|
|
|
|
|
|
{'code': 'TG', 'name': 'Togo'},
|
|
|
|
|
|
|
|
{'code': 'GW', 'name': 'Guinea-Bissau'},
|
|
|
|
|
|
|
|
{'code': 'MR', 'name': 'Mauritania'},
|
|
|
|
|
|
|
|
{'code': 'BJ', 'name': 'Benin'},
|
|
|
|
|
|
|
|
{'code': 'GA', 'name': 'Gabon'},
|
|
|
|
|
|
|
|
{'code': 'SL', 'name': 'Sierra Leone'},
|
|
|
|
|
|
|
|
{'code': 'ST', 'name': 'São Tomé and Príncipe'},
|
|
|
|
|
|
|
|
{'code': 'GI', 'name': 'Gibraltar'},
|
|
|
|
|
|
|
|
{'code': 'GM', 'name': 'Gambia'},
|
|
|
|
|
|
|
|
{'code': 'GN', 'name': 'Guinea'},
|
|
|
|
|
|
|
|
{'code': 'TD', 'name': 'Chad'},
|
|
|
|
|
|
|
|
{'code': 'NE', 'name': 'Niger'},
|
|
|
|
|
|
|
|
{'code': 'ML', 'name': 'Mali'},
|
|
|
|
|
|
|
|
{'code': 'EH', 'name': 'Western Sahara'},
|
|
|
|
|
|
|
|
{'code': 'TN', 'name': 'Tunisia'},
|
|
|
|
|
|
|
|
{'code': 'ES', 'name': 'Spain'},
|
|
|
|
|
|
|
|
{'code': 'MA', 'name': 'Morocco'},
|
|
|
|
|
|
|
|
{'code': 'MT', 'name': 'Malta'},
|
|
|
|
|
|
|
|
{'code': 'DZ', 'name': 'Algeria'},
|
|
|
|
|
|
|
|
{'code': 'FO', 'name': 'Faroe Islands'},
|
|
|
|
|
|
|
|
{'code': 'DK', 'name': 'Denmark'},
|
|
|
|
|
|
|
|
{'code': 'IS', 'name': 'Iceland'},
|
|
|
|
|
|
|
|
{'code': 'GB', 'name': 'United Kingdom'},
|
|
|
|
|
|
|
|
{'code': 'CH', 'name': 'Switzerland'},
|
|
|
|
|
|
|
|
{'code': 'SE', 'name': 'Sweden'},
|
|
|
|
|
|
|
|
{'code': 'NL', 'name': 'Netherlands'},
|
|
|
|
|
|
|
|
{'code': 'AT', 'name': 'Austria'},
|
|
|
|
|
|
|
|
{'code': 'BE', 'name': 'Belgium'},
|
|
|
|
|
|
|
|
{'code': 'DE', 'name': 'Germany'},
|
|
|
|
|
|
|
|
{'code': 'LU', 'name': 'Luxembourg'},
|
|
|
|
|
|
|
|
{'code': 'IE', 'name': 'Ireland'},
|
|
|
|
|
|
|
|
{'code': 'MC', 'name': 'Monaco'},
|
|
|
|
|
|
|
|
{'code': 'FR', 'name': 'France'},
|
|
|
|
|
|
|
|
{'code': 'AD', 'name': 'Andorra'},
|
|
|
|
|
|
|
|
{'code': 'LI', 'name': 'Liechtenstein'},
|
|
|
|
|
|
|
|
{'code': 'JE', 'name': 'Jersey'},
|
|
|
|
|
|
|
|
{'code': 'IM', 'name': 'Isle of Man'},
|
|
|
|
|
|
|
|
{'code': 'GG', 'name': 'Guernsey'},
|
|
|
|
|
|
|
|
{'code': 'SK', 'name': 'Slovakia'},
|
|
|
|
|
|
|
|
{'code': 'CZ', 'name': 'Czechia'},
|
|
|
|
|
|
|
|
{'code': 'NO', 'name': 'Norway'},
|
|
|
|
|
|
|
|
{'code': 'VA', 'name': 'Vatican City'},
|
|
|
|
|
|
|
|
{'code': 'SM', 'name': 'San Marino'},
|
|
|
|
|
|
|
|
{'code': 'IT', 'name': 'Italy'},
|
|
|
|
|
|
|
|
{'code': 'SI', 'name': 'Slovenia'},
|
|
|
|
|
|
|
|
{'code': 'ME', 'name': 'Montenegro'},
|
|
|
|
|
|
|
|
{'code': 'HR', 'name': 'Croatia'},
|
|
|
|
|
|
|
|
{'code': 'BA', 'name': 'Bosnia and Herzegovina'},
|
|
|
|
|
|
|
|
{'code': 'AO', 'name': 'Angola'},
|
|
|
|
|
|
|
|
{'code': 'NA', 'name': 'Namibia'},
|
|
|
|
|
|
|
|
{'code': 'SH', 'name': 'Saint Helena'},
|
|
|
|
|
|
|
|
{'code': 'BV', 'name': 'Bouvet Island'},
|
|
|
|
|
|
|
|
{'code': 'BB', 'name': 'Barbados'},
|
|
|
|
|
|
|
|
{'code': 'CV', 'name': 'Cabo Verde'},
|
|
|
|
|
|
|
|
{'code': 'GY', 'name': 'Guyana'},
|
|
|
|
|
|
|
|
{'code': 'GF', 'name': 'French Guiana'},
|
|
|
|
|
|
|
|
{'code': 'SR', 'name': 'Suriname'},
|
|
|
|
|
|
|
|
{'code': 'PM', 'name': 'Saint Pierre and Miquelon'},
|
|
|
|
|
|
|
|
{'code': 'GL', 'name': 'Greenland'},
|
|
|
|
|
|
|
|
{'code': 'PY', 'name': 'Paraguay'},
|
|
|
|
|
|
|
|
{'code': 'UY', 'name': 'Uruguay'},
|
|
|
|
|
|
|
|
{'code': 'BR', 'name': 'Brazil'},
|
|
|
|
|
|
|
|
{'code': 'FK', 'name': 'Falkland Islands'},
|
|
|
|
|
|
|
|
{'code': 'GS', 'name': 'South Georgia and the South Sandwich Islands'},
|
|
|
|
|
|
|
|
{'code': 'JM', 'name': 'Jamaica'},
|
|
|
|
|
|
|
|
{'code': 'DO', 'name': 'Dominican Republic'},
|
|
|
|
|
|
|
|
{'code': 'CU', 'name': 'Cuba'},
|
|
|
|
|
|
|
|
{'code': 'MQ', 'name': 'Martinique'},
|
|
|
|
|
|
|
|
{'code': 'BS', 'name': 'Bahamas'},
|
|
|
|
|
|
|
|
{'code': 'BM', 'name': 'Bermuda'},
|
|
|
|
|
|
|
|
{'code': 'AI', 'name': 'Anguilla'},
|
|
|
|
|
|
|
|
{'code': 'TT', 'name': 'Trinidad and Tobago'},
|
|
|
|
|
|
|
|
{'code': 'KN', 'name': 'St Kitts and Nevis'},
|
|
|
|
|
|
|
|
{'code': 'DM', 'name': 'Dominica'},
|
|
|
|
|
|
|
|
{'code': 'AG', 'name': 'Antigua and Barbuda'},
|
|
|
|
|
|
|
|
{'code': 'LC', 'name': 'Saint Lucia'},
|
|
|
|
|
|
|
|
{'code': 'TC', 'name': 'Turks and Caicos Islands'},
|
|
|
|
|
|
|
|
{'code': 'AW', 'name': 'Aruba'},
|
|
|
|
|
|
|
|
{'code': 'VG', 'name': 'British Virgin Islands'},
|
|
|
|
|
|
|
|
{'code': 'VC', 'name': 'Saint Vincent and the Grenadines'},
|
|
|
|
|
|
|
|
{'code': 'MS', 'name': 'Montserrat'},
|
|
|
|
|
|
|
|
{'code': 'MF', 'name': 'Saint Martin'},
|
|
|
|
|
|
|
|
{'code': 'BL', 'name': 'Saint Barthélemy'},
|
|
|
|
|
|
|
|
{'code': 'GP', 'name': 'Guadeloupe'},
|
|
|
|
|
|
|
|
{'code': 'GD', 'name': 'Grenada'},
|
|
|
|
|
|
|
|
{'code': 'KY', 'name': 'Cayman Islands'},
|
|
|
|
|
|
|
|
{'code': 'BZ', 'name': 'Belize'},
|
|
|
|
|
|
|
|
{'code': 'SV', 'name': 'El Salvador'},
|
|
|
|
|
|
|
|
{'code': 'GT', 'name': 'Guatemala'},
|
|
|
|
|
|
|
|
{'code': 'HN', 'name': 'Honduras'},
|
|
|
|
|
|
|
|
{'code': 'NI', 'name': 'Nicaragua'},
|
|
|
|
|
|
|
|
{'code': 'CR', 'name': 'Costa Rica'},
|
|
|
|
|
|
|
|
{'code': 'VE', 'name': 'Venezuela'},
|
|
|
|
|
|
|
|
{'code': 'EC', 'name': 'Ecuador'},
|
|
|
|
|
|
|
|
{'code': 'CO', 'name': 'Colombia'},
|
|
|
|
|
|
|
|
{'code': 'PA', 'name': 'Panama'},
|
|
|
|
|
|
|
|
{'code': 'HT', 'name': 'Haiti'},
|
|
|
|
|
|
|
|
{'code': 'AR', 'name': 'Argentina'},
|
|
|
|
|
|
|
|
{'code': 'CL', 'name': 'Chile'},
|
|
|
|
|
|
|
|
{'code': 'BO', 'name': 'Bolivia'},
|
|
|
|
|
|
|
|
{'code': 'PE', 'name': 'Peru'},
|
|
|
|
|
|
|
|
{'code': 'MX', 'name': 'Mexico'},
|
|
|
|
|
|
|
|
{'code': 'PF', 'name': 'French Polynesia'},
|
|
|
|
|
|
|
|
{'code': 'PN', 'name': 'Pitcairn Islands'},
|
|
|
|
|
|
|
|
{'code': 'KI', 'name': 'Kiribati'},
|
|
|
|
|
|
|
|
{'code': 'TK', 'name': 'Tokelau'},
|
|
|
|
|
|
|
|
{'code': 'TO', 'name': 'Tonga'},
|
|
|
|
|
|
|
|
{'code': 'WF', 'name': 'Wallis and Futuna'},
|
|
|
|
|
|
|
|
{'code': 'WS', 'name': 'Samoa'},
|
|
|
|
|
|
|
|
{'code': 'NU', 'name': 'Niue'},
|
|
|
|
|
|
|
|
{'code': 'MP', 'name': 'Northern Mariana Islands'},
|
|
|
|
|
|
|
|
{'code': 'GU', 'name': 'Guam'},
|
|
|
|
|
|
|
|
{'code': 'PR', 'name': 'Puerto Rico'},
|
|
|
|
|
|
|
|
{'code': 'VI', 'name': 'U.S. Virgin Islands'},
|
|
|
|
|
|
|
|
{'code': 'UM', 'name': 'U.S. Minor Outlying Islands'},
|
|
|
|
|
|
|
|
{'code': 'AS', 'name': 'American Samoa'},
|
|
|
|
|
|
|
|
{'code': 'CA', 'name': 'Canada'},
|
|
|
|
|
|
|
|
{'code': 'US', 'name': 'United States'},
|
|
|
|
|
|
|
|
{'code': 'PS', 'name': 'Palestine'},
|
|
|
|
|
|
|
|
{'code': 'RS', 'name': 'Serbia'},
|
|
|
|
|
|
|
|
{'code': 'AQ', 'name': 'Antarctica'},
|
|
|
|
|
|
|
|
{'code': 'SX', 'name': 'Sint Maarten'},
|
|
|
|
|
|
|
|
{'code': 'CW', 'name': 'Curaçao'},
|
|
|
|
|
|
|
|
{'code': 'BQ', 'name': 'Bonaire'},
|
|
|
|
|
|
|
|
{'code': 'SS', 'name': 'South Sudan'}
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
GeoipCodes.insert_many(data_source).on_conflict_ignore().execute()
|
|
|
|
|
|
|
|
except Exception as e:
|
|
|
|
|
|
|
|
print(str(e))
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
if kwargs.get('silent') != 1:
|
|
|
|
|
|
|
|
print('Updating... go to version 4.5.6')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def update_db_v_4_5_8_2(**kwargs):
|
|
|
|
|
|
|
|
groups = ''
|
|
|
|
|
|
|
|
query = Groups.select()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
query_res = query.execute()
|
|
|
|
|
|
|
|
except Exception as e:
|
|
|
|
|
|
|
|
out_error(e)
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
groups = query_res
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for g in groups:
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
Setting.insert(param='maxmind_key',
|
|
|
|
|
|
|
|
value='',
|
|
|
|
|
|
|
|
section='haproxy',
|
|
|
|
|
|
|
|
desc='License key for downloading to GeoLite2 DB. You can create it on maxmind.com',
|
|
|
|
|
|
|
|
group=g.group_id).execute()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
except Exception as e:
|
|
|
|
|
|
|
|
if kwargs.get('silent') != 1:
|
|
|
|
|
|
|
|
if (
|
|
|
|
|
|
|
|
str(e) == 'columns param, group are not unique' or
|
|
|
|
|
|
|
|
str(e) == '(1062, "Duplicate entry \'maxmind_key-1\' for key \'param\'")' or
|
|
|
|
|
|
|
|
str(e) == 'UNIQUE constraint failed: settings.param, settings.group'
|
|
|
|
|
|
|
|
):
|
|
|
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
print("An error occurred:", e)
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
print("Updating... groups")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def update_db_v_4_5_9(**kwargs):
|
|
|
|
|
|
|
|
data_source = [
|
|
|
|
|
|
|
|
{'param': 'smon_check_interval', 'value': '1', 'section': 'monitoring', 'desc': 'Check interval for SMON (in minutes)',
|
|
|
|
|
|
|
|
'group': '1'},
|
|
|
|
|
|
|
|
{'param': 'checker_check_interval', 'value': '1', 'section': 'monitoring',
|
|
|
|
|
|
|
|
'desc': 'Check interval for Checker (in minutes)', 'group': '1'},
|
|
|
|
|
|
|
|
{'param': 'port_scan_interval', 'value': '5', 'section': 'monitoring',
|
|
|
|
|
|
|
|
'desc': 'Check interval for Port scanner (in minutes)', 'group': '1'},
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
Setting.insert_many(data_source).on_conflict_ignore().execute()
|
|
|
|
|
|
|
|
except Exception as e:
|
|
|
|
|
|
|
|
if kwargs.get('silent') != 1:
|
|
|
|
|
|
|
|
if str(e) == 'columns param, group are not unique':
|
|
|
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
print("An error occurred:", e)
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
if kwargs.get('silent') != 1:
|
|
|
|
|
|
|
|
print('Updating... DB has been updated to version 4.5.9')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def update_db_v_5_0_1(**kwargs):
|
|
|
|
|
|
|
|
cursor = conn.cursor()
|
|
|
|
|
|
|
|
sql = list()
|
|
|
|
|
|
|
|
sql.append("alter table provisioned_servers add column project VARCHAR ( 64 )")
|
|
|
|
|
|
|
|
sql.append("alter table provisioned_servers add column network_name VARCHAR ( 64 )")
|
|
|
|
|
|
|
|
sql.append("alter table provisioned_servers add column volume_type VARCHAR ( 64 )")
|
|
|
|
|
|
|
|
sql.append("alter table provisioned_servers add column name_template VARCHAR ( 64 )")
|
|
|
|
|
|
|
|
for i in sql:
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
cursor.execute(i)
|
|
|
|
|
|
|
|
except:
|
|
|
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
if kwargs.get('silent') != 1:
|
|
|
|
|
|
|
|
print('Updating... DB has been updated to version 5.0.1')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def update_db_v_5_1_2(**kwargs):
|
|
|
|
def update_db_v_5_1_2(**kwargs):
|
|
|
|
data_source = [
|
|
|
|
data_source = [
|
|
|
|
{'param': 'smon_keep_history_range', 'value': '14', 'section': 'monitoring',
|
|
|
|
{'param': 'smon_keep_history_range', 'value': '14', 'section': 'monitoring',
|
|
|
@ -913,18 +431,6 @@ def update_ver():
|
|
|
|
def update_all():
|
|
|
|
def update_all():
|
|
|
|
if check_ver() is None:
|
|
|
|
if check_ver() is None:
|
|
|
|
update_db_v_3_4_5_22()
|
|
|
|
update_db_v_3_4_5_22()
|
|
|
|
update_db_v_41()
|
|
|
|
|
|
|
|
update_db_v_42()
|
|
|
|
|
|
|
|
update_db_v_4_3_0()
|
|
|
|
|
|
|
|
update_db_v_4_3_1()
|
|
|
|
|
|
|
|
update_db_v_4_4_2_1()
|
|
|
|
|
|
|
|
update_db_v_4_5_1()
|
|
|
|
|
|
|
|
update_db_v_4_5_4()
|
|
|
|
|
|
|
|
update_db_v_4_5_7()
|
|
|
|
|
|
|
|
update_db_v_4_5_8_1()
|
|
|
|
|
|
|
|
update_db_v_4_5_8_2()
|
|
|
|
|
|
|
|
update_db_v_4_5_9()
|
|
|
|
|
|
|
|
update_db_v_5_0_1()
|
|
|
|
|
|
|
|
update_db_v_5_1_2()
|
|
|
|
update_db_v_5_1_2()
|
|
|
|
update_db_v_5_1_3()
|
|
|
|
update_db_v_5_1_3()
|
|
|
|
update_db_v_5_2_0()
|
|
|
|
update_db_v_5_2_0()
|
|
|
@ -948,18 +454,6 @@ def update_all():
|
|
|
|
def update_all_silent():
|
|
|
|
def update_all_silent():
|
|
|
|
if check_ver() is None:
|
|
|
|
if check_ver() is None:
|
|
|
|
update_db_v_3_4_5_22()
|
|
|
|
update_db_v_3_4_5_22()
|
|
|
|
update_db_v_41(silent=1)
|
|
|
|
|
|
|
|
update_db_v_42(silent=1)
|
|
|
|
|
|
|
|
update_db_v_4_3_0(silent=1)
|
|
|
|
|
|
|
|
update_db_v_4_3_1(silent=1)
|
|
|
|
|
|
|
|
update_db_v_4_4_2_1(silent=1)
|
|
|
|
|
|
|
|
update_db_v_4_5_1(silent=1)
|
|
|
|
|
|
|
|
update_db_v_4_5_4(silent=1)
|
|
|
|
|
|
|
|
update_db_v_4_5_7(silent=1)
|
|
|
|
|
|
|
|
update_db_v_4_5_8_1(silent=1)
|
|
|
|
|
|
|
|
update_db_v_4_5_8_2(silent=1)
|
|
|
|
|
|
|
|
update_db_v_4_5_9(silent=1)
|
|
|
|
|
|
|
|
update_db_v_5_0_1(silent=1)
|
|
|
|
|
|
|
|
update_db_v_5_1_2(silent=1)
|
|
|
|
update_db_v_5_1_2(silent=1)
|
|
|
|
update_db_v_5_1_3(silent=1)
|
|
|
|
update_db_v_5_1_3(silent=1)
|
|
|
|
update_db_v_5_2_0(silent=1)
|
|
|
|
update_db_v_5_2_0(silent=1)
|
|
|
|