Skip to content

Commit 93a1ff6

Browse files
committed
Add example listing backup counts
1 parent 3f6cfb9 commit 93a1ff6

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

test/list_backup_counts.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import urbackup_api
2+
3+
server = urbackup_api.urbackup_server("http://127.0.0.1:55414/x", "admin", "foo")
4+
5+
clients = server.get_status()
6+
7+
for client in clients:
8+
9+
file_backups = server.get_clientbackups(client["id"])
10+
11+
incr_file = 0
12+
full_file = 0
13+
14+
for file_backup in file_backups:
15+
16+
if file_backup["incremental"]>0:
17+
full_file+=1
18+
else:
19+
incr_file+=1
20+
21+
incr_image = 0
22+
full_image = 0
23+
24+
image_backups = server.get_clientimagebackups(client["id"])
25+
26+
for image_backup in image_backups:
27+
28+
if image_backup["letter"]=="SYSVOL" or image_backup["letter"]=="ESP":
29+
continue
30+
31+
if image_backup["incremental"]>0:
32+
full_image+=1
33+
else:
34+
incr_image+=1
35+
36+
print("Client {clientname} has {incr_file} incr file backups, {full_file} "
37+
"full file backups, {incr_image} incr image backups and "
38+
"{full_image} full image backups".format(
39+
incr_file=incr_file, clientname=client["name"],
40+
full_file=full_file, incr_image=incr_image,
41+
full_image=full_image) )
42+

0 commit comments

Comments
 (0)