fixed bug in DellConfiguratorParser2025 : chassis is no longer hardcoded

work related to [https://bugzilla.ipr.univ-rennes.fr/show_bug.cgi?id=4171]
This commit is contained in:
Guillaume Raffy 2025-10-21 19:03:33 +02:00
parent 34552b83b5
commit 3cd99587ca
1 changed files with 13 additions and 1 deletions

View File

@ -987,7 +987,19 @@ class DellConfiguratorParser2025(DellConfiguratorParser):
super().__init__(use_additional_cpus_module=False) # no information is available in additional_cpus module. use cpu_change module instead
def _parse_chassis(self, html_root: HtmlElement) -> str:
chassis_id = "dell-poweredge-r670"
# <div class="col cf-hero-details">
# <div class="cf-product-order">
# <h1 class="cf-pg-title"><span>Cat2 Conf 2-2-07: Dell Poweredge R670</span></h1>
conf_title_element = html_root.xpath(".//h1[@class='cf-pg-title']")[0]
assert conf_title_element is not None
title_span_element = conf_title_element.xpath(".//span")[0]
assert title_span_element is not None
title = title_span_element.text_content().replace('\n', '').strip() # eg 'Cat2 Conf 2-2-07: Dell Poweredge R670'
match = re.match(r'^Cat[0-9]+ Conf [0-9\-]+: Dell Poweredge (?P<chassis_type>[CR][0-9][0-9][0-9][0-9]?).*', title)
assert match, 'unhandled title : %s' % title
# print(match['cpu_class'], match['cpu_number'])
chassis_id = "dell-poweredge-%s" % (match['chassis_type'].lower(), ) # eg "dell-poweredge-r670"
logging.debug(f'chassis_id : {chassis_id}')
return chassis_id
def get_module_label(self, module_id) -> str: