Commit 83a489fa authored by Charlie Jacomme's avatar Charlie Jacomme

[client] Fonctions de restaurations de fichiers corrompues

parent 5b8b19fe
......@@ -365,6 +365,12 @@ def all_files(options):
"""Récupère les fichiers du serveur distant"""
return remote_command(options, "listfiles")
def restore_all_files(options):
"""Récupère les fichiers du serveur distant"""
return remote_command(options, "restorefiles")
def get_files(options, filenames):
"""Récupère le contenu des fichiers distants"""
return remote_command(options, "getfiles", stdin_contents=filenames)
......@@ -602,6 +608,16 @@ def show_files(options):
print((u" %s %s (%s)" % ((access and '+' or '-'), fname, ", ".join(froles))).encode("utf-8"))
print((u"""--Mes roles: %s""" % (", ".join(my_roles),)).encode("utf-8"))
def restore_files(options):
"""Restore les fichiers corrompues sur le serveur distant"""
print(u"Fichier corrompus :".encode("utf-8"))
files = restore_all_files(options)
keys = files.keys()
for fname in keys:
print((u" %s (%s)" % ( fname, files[fname])).encode("utf-8"))
def show_roles(options):
"""Affiche la liste des roles existants"""
print(u"Liste des roles disponibles".encode("utf-8"))
......@@ -985,6 +1001,9 @@ if __name__ == "__main__":
action_grp.add_argument('-l', '--list', action='store_const', dest='action',
default=show_file, const=show_files,
help="Lister les fichiers")
action_grp.add_argument('-r', '--restore', action='store_const', dest='action',
default=show_file, const=restore_files,
help="Restorer les fichiers corrompues")
action_grp.add_argument('--check-keys', action='store_const', dest='action',
default=show_file, const=my_check_keys,
help="Vérifier les clés")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment