Skip to content

Commit a8820fe

Browse files
authored
Merge pull request #42 from epics-containers/dev
added ioc_name and ioc_version to helm install cmds
2 parents ce84383 + c026bfd commit a8820fe

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

src/epics_containers_cli/ioc/helm.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
from tempfile import mkdtemp
55
from typing import Optional
66

7-
import jinja2
87
import typer
98

109
from epics_containers_cli.globals import BEAMLINE_CHART_FOLDER, CONFIG_FOLDER
@@ -42,7 +41,6 @@ def __init__(
4241
self.tmp = Path(mkdtemp())
4342

4443
self.bl_chart_folder = self.tmp / BEAMLINE_CHART_FOLDER
45-
self.jinja_path = self.bl_chart_folder / "Chart.yaml.jinja"
4644
self.bl_chart_path = self.bl_chart_folder / "Chart.yaml"
4745
self.bl_config_folder = self.bl_chart_folder / CONFIG_FOLDER
4846

@@ -92,17 +90,12 @@ def deploy(self):
9290

9391
def _do_deploy(self, config_folder: Path):
9492
"""
95-
Generate an on the fly chart using beamline chart with config folder
96-
and generated Chart.yaml. Deploy the resulting helm chart to the cluster.
93+
Generate an on the fly chart using beamline chart with config folder.
94+
Deploy the resulting helm chart to the cluster.
9795
"""
9896
# values.yaml is a peer to the config folder
9997
values_path = config_folder.parent / "values.yaml"
10098

101-
# render a Chart.yaml from the jinja template
102-
template = jinja2.Template(self.jinja_path.read_text())
103-
chart = template.render(ioc_name=self.ioc_name, ioc_version=self.version)
104-
self.bl_chart_path.write_text(chart)
105-
10699
# add the config folder to the helm chart
107100
self.bl_config_folder.symlink_to(config_folder)
108101

@@ -124,7 +117,8 @@ def _install(
124117
cmd = (
125118
f"bash -c "
126119
f'"helm {helm_cmd} {self.ioc_name} {self.bl_chart_folder} '
127-
f"--version {self.version} --namespace {self.namespace} -f {values}"
120+
f"--version {self.version} --namespace {self.namespace} -f {values} "
121+
f"--set ioc_name={self.ioc_name} --set ioc_version={self.version} "
128122
f" 2> >(grep -v 'found symbolic link' >&2)\""
129123
)
130124
if self.args:

src/epics_containers_cli/utils.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,15 @@ def check_ioc_instance_path(ioc_path: Path, yes: bool = False):
4040
ioc_name = ioc_path.name.lower()
4141

4242
log.info(f"checking IOC instance {ioc_name} at {ioc_path}")
43-
if (
44-
not (ioc_path / "values.yaml").exists()
45-
or not (ioc_path / CONFIG_FOLDER).is_dir()
46-
):
47-
log.error("ERROR: IOC instance requires values.yaml and config")
43+
if ioc_path.is_dir():
44+
if (
45+
not (ioc_path / "values.yaml").exists()
46+
or not (ioc_path / CONFIG_FOLDER).is_dir()
47+
):
48+
log.error("IOC instance requires values.yaml and config")
49+
raise typer.Exit(1)
50+
else:
51+
log.error(f"IOC instance path {ioc_path} does not exist")
4852
raise typer.Exit(1)
4953

5054
return ioc_name, ioc_path

0 commit comments

Comments
 (0)