added some metthods and method stubs to interface and jsonrpc
This commit is contained in:
parent
b990b6ff41
commit
6d934652dd
3 changed files with 121 additions and 7 deletions
|
|
@ -25,10 +25,18 @@ from bjsonrpc import connect
|
|||
|
||||
c = connect()
|
||||
|
||||
print c.call.get_job_list()
|
||||
#print c.call.get_job_list()
|
||||
|
||||
print c.call.get_job_info_by_id("3950d44b")
|
||||
#print c.call.get_job_info_by_id("3950d44b")
|
||||
|
||||
print c.call.set_job_enabled("3950d44b", False)
|
||||
#print c.call.set_job_enabled("3950d44b", False)
|
||||
|
||||
print c.call.get_job_count()
|
||||
#print c.call.get_job_count()
|
||||
|
||||
#print c.call.get_job_list_by_hostgroup("a")
|
||||
|
||||
#print c.call.get_job_count_by_hostgroup("a")
|
||||
|
||||
#print c.call.get_job_list_by_host("d")
|
||||
|
||||
#print c.call.get_job_count_by_host("d")
|
||||
|
|
@ -60,10 +60,26 @@ class ServerHandler(BaseHandler):
|
|||
job_list = ServerHandler.interface.get_job_list()
|
||||
return json.dumps(job_list, ensure_ascii=False)
|
||||
|
||||
def get_job_list_by_hostgroup(self, hostgroup):
|
||||
job_list = ServerHandler.interface.get_job_list_by_hostgroup(hostgroup)
|
||||
return json.dumps(job_list, ensure_ascii=False)
|
||||
|
||||
def get_job_list_by_host(self, host):
|
||||
job_list = ServerHandler.interface.get_job_list_by_host(host)
|
||||
return json.dumps(job_list, ensure_ascii=False)
|
||||
|
||||
def get_job_count(self):
|
||||
job_count = ServerHandler.interface.get_job_count()
|
||||
return json.dumps(job_count, ensure_ascii=False)
|
||||
|
||||
def get_job_count_by_hostgroup(self, hostgroup):
|
||||
job_count = ServerHandler.interface.get_job_count_by_hostgroup(hostgroup)
|
||||
return json.dumps(job_count, ensure_ascii=False)
|
||||
|
||||
def get_job_count_by_host(self, host):
|
||||
job_count = ServerHandler.interface.get_job_count_by_host(host)
|
||||
return json.dumps(job_count, ensure_ascii=False)
|
||||
|
||||
def get_job_info_by_id(self, job_hex):
|
||||
job = ServerHandler.interface.find_job_by_hex_string(job_hex)
|
||||
job_dict = ServerHandler.interface.get_job_info_dict(job)
|
||||
|
|
@ -72,4 +88,34 @@ class ServerHandler(BaseHandler):
|
|||
def set_job_enabled(self, job_hex, enabled=True):
|
||||
job = ServerHandler.interface.find_job_by_hex_string(job_hex)
|
||||
job.set_enabled(enabled)
|
||||
return True
|
||||
return True
|
||||
|
||||
def get_hostgroup_list(self):
|
||||
pass
|
||||
|
||||
def get_hostgroup_count(self):
|
||||
pass
|
||||
|
||||
def get_host_list(self):
|
||||
pass
|
||||
|
||||
def get_host_list_by_hostgroup(self, hostgroup):
|
||||
pass
|
||||
|
||||
def get_host_count(self):
|
||||
pass
|
||||
|
||||
def get_host_count_by_hostgroup(self, hostgroup):
|
||||
pass
|
||||
|
||||
def get_services_by_hostgroup(self, hostgroup):
|
||||
pass
|
||||
|
||||
def get_services_by_host(self, host):
|
||||
pass
|
||||
|
||||
def get_service_count_by_hostgroup(self, hostgroup):
|
||||
pass
|
||||
|
||||
def get_service_count_by_host(self, host):
|
||||
pass
|
||||
|
|
@ -67,12 +67,39 @@ class LinspectorInterface(object):
|
|||
job_list.append(d)
|
||||
return job_list
|
||||
|
||||
def get_job_list_by_hostgroup(self, hostgroup):
|
||||
job_list = []
|
||||
for job in self.jobs:
|
||||
if hostgroup == job.hostgroup.get_name():
|
||||
d = self.get_job_info_dict(job)
|
||||
job_list.append(d)
|
||||
return job_list
|
||||
|
||||
def get_job_list_by_host(self, host):
|
||||
job_list = []
|
||||
for job in self.jobs:
|
||||
if host == job.host:
|
||||
d = self.get_job_info_dict(job)
|
||||
job_list.append(d)
|
||||
return job_list
|
||||
|
||||
def get_job_count(self):
|
||||
count = len(self.jobs)
|
||||
return count
|
||||
|
||||
def get_enabled_layouts(self):
|
||||
self._config.get_enabled_layouts()
|
||||
def get_job_count_by_hostgroup(self, hostgroup):
|
||||
job_count = 0
|
||||
for job in self.jobs:
|
||||
if hostgroup == job.hostgroup.get_name():
|
||||
job_count += 1
|
||||
return job_count
|
||||
|
||||
def get_job_count_by_host(self, host):
|
||||
job_count = 0
|
||||
for job in self.jobs:
|
||||
if host == job.host:
|
||||
job_count += 1
|
||||
return job_count
|
||||
|
||||
def _set_jobs_enabled(self, jobs, enabled=True):
|
||||
for job in jobs:
|
||||
|
|
@ -86,3 +113,36 @@ class LinspectorInterface(object):
|
|||
|
||||
def set_hostgroup_jobs_enabled(self, hostgroupName, enabled=True):
|
||||
self._set_jobs_enabled(self._compare_jobs(lambda job: job.hostgroup.get_name(), hostgroupName), enabled)
|
||||
|
||||
def get_hostgroup_list(self):
|
||||
pass
|
||||
|
||||
def get_hostgroup_count(self):
|
||||
pass
|
||||
|
||||
def get_host_list(self):
|
||||
pass
|
||||
|
||||
def get_host_list_by_hostgroup(self, hostgroup):
|
||||
pass
|
||||
|
||||
def get_host_count(self):
|
||||
pass
|
||||
|
||||
def get_host_count_by_hostgroup(self, hostgroup):
|
||||
pass
|
||||
|
||||
def get_services_by_hostgroup(self, hostgroup):
|
||||
pass
|
||||
|
||||
def get_services_by_host(self, host):
|
||||
pass
|
||||
|
||||
def get_service_count_by_hostgroup(self, hostgroup):
|
||||
pass
|
||||
|
||||
def get_service_count_by_host(self, host):
|
||||
pass
|
||||
|
||||
def get_enabled_layouts(self):
|
||||
self._config.get_enabled_layouts()
|
||||
Loading…
Add table
Add a link
Reference in a new issue