env

package
v0.9.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 31, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

README

ENV module

This module will merge the host env and global env, then render env into cloudrootfs templates or set env when exec a shell command and script.

ENV template render

ENV module only render the filename has ".tmpl" suffix, and render the result into a new file.

Like: test.yaml.tmpl -> test.yaml

test.yaml.tmpl:

{{ .foo }}

render result, test.yaml:

bar

Shell ENV

Add ENV value to each shell command.

Raw shell command:

cat /etc/hosts

WrapperShell:

foo=bar cat /etc/hosts

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RenderTemplate added in v0.9.0

func RenderTemplate(dir string, renderData map[string]interface{}) error

RenderTemplate :using renderData got from clusterfile to render all the files in dir with ".tmpl" as suffix. The scope of renderData comes from cluster.spec.env

func WrapperShell added in v0.9.0

func WrapperShell(shell string, wrapperData map[string]interface{}) string

WrapperShell :If target host already set env like DATADISK=/data in the clusterfile, This function will WrapperShell cmd like: Input shell: cat /etc/hosts Output shell: DATADISK=/data cat /etc/hosts it is convenient for user to get env in scripts The scope of env comes from cluster.spec.env and host.env

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL