Print group as well

This commit is contained in:
Martin 2020-04-30 22:19:36 +02:00
parent 4da1fea9c4
commit 80c666e737
3 changed files with 20 additions and 4 deletions

View File

@ -16,7 +16,7 @@ setup(
# Versions should comply with PEP440. For a discussion on single-sourcing
# the version across setup.py and the project code, see
# https://packaging.python.org/en/latest/single_source_version.html
version='0.8.1',
version='0.9',
description='Python wrapper to access and control an UrBackup server',
long_description=long_description,

View File

@ -2,7 +2,7 @@ import urbackup_api
server = urbackup_api.urbackup_server("http://127.0.0.1:55414/x", "admin", "foo")
clients = server.get_status()
clients = server.get_clients_with_group()
for client in clients:
@ -33,10 +33,10 @@ for client in clients:
else:
incr_image+=1
print("Client {clientname} has {incr_file} incr file backups, {full_file} "
print("Client {clientname} in group {groupname} has {incr_file} incr file backups, {full_file} "
"full file backups, {incr_image} incr image backups and "
"{full_image} full image backups".format(
incr_file=incr_file, clientname=client["name"],
full_file=full_file, incr_image=incr_image,
full_image=full_image) )
full_image=full_image, groupname=client["groupname"]) )

View File

@ -432,6 +432,22 @@ class urbackup_server:
return backups["backups"]
def get_groups(self):
if not self.login():
return None
settings = self._get_json("settings")
return settings["navitems"]["groups"]
def get_clients_with_group(self):
if not self.login():
return None
settings = self._get_json("settings")
return settings["navitems"]["clients"]
def add_extra_client(self, addr):
if not self.login():
return None