gorealis v2 refactor (#5)

* Changing default timeout for start maintenance.

* Upgrading dependencies to gorealis v2 and thrift  0.12.0

* Refactored to update to gorealis v2.
This commit is contained in:
Renan DelValle 2018-12-27 11:31:51 -08:00 committed by GitHub
parent ad4dd9606e
commit 6ab5c9334d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1335 changed files with 137431 additions and 61530 deletions

View file

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python
#
# Licensed to the Apache Software Foundation (ASF) under one
@ -19,6 +19,7 @@
# under the License.
#
from __future__ import print_function
import sys
import os
from optparse import OptionParser
@ -57,24 +58,20 @@ def service_ctrl(
msg = fb_status_string(status)
if (len(status_details)):
msg += " - %s" % status_details
print msg
if (status == fb_status.ALIVE):
return 2
else:
return 3
print(msg)
return 2 if status == fb_status.ALIVE else 3
except:
print "Failed to get status"
print("Failed to get status")
return 3
# scalar commands
if command in ["version", "alive", "name"]:
try:
result = fb303_wrapper(command, port, trans_factory, prot_factory)
print result
print(result)
return 0
except:
print "failed to get ", command
print("failed to get ", command)
return 3
# counters
@ -82,10 +79,10 @@ def service_ctrl(
try:
counters = fb303_wrapper('counters', port, trans_factory, prot_factory)
for counter in counters:
print "%s: %d" % (counter, counters[counter])
print("%s: %d" % (counter.encode('utf-8'), counters[counter]))
return 0
except:
print "failed to get counters"
print("failed to get counters")
return 3
# Only root should be able to run the following commands
@ -96,19 +93,19 @@ def service_ctrl(
fb303_wrapper(command, port, trans_factory, prot_factory)
return 0
except:
print "failed to tell the service to ", command
print("failed to tell the service to ", command)
return 3
else:
if command in ["stop", "reload"]:
print "root privileges are required to stop or reload the service."
print("root privileges are required to stop or reload the service.")
return 4
print "The following commands are available:"
print("The following commands are available:")
for command in ["counters", "name", "version", "alive", "status"]:
print "\t%s" % command
print "The following commands are available for users with root privileges:"
print("\t%s" % command)
print("The following commands are available for users with root privileges:")
for command in ["stop", "reload"]:
print "\t%s" % command
print("\t%s" % command)
return 0

View file

@ -26,7 +26,7 @@ except:
from distutils.core import setup, Extension, Command
setup(name='thrift_fb303',
version='0.10.0',
version='0.12.0',
description='Python bindings for the Apache Thrift FB303',
author=['Thrift Developers'],
author_email=['dev@thrift.apache.org'],