Skip to content

Commit cd1ea42

Browse files
committed
Get current running actions and stop them
1 parent af249cc commit cd1ea42

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

urbackup_api/__init__.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,4 +406,45 @@ def remove_extra_client(self, ecid):
406406
return False
407407

408408
return True
409+
410+
action_incr_file = 1
411+
action_full_file = 2
412+
action_incr_image = 3
413+
action_full_image = 4
414+
action_resumed_incr_file = 5
415+
action_resumed_full_file = 6
416+
action_file_restore = 8
417+
action_image_restore = 9
418+
action_client_update = 10
419+
action_check_db_integrity = 11
420+
action_backup_db = 12
421+
action_recalc_stats = 13
422+
423+
def get_actions(self):
424+
if not self.login():
425+
return None
426+
427+
ret = self._get_json("progress")
428+
429+
if not ret or not "progress" in ret:
430+
return None
431+
432+
return ret["progress"]
433+
434+
def stop_action(self, action):
435+
if (not "clientid" in action
436+
or not "id" in action):
437+
return False
438+
439+
if not self.login():
440+
return None
441+
442+
ret = self._get_json("progress",
443+
{"stop_clientid": action["clientid"],
444+
"stop_id": action["id"]})
445+
446+
if not ret or not "progress" in ret:
447+
return False
448+
449+
return True
409450

0 commit comments

Comments
 (0)