generic templates endpoint for cli
This commit is contained in:
parent
7daa9a3874
commit
3ce69baf26
3 changed files with 38 additions and 37 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
## 0.4.0
|
## 0.4.0
|
||||||
|
|
||||||
- create now has --apply to apply the generated manifest to the cluster
|
- create now has --apply to apply the generated manifest to the cluster
|
||||||
|
- generic templates endpoint for cli
|
||||||
|
|
||||||
## 0.3.0
|
## 0.3.0
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ from typer import Typer
|
||||||
|
|
||||||
app = Typer()
|
app = Typer()
|
||||||
|
|
||||||
app.add_typer(templates_app, name="templates", no_args_is_help=True)
|
app.add_typer(templates_app, name="template", no_args_is_help=True)
|
||||||
app.add_typer(pod_app, name="pod", no_args_is_help=True)
|
app.add_typer(pod_app, name="pod", no_args_is_help=True)
|
||||||
app.command(name="create")(create)
|
app.command(name="create")(create)
|
||||||
app.command(name="c")(create)
|
app.command(name="c")(create)
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,8 @@ def list():
|
||||||
|
|
||||||
|
|
||||||
@app.command()
|
@app.command()
|
||||||
def base(
|
def render(
|
||||||
|
template_name: Optional[str] = typer.Option("base.sh", "--template-name", "-t"),
|
||||||
volumes: Optional[List[str]] = typer.Option(
|
volumes: Optional[List[str]] = typer.Option(
|
||||||
None,
|
None,
|
||||||
"--volume",
|
"--volume",
|
||||||
|
|
@ -48,7 +49,6 @@ def base(
|
||||||
help="additional hooks to execute at the start of container initialization",
|
help="additional hooks to execute at the start of container initialization",
|
||||||
),
|
),
|
||||||
):
|
):
|
||||||
template_name = "base.sh"
|
|
||||||
template = env.get_template(template_name)
|
template = env.get_template(template_name)
|
||||||
rendered = template.render(
|
rendered = template.render(
|
||||||
volumes=volumes,
|
volumes=volumes,
|
||||||
|
|
@ -62,37 +62,37 @@ def base(
|
||||||
print(rendered)
|
print(rendered)
|
||||||
|
|
||||||
|
|
||||||
@app.command()
|
# @app.command()
|
||||||
def install(
|
# def install(
|
||||||
additional_packages: Optional[List[str]] = typer.Option(
|
# additional_packages: Optional[List[str]] = typer.Option(
|
||||||
..., "--additional-packages", "-ap"
|
# ..., "--additional-packages", "-ap"
|
||||||
),
|
# ),
|
||||||
):
|
# ):
|
||||||
template_name = "install.sh"
|
# template_name = "install.sh"
|
||||||
template = env.get_template(template_name)
|
# template = env.get_template(template_name)
|
||||||
rendered = template.render(additional_packages=additional_packages)
|
# rendered = template.render(additional_packages=additional_packages)
|
||||||
print(rendered)
|
# print(rendered)
|
||||||
|
#
|
||||||
|
#
|
||||||
@app.command()
|
# @app.command()
|
||||||
def motd(
|
# def motd(
|
||||||
volumes: Optional[List[str]] = typer.Option(
|
# volumes: Optional[List[str]] = typer.Option(
|
||||||
None,
|
# None,
|
||||||
"--volume",
|
# "--volume",
|
||||||
),
|
# ),
|
||||||
pvcs: Optional[List[str]] = typer.Option(
|
# pvcs: Optional[List[str]] = typer.Option(
|
||||||
None,
|
# None,
|
||||||
"--pvc",
|
# "--pvc",
|
||||||
),
|
# ),
|
||||||
additional_packages: Optional[List[str]] = typer.Option(
|
# additional_packages: Optional[List[str]] = typer.Option(
|
||||||
..., "--additional-packages", "-ap"
|
# ..., "--additional-packages", "-ap"
|
||||||
),
|
# ),
|
||||||
):
|
# ):
|
||||||
template_name = "motd.sh"
|
# template_name = "motd.sh"
|
||||||
template = env.get_template(template_name)
|
# template = env.get_template(template_name)
|
||||||
rendered = template.render(
|
# rendered = template.render(
|
||||||
volumes=volumes,
|
# volumes=volumes,
|
||||||
pvcs=pvcs,
|
# pvcs=pvcs,
|
||||||
additional_packages=additional_packages,
|
# additional_packages=additional_packages,
|
||||||
)
|
# )
|
||||||
print(rendered)
|
# print(rendered)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue