Skip to content

Commit 355fbab

Browse files
committed
CName: Fix issues in CName class
1 parent 832e5a6 commit 355fbab

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/gardenlinux/features/cname.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,13 @@ def cname(self) -> str:
9292
9393
:return: (str) CName
9494
"""
95-
95+
assert self._flavor is not None, "CName flavor is not set!"
9696
cname = self._flavor
9797

9898
if self._arch is not None:
9999
cname += f"-{self._arch}"
100100

101-
if self._commit_id is not None:
101+
if self._commit_id is not None and self._version is not None:
102102
cname += f"-{self.version_and_commit_id}"
103103

104104
return cname
@@ -114,7 +114,7 @@ def commit_id(self) -> Optional[str]:
114114
return self._commit_id
115115

116116
@property
117-
def flavor(self) -> str:
117+
def flavor(self) -> str | None:
118118
"""
119119
Returns the flavor for the cname parsed.
120120
@@ -140,6 +140,7 @@ def platform(self) -> str:
140140
141141
:return: (str) Flavor
142142
"""
143+
assert self._flavor is not None, "Flavor not set!"
143144

144145
return re.split("[_-]", self._flavor, maxsplit=1)[0]
145146

0 commit comments

Comments
 (0)