Skip to content

Commit

Permalink
more fixes to cab auto naming
Browse files Browse the repository at this point in the history
  • Loading branch information
o-smirnov committed Nov 30, 2024
1 parent adfb5af commit 0c8bea9
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions stimela/kitchen/cab.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,16 +129,24 @@ def __post_init__ (self):
else:
raise CabValidationError(f"cab {self.name}: invalid image setting")

# setup wranglers
self._wranglers = []
for pattern, actions in self.management.wranglers.items():
self._wranglers.append(wranglers.create_list(pattern, actions))

# check flavours
self.flavour = flavours.init_cab_flavour(self)

# set name from command or image
if self.name is None:
self.name = self.command or self.image

# split off first word of name to avoid non-alphanumeric characters
match = re.match("(\w+)", self.name)
if match:
self.name = match.group(1)
self.name = match.group(1) or self.flavour.kind
else:
self.name = "unnamed"
self.name = self.flavour.kind

# check backend setting
if self.backend:
Expand All @@ -147,14 +155,6 @@ def __post_init__ (self):
except OmegaConfBaseException as exc:
raise CabValidationError(f"cab {self.name}: invalid backend setting", exc)

# setup wranglers
self._wranglers = []
for pattern, actions in self.management.wranglers.items():
self._wranglers.append(wranglers.create_list(pattern, actions))

# check flavours
self.flavour = flavours.init_cab_flavour(self)


def summary(self, params=None, recursive=True, ignore_missing=False):
lines = [f"cab {self.name}:"]
Expand Down

0 comments on commit 0c8bea9

Please sign in to comment.