Compare commits
No commits in common. "7cddc059b5f053f6cc8ddbd8681fbe59de35ddde" and "6d28cf7431333188db30a7a9a2092b8664a90338" have entirely different histories.
7cddc059b5
...
6d28cf7431
@ -174,14 +174,10 @@ def list_workers():
|
|||||||
resp=requests.get("http://"+worker.split(':')[1].strip('\n') + ":5000/status",timeout=2)
|
resp=requests.get("http://"+worker.split(':')[1].strip('\n') + ":5000/status",timeout=2)
|
||||||
if (resp.status_code != 200):
|
if (resp.status_code != 200):
|
||||||
online=False
|
online=False
|
||||||
worker_list.append({'worker': worker.split(':')[0],'ip': worker.split(':')[1].strip('\n'), 'online': online, 'sites': 0, 'status': 'offline'})
|
worker_list.append({'worker': worker.split(':')[0],'ip': worker.split(':')[1].strip('\n'), 'online': online, 'sites': 0, 'ready': 0})
|
||||||
continue
|
continue
|
||||||
sites = resp.json()['num_sites']
|
sites = resp.json()['num_sites']
|
||||||
availability = resp.json()['availability']
|
worker_list.append({'worker': worker.split(':')[0],'ip': worker.split(':')[1].strip('\n'), 'online': online, 'sites': sites, 'ready': 1})
|
||||||
if availability == True:
|
|
||||||
worker_list.append({'worker': worker.split(':')[0],'ip': worker.split(':')[1].strip('\n'), 'online': online, 'sites': sites, 'status': 'ready'})
|
|
||||||
else:
|
|
||||||
worker_list.append({'worker': worker.split(':')[0],'ip': worker.split(':')[1].strip('\n'), 'online': online, 'sites': sites, 'status': 'full'})
|
|
||||||
|
|
||||||
if len(worker_list) == 0:
|
if len(worker_list) == 0:
|
||||||
return jsonify({'error': 'No workers available', 'success': 'false'})
|
return jsonify({'error': 'No workers available', 'success': 'false'})
|
||||||
|
@ -67,11 +67,16 @@ def ping():
|
|||||||
return 'pong'
|
return 'pong'
|
||||||
|
|
||||||
def get_sites_count():
|
def get_sites_count():
|
||||||
# Get number of files in nginx/sites
|
# If file doesn't exist, create it
|
||||||
dir = os.listdir('/etc/nginx/sites-available')
|
try:
|
||||||
num_Sites = len(dir) - 1
|
sites_file = open('sites.txt', 'r')
|
||||||
|
except FileNotFoundError:
|
||||||
|
sites_file = open('sites.txt', 'w')
|
||||||
|
sites_file.close()
|
||||||
|
sites_file = open('sites.txt', 'r')
|
||||||
|
print(sites_file.readlines())
|
||||||
# Return number of lines in file
|
# Return number of lines in file
|
||||||
return num_Sites
|
return len(sites_file.readlines())
|
||||||
|
|
||||||
def site_exists(domain):
|
def site_exists(domain):
|
||||||
# If file doesn't exist, create it
|
# If file doesn't exist, create it
|
||||||
|
Loading…
Reference in New Issue
Block a user