forked from ungleich-public/cdist
cleaner way to set default values
Signed-off-by: Steven Armstrong <steven@icarus.ethz.ch>
This commit is contained in:
parent
85f7880c7e
commit
4628dad045
2 changed files with 6 additions and 11 deletions
|
@ -21,11 +21,9 @@
|
|||
# Get the current value of key or __NOTSET__ if the key doesn't exist.
|
||||
#
|
||||
|
||||
if [ -f "$__object/parameter/key" ]; then
|
||||
key="$(cat "$__object/parameter/key")"
|
||||
else
|
||||
key="$__object_id"
|
||||
fi
|
||||
key="$(cat "$__object/parameter/key" 2>/dev/null \
|
||||
|| echo "$__object_id")"
|
||||
|
||||
file="$(cat "$__object/parameter/file")"
|
||||
delimiter="$(cat "$__object/parameter/delimiter")"
|
||||
|
||||
|
|
|
@ -18,9 +18,6 @@
|
|||
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
if [ -f "$__object/parameter/key" ]; then
|
||||
key="$(cat "$__object/parameter/key")"
|
||||
else
|
||||
echo "$__object_id" > "$__object/parameter/key"
|
||||
fi
|
||||
|
||||
# set defaults
|
||||
[ -f "$__object/parameter/key" ] \
|
||||
|| echo "$__object_id" > "$__object/parameter/key"
|
||||
|
|
Loading…
Reference in a new issue