Closed libokj closed 3 years ago
I think the best way to solve the current problem is to inject the bits covered by the wildcard as a prefix to the station UUID.
In the test example with us:*
, the keys in openkongqi.stations._STATIONS_MAP
are us:ca
and us:oh
.
openkongqi.utils.get_uuid(*args)
:
SEP.join([frag.replace(SEP + WILDCARD, "") for frag in args])
openkongqi.stations._inject_uuid_prefix(prefix, map)
that takes a station map, creates a copy of all items where it injects the prefix at the start of the uuid and return that new map.openkongqi.stations.get_station_map(uuid)
to inject the remaining of k
when removing the wildcarded protion of the uuid.
Replace wildcard with the respective region name when building the UUID (e.g.
okq:cnemc:cn:cnemc:*:1524a:latest
should beokq:cnemc:cn:cnemc:hunan:zhuzhou:1524a:latest
).Potentially relevant code: https://github.com/gams/openkongqi/blob/c7d94c2f14e85f0a64f3796a08ea3023b0f8681f/openkongqi/utils.py#L29