Skip to content

Commit

Permalink
🐛 podspec should not try to access template
Browse files Browse the repository at this point in the history
  • Loading branch information
nikhiljha committed Apr 28, 2024
1 parent f999324 commit 4f49108
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
3 changes: 0 additions & 3 deletions transpire/resources/deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,3 @@ def pod_spec(self) -> PodSpec:

def get_selector(self) -> dict[str, str]:
return {self.SELECTOR_LABEL: self.obj.metadata.name}

def __getattr__(self, name: str) -> Any:
return getattr(self.pod_spec(), name)
6 changes: 3 additions & 3 deletions transpire/resources/podspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def with_arbitrary_volume(
def get_container(
self, name: str | None = None, *, remove: bool = False
) -> client.V1Container:
container_list = self.obj.template.spec.containers
container_list = self.obj.containers

if name is None:
if len(container_list) != 1:
Expand All @@ -219,7 +219,7 @@ def get_container(
raise ValueError(f"No such container: {name}")

def add_container(self, name: str, image: str) -> Self:
container_list = self.obj.template.spec.containers
container_list = self.obj.containers

names = set(c.name for c in container_list)
if name in names:
Expand All @@ -234,7 +234,7 @@ def add_container(self, name: str, image: str) -> Self:
return self

def add_arbitrary_container(self, container: client.V1Container) -> int:
container_list = self.obj.template.spec.containers
container_list = self.obj.containers

names = set(c.name for c in container_list)
if container.name in names:
Expand Down

0 comments on commit 4f49108

Please sign in to comment.