Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

59 lines (46 sloc) 1.67 kb
#!/usr/bin/env python
# -*- coding: utf-8 -*-
Provides info about a particular server.
import restclient
import simplejson
import subprocess
import string
import random
import util_cli as util
class Info:
def __init__(self):
self.debug = False
def _remoteShellName(self):
tmp = ''.join(random.choice(string.ascii_letters) for i in xrange(20))
return 'ctl-%s@' % tmp
def runCmd(self, cmd, server, port,
user, password, ssl, opts):
for (o, a) in opts:
if o == '-d' or o == '--debug':
self.debug = True
rest = util.restclient_factory(server, port, {'debug':self.debug}, ssl)
opts = {'error_msg': 'server-info error'}
data = rest.restCmd('GET', '/nodes/self',
user, password, opts)
json = rest.getJson(data)
for x in ['license', 'licenseValid', 'licenseValidUntil']:
if x in json:
if cmd == 'get-server-info':
return json
elif cmd == 'server-eshell':
name = self._remoteShellName()
p =['erl','-name',name,
print simplejson.dumps(json, sort_keys=True, indent=2)
def getCommandSummary(self, cmd):
"""Return one-line summary info for each supported command"""
command_summary = {
"server-info" : "show details on one server"}
if cmd in command_summary:
return command_summary[cmd]
return None
Jump to Line
Something went wrong with that request. Please try again.