diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2020-05-25 11:18:27 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2020-05-25 11:18:27 -0300 |
commit | 37867232bdcb373b41bd9b416e3c0f6ab413b477 (patch) | |
tree | ac0dd6d9a86db0179beb4f4baf7812f4debc0732 | |
parent | 97239bea4ce51cdb25584580e20b75545ecb84c2 (diff) | |
download | hydra-37867232bdcb373b41bd9b416e3c0f6ab413b477.tar.gz hydra-37867232bdcb373b41bd9b416e3c0f6ab413b477.tar.bz2 |
Adds hydractl yaml-param
-rw-r--r-- | lib/hydra/deploy | 2 | ||||
-rwxr-xr-x | share/hydractl/yaml-param | 30 |
2 files changed, 31 insertions, 1 deletions
diff --git a/lib/hydra/deploy b/lib/hydra/deploy index b985aa8..3335686 100644 --- a/lib/hydra/deploy +++ b/lib/hydra/deploy @@ -245,7 +245,7 @@ function hydra_deploy_copy { function hydra_deploy_facts_setup { echo "Setting up custom facts..." - ROLE="`hydra_yaml_param nodo::role $HYDRA_FOLDER/puppet/config/node/$FQDN.yaml`" + ROLE="`hydra_yaml_param nodo::role $HYDRA_FOLDER/puppet/config/node/$FQDN.yaml`" LOCATION="`hydra_yaml_param nodo::location $HYDRA_FOLDER/puppet/config/node/$FQDN.yaml`" if [ -z "$ROLE" ]; then diff --git a/share/hydractl/yaml-param b/share/hydractl/yaml-param new file mode 100755 index 0000000..1ace6c2 --- /dev/null +++ b/share/hydractl/yaml-param @@ -0,0 +1,30 @@ +#!/bin/bash + +# Load. +source $APP_BASE/lib/hydra/functions || exit 1 +hydra_config_load + +# Parameters +BASENAME="`basename $0`" +PARAM="$1" +YAML_FILE="$2" +DEFAULT="$3" + +# Check +if [ -z "$2" ]; then + echo "usage: $BASENAME <param> <file> [default-value]" + exit 1 +elif [ ! -e "$YAML_FILE" ]; then + echo "file not found: $YAML_FILE" + exit 1 +fi + +# Dispatch +PARAM="`hydra_yaml_param $PARAM $YAML_FILE`" + +# Display +if [ ! -z "$PARAM" ]; then + echo "$PARAM" +elif [ ! -z "$DEFAULT" ]; then + echo "$DEFAULT" +fi |