corrections

This commit is contained in:
Matthieu Lamalle 2021-06-30 15:13:29 +02:00
parent 66b42612f9
commit 93fd0536f1
5 changed files with 15 additions and 14 deletions

View File

@ -10,7 +10,7 @@ from collections import OrderedDict
def display_help(): def display_help():
print("Modification de la valeur d'une variable d'un serveur") print("Modification de la valeur d'une variable d'un serveur")
print("{} [--var nom_variable --value valeur]".format(sys.argv[0])) print("{} [--r realm --d domain]".format(sys.argv[0]))
def argparser(): def argparser():
@ -55,12 +55,12 @@ def main():
fh.write(cjson.encode(store)) fh.write(cjson.encode(store))
fh.close() fh.close()
cmd="""CreoleCat samba4-vars.conf""" cmd="""CreoleCat -t samba4-vars.conf"""
output = os.popen(cmd) output = os.popen(cmd)
res = output.read().strip() res = output.read().strip()
output.close() output.close()
cmd="""/usr/share/eole/posttemplate/25-manage-samba instance""" cmd="""/usr/share/eole/postservice/25-manage-samba instance"""
output = os.popen(cmd) output = os.popen(cmd)
res = output.read().strip() res = output.read().strip()
output.close() output.close()

View File

@ -51,9 +51,11 @@ def main():
if varc in store: if varc in store:
store[varc]['val'] = valvar store[varc]['val'] = valvar
fh = open("/etc/eole/config.eol", 'w') fh = open("/etc/eole/config.eol", 'w')
fh.write(cjson.encode(store)) fh.write(cjson.encode(store))
fh.close() fh.close()
else:
print_orange('Erreur : variable {} inconnue'.format(varc))
if __name__ == '__main__': if __name__ == '__main__':

View File

@ -40,7 +40,7 @@ def argparser():
display_help() display_help()
sys.exit(1) sys.exit(1)
if sys.argv[2] in ['-v', '--var']: if sys.argv[2] in ['-v', '--var']:
varc = sys.argv[3] varc = sys.argv[3]
return server_id, user return server_id, user

View File

@ -81,12 +81,11 @@ def main():
for id_serv in liste_serveurs : for id_serv in liste_serveurs :
ret = proxy.serveurs.del_serveur(id_serv) ret = proxy.serveurs.del_serveur(id_serv)
if ret[1]: if ret[1]:
print_orange('Erreur : ' + str(ret[1])) if ret[1] == "ok":
sys.exit(1) print('Les serveurs {} ont été supprimés'.format(liste_serveurs))
else:
print('Les serveurs {} ont été supprimés'.format(liste_serveurs)) print_orange('Erreur : ' + str(ret[1]))
sys.exit(1)
def get_pwd(addr, port): def get_pwd(addr, port):
"""lecture d'un login/passwd pour l'application zephir """lecture d'un login/passwd pour l'application zephir

View File

@ -40,7 +40,7 @@ def argparser():
display_help() display_help()
sys.exit(1) sys.exit(1)
if sys.argv[2] in ['-s', '--script']: if sys.argv[2] in ['-s', '--script']:
script = sys.argv[3] script = sys.argv[3]
return group_id, script, None return group_id, script, None