Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Backup/Restore iodd #45

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions python/mujinwebstackclient/webstackclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -1043,16 +1043,19 @@ def DeleteAllITLPrograms(self, timeout=5):
# Backup restore
#

def Backup(self, saveconfig=True, savemedia=True, backupscenepks=None, saveapps=True, saveitl=True, savedetection=False, savecalibration=False, savedebug=False, timeout=600):
def Backup(self, saveconfig=True, savemedia=True, backupscenepks=None, saveapps=True, saveitl=True, savedetection=False, savestate=True, savecalibration=False, savedebug=False, saveeds=True, saveiodd=True, timeout=600):
"""Downloads a backup file

:param saveconfig: Whether we want to include configs in the backup, defaults to True
:param savemedia: Whether we want to include media files in the backup, defaults to True
:param saveapps: Whether we want to include web apps in the backup, defaults to True
:param saveitl: Whether we want to include itl programs in the backup, defaults to True
:param savedetection: Whether we want to include detection files in the backup, defaults to False
:param savestate: Whether we want to include state files in the backup, defaults to True
:param savecalibration: Whether we want to include calibration files in the backup, defaults to False
:param savedebug: Whether we want to include debug files in the backup, defaults to False
:param saveeds: Whether we want to include eds files in the backup, defaults to True
:param saveiodd: Whether we want to include iodd files in the backup, defaults to True
:param backupscenepks: List of scenes to backup, defaults to None
:param timeout: Amount of time in seconds to wait before failing, defaults to 600
:raises WebstackClientError: If request wasn't successful
Expand All @@ -1064,22 +1067,27 @@ def Backup(self, saveconfig=True, savemedia=True, backupscenepks=None, saveapps=
'apps': 'true' if saveapps else 'false',
'itl': 'true' if saveitl else 'false',
'detection': 'true' if savedetection else 'false',
'state': 'true' if savestate else 'false',
'calibration': 'true' if savecalibration else 'false',
'debug': 'true' if savedebug else 'false',
'eds': 'true' if saveeds else 'false',
'iodd': 'true' if saveiodd else 'false',
'backupScenePks': ','.join(backupscenepks) if backupscenepks else None,
}, timeout=timeout)
if response.status_code != 200:
raise WebstackClientError(response.content.decode('utf-8'), response=response)
return response

def Restore(self, file, restoreconfig=True, restoremedia=True, restoreapps=True, restoreitl=True, timeout=600):
def Restore(self, file, restoreconfig=True, restoremedia=True, restoreapps=True, restoreitl=True, restoreeds=True, restoreiodd=True, timeout=600):
"""Uploads a previously downloaded backup file to restore

:param file: Backup filer in tarball format
:param restoreconfig: Whether we want to restore the configs, defaults to True
:param restoremedia: Whether we want to restore the media data, defaults to True
:param restoreapps: Whether we want to restore the web apps, defaults to True
:param restoreitl: Whether we want to restore the itl programs, defaults to True
:param restoreeds: Whether we want to restore the eds files, defaults to True
:param restoreiodd: Whether we want to restore the iodd files, defaults to True
:param timeout: Amount of time in seconds to wait before failing, defaults to 600
:raises WebstackClientError: If request wasn't successful
:return: JSON response
Expand All @@ -1089,6 +1097,9 @@ def Restore(self, file, restoreconfig=True, restoremedia=True, restoreapps=True,
'config': 'true' if restoreconfig else 'false',
'apps': 'true' if restoreapps else 'false',
'itl': 'true' if restoreitl else 'false',
'state': 'true' if restorestate else 'false',
cielavenir marked this conversation as resolved.
Show resolved Hide resolved
'eds': 'true' if restoreeds else 'false',
'iodd': 'true' if restoreiodd else 'false',
}, timeout=timeout)
if response.status_code in (200,):
try:
Expand Down
Loading