Les fichiers avec des - en python, c'est mal
This commit is contained in:
parent
5bfde5742c
commit
2c72dce85d
1 changed files with 0 additions and 0 deletions
|
@ -1,56 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# slon-get-volume-mapping.py
|
||||
# --------------------------
|
||||
# Copyright : (c) 2012, Olivier Iffrig <iffrig@crans.org>
|
||||
# Copyright : (c) 2008, Jeremie Dimino <dimino@crans.org>
|
||||
# Licence : BSD3
|
||||
|
||||
u'''Outil pour récupérer le mapping lun/volume depuis la baie de
|
||||
stockage'''
|
||||
|
||||
import slonlib, re, sys
|
||||
|
||||
sys.path.append("/usr/scripts/gestion")
|
||||
from config import ISCSI_MAP_FILE_TEMPLATE
|
||||
import affich_tools
|
||||
|
||||
map_file = ISCSI_MAP_FILE_TEMPLATE % "slon"
|
||||
|
||||
print u"Connection à la baie de stockage..."
|
||||
|
||||
slon = slonlib.Slon()
|
||||
|
||||
print u"Récupération des informations..."
|
||||
|
||||
map = slon.volume_map().items()
|
||||
map.sort()
|
||||
|
||||
print u"Déconnection..."
|
||||
|
||||
slon.logout()
|
||||
|
||||
print u"Enregistrement des informations..."
|
||||
|
||||
f = open(map_file, "w")
|
||||
f.write((u"""\
|
||||
# -*- coding: utf-8 -*-
|
||||
# Fichier de mapping lun -> nom de volume
|
||||
#
|
||||
# Ce fichier est généré par %s
|
||||
|
||||
map = {
|
||||
""" % sys.argv[0]).encode("UTF-8"))
|
||||
|
||||
for lun, name in map:
|
||||
f.write(' %d : "%s",\n' % (lun, name))
|
||||
|
||||
f.write("}\n")
|
||||
|
||||
f.close()
|
||||
|
||||
print u"Terminé, mapping enregistré dans %s" % map_file
|
||||
|
||||
print u"Le mapping actuel est:"
|
||||
print affich_tools.tableau(titre = ["lun", "nom"], data = map, alignement = ["g", "c"])
|
Loading…
Add table
Add a link
Reference in a new issue