Bug 2514 - mettre à jour le plan de câblage alimentation des serveurs communs

- désormais, les prises des appareils doivent être renseignés, sinon powerdiagram affiche les données qui lui manquent. Ca a notamment permis de détecter un oubli qui faisait qu'un des câbles était affiché plus gros que les autres (16A au lieu de 10A) sans raison apparente.
This commit is contained in:
Guillaume Raffy 2019-06-25 07:13:08 +00:00
parent 7c7d519eaf
commit 3e0a8ff373
1 changed files with 8 additions and 5 deletions

View File

@ -49,6 +49,8 @@ class Inventory(object):
machine_spec_id = self._sql_reader.get_table_attr('machines', 'name', machine_name, 'machine_spec_id') machine_spec_id = self._sql_reader.get_table_attr('machines', 'name', machine_name, 'machine_spec_id')
except SimpaDbUtil.TableAttrNotFound as e: # @UnusedVariable except SimpaDbUtil.TableAttrNotFound as e: # @UnusedVariable
raise MachineSpecIdNotFound(machine_name) raise MachineSpecIdNotFound(machine_name)
if machine_spec_id == '':
raise MachineSpecIdNotFound(machine_name)
return machine_spec_id return machine_spec_id
# electricity related methods # electricity related methods
@ -78,9 +80,9 @@ class Inventory(object):
machine_spec_id = None machine_spec_id = None
try: try:
machine_spec_id = self.machine_name_to_machine_spec_id(machine_name) machine_spec_id = self.machine_name_to_machine_spec_id(machine_name)
except SimpaDbUtil.TableAttrNotFound as e: # @UnusedVariable except MachineSpecIdNotFound as e:
raise MachineSpecIdNotFound(machine_name) raise e
if machine_spec_id is not None: else:
# INSERT INTO `powerplug_desc` (`machine_spec_id`, `powerplug_id`, `plug_type`) VALUES # INSERT INTO `powerplug_desc` (`machine_spec_id`, `powerplug_id`, `plug_type`) VALUES
# ('atos_mpdu_2901382', 'i', 'iec60309_blue_pne6h_32a_m'), # ('atos_mpdu_2901382', 'i', 'iec60309_blue_pne6h_32a_m'),
rows = self._sql_reader.query("SELECT plug_type FROM powerplug_desc WHERE machine_spec_id='%s' AND powerplug_id='%s'" % (machine_spec_id, plug_name)) rows = self._sql_reader.query("SELECT plug_type FROM powerplug_desc WHERE machine_spec_id='%s' AND powerplug_id='%s'" % (machine_spec_id, plug_name))
@ -96,14 +98,15 @@ class Inventory(object):
""" """
plug_capacity = None plug_capacity = None
plug_type = None plug_type = None
try: try:
plug_type = self.get_plug_type(plug.machine.name, plug.name) plug_type = self.get_plug_type(plug.machine.name, plug.name)
except MachineSpecIdNotFound: except MachineSpecIdNotFound:
# some machines are not actual machines (eg edf, ups1pdu) # some machines are not actual machines (eg edf, ups1pdu)
pass pass
except PlugTypeNotFound: #except PlugTypeNotFound:
# some plugs are just plain connections, with no actual plug types # some plugs are just plain connections, with no actual plug types
pass # pass
if plug_type is not None: if plug_type is not None:
# print('plug_type : %s' % plug_type) # print('plug_type : %s' % plug_type)