Treat dashes/underscores as interchangeable symbols for container names
This patch aims to treat dashes and underscores equally in the existing inventory. In case a host already exists in the inventory, but has different separators, treat underscore and dash symbol as interchangeable. This is needed for futher coversion of container names to spearated with only dashes, while not adding new records to the inventory Change-Id: I63cd14c3353d7a9d7ea4d96155be26697ee4fa40
This commit is contained in:
parent
2a54cef636
commit
7dd23c28a8
|
@ -22,6 +22,7 @@ import netaddr
|
|||
from osa_toolkit import dictutils as du
|
||||
from osa_toolkit import filesystem as filesys
|
||||
from osa_toolkit import ip
|
||||
import re
|
||||
import uuid
|
||||
import warnings
|
||||
|
||||
|
@ -171,7 +172,8 @@ def _build_container_hosts(container_affinity, container_hosts, type_and_name,
|
|||
|
||||
for make_container in range(container_affinity):
|
||||
for i in container_hosts:
|
||||
if '{}-'.format(type_and_name) in i:
|
||||
sub_item = re.sub(r'[_-]', '[_-]', f'{type_and_name}-')
|
||||
if re.match(sub_item, i):
|
||||
du.append_if(array=container_list, item=i)
|
||||
|
||||
existing_count = len(list(set(container_list)))
|
||||
|
|
Loading…
Reference in New Issue