Added version API, logs and variable.
Added linebreak after some API answers. Fixed > to >= for redis_manager count. Bumped version to 3.
This commit is contained in:
parent
0d98099e88
commit
f64f75190a
@ -1,7 +1,8 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Author : Yohan Bataille (ING)
|
# Author : Yohan Bataille (ING)
|
||||||
# redis-manager v2
|
# redis-manager
|
||||||
|
version = "3"
|
||||||
|
|
||||||
# Requires:
|
# Requires:
|
||||||
# redis-cli
|
# redis-cli
|
||||||
@ -23,6 +24,7 @@ import pprint
|
|||||||
import urllib2
|
import urllib2
|
||||||
from random import randint
|
from random import randint
|
||||||
|
|
||||||
|
print("redis manager version: " + version)
|
||||||
|
|
||||||
# positional : REDIS_PATH, REDIS_NODES, ENV, HTTP_PORT (in this order, all mandatory, ENV : "DEV" or "PROD")
|
# positional : REDIS_PATH, REDIS_NODES, ENV, HTTP_PORT (in this order, all mandatory, ENV : "DEV" or "PROD")
|
||||||
# optional : time (-t), dry_run (-n)
|
# optional : time (-t), dry_run (-n)
|
||||||
@ -130,6 +132,8 @@ def api_help():
|
|||||||
# 'CANNOT PROCEED: passive manager'
|
# 'CANNOT PROCEED: passive manager'
|
||||||
# example : /prepare_for_reboot/10.166.20.120&duration=300
|
# example : /prepare_for_reboot/10.166.20.120&duration=300
|
||||||
|
|
||||||
|
# /version : redis manager version
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# TODO: Remove global variables.
|
# TODO: Remove global variables.
|
||||||
@ -201,7 +205,7 @@ def main():
|
|||||||
elif num_manager_active == 1 and manager_status == 'starting':
|
elif num_manager_active == 1 and manager_status == 'starting':
|
||||||
print("Manager election finished, we are passive!")
|
print("Manager election finished, we are passive!")
|
||||||
manager_status = 'passive'
|
manager_status = 'passive'
|
||||||
elif num_manager_active > 1 and manager_status == 'active':
|
elif num_manager_active >= 1 and manager_status == 'active':
|
||||||
print("Becoming passive!")
|
print("Becoming passive!")
|
||||||
manager_status = 'passive'
|
manager_status = 'passive'
|
||||||
|
|
||||||
@ -923,6 +927,11 @@ class MyHandler(BaseHTTPRequestHandler):
|
|||||||
elif self.path == '/debug/disable':
|
elif self.path == '/debug/disable':
|
||||||
self.send_response(200)
|
self.send_response(200)
|
||||||
debug = False
|
debug = False
|
||||||
|
elif self.path == '/version':
|
||||||
|
self.send_response(200)
|
||||||
|
self.send_header('Content-type', 'text/plain')
|
||||||
|
self.end_headers()
|
||||||
|
self.wfile.write(version+'\n')
|
||||||
elif self.path == '/help':
|
elif self.path == '/help':
|
||||||
self.send_response(200)
|
self.send_response(200)
|
||||||
self.send_header('Content-type', 'text/plain')
|
self.send_header('Content-type', 'text/plain')
|
||||||
@ -932,7 +941,7 @@ class MyHandler(BaseHTTPRequestHandler):
|
|||||||
self.send_response(200)
|
self.send_response(200)
|
||||||
self.send_header('Content-type', 'text/plain')
|
self.send_header('Content-type', 'text/plain')
|
||||||
self.end_headers()
|
self.end_headers()
|
||||||
self.wfile.write(cluster_state)
|
self.wfile.write(cluster_state+'\n')
|
||||||
elif self.path == '/manager_status':
|
elif self.path == '/manager_status':
|
||||||
self.send_response(200)
|
self.send_response(200)
|
||||||
self.send_header('Content-type', 'text/plain')
|
self.send_header('Content-type', 'text/plain')
|
||||||
|
Loading…
Reference in New Issue
Block a user