correciton bug
This commit is contained in:
parent
ebcb30f0ba
commit
1a63a81555
@ -71,7 +71,7 @@ def main():
|
||||
output = os.popen(cmd)
|
||||
res = output.read().strip()
|
||||
output.close()
|
||||
|
||||
to_save = ""
|
||||
if not save :
|
||||
to_save = raw_input("Souhaitez vous sauvegarder la configuration sur Zephir ? (O/N) ")
|
||||
if to_save == "O":
|
||||
|
58
scripts/zephir/groups.py
Normal file
58
scripts/zephir/groups.py
Normal file
@ -0,0 +1,58 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
from zephir.backend.lib_backend import CxPool
|
||||
|
||||
def make_group():
|
||||
cx_pool = CxPool()
|
||||
cu = cx_pool.create()
|
||||
cu.execute("""select libelle,id from modules""")
|
||||
infos = {}
|
||||
variante_infos = {}
|
||||
filename = 'exportation'
|
||||
server_infos = []
|
||||
for module_name in cu.fetchall():
|
||||
module, version = module_name[0].rsplit('-', 1)
|
||||
infos.setdefault(version, {})[module] = module_name[1]
|
||||
|
||||
versions = infos.keys()
|
||||
versions.sort()
|
||||
print('Choix de la version :')
|
||||
for idx, version in enumerate(versions):
|
||||
print('{}: {}'.format(idx, version))
|
||||
idx = input('> ')
|
||||
version = versions[int(idx)]
|
||||
filename += '-' + version
|
||||
print
|
||||
print('Choix du module :')
|
||||
modules = infos[version].keys()
|
||||
modules.sort()
|
||||
for idx, module in enumerate(modules):
|
||||
print('{}: {}'.format(idx, module))
|
||||
idx = input('> ')
|
||||
module = modules[int(idx)]
|
||||
filename += '-' + module
|
||||
print
|
||||
cu.execute("select libelle,id from variantes where module = " + str(infos[version][module]))
|
||||
for variante_obj in cu.fetchall():
|
||||
variante_infos[variante_obj[0]] = variante_obj[1]
|
||||
print('Choix de la variante :')
|
||||
variantes = variante_infos.keys()
|
||||
variantes.sort()
|
||||
for idx, variante in enumerate(variantes):
|
||||
print('{}: {}'.format(idx, variante))
|
||||
idx_all = idx + 1
|
||||
print('{}: toutes les variantes'.format(idx_all))
|
||||
idx = input('> ')
|
||||
if idx == idx_all:
|
||||
variantes = variante_infos.values()
|
||||
else:
|
||||
filename += '-' + variantes[idx]
|
||||
variantes = [variante_infos[variantes[idx]]]
|
||||
print
|
||||
for variante in variantes:
|
||||
cu.execute('select id,ip_publique,rne,libelle from serveurs where variante=' + str(variante))
|
||||
print("Liste des serveurs : ")
|
||||
for server in cu.fetchall():
|
||||
print('{} - {} - {} - {}'.format(server[0], server[1], server[2], server[3]))
|
||||
server_infos.append((server[0], server[1], server[2], server[3]))
|
||||
return server_infos
|
Loading…
Reference in New Issue
Block a user