aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/subcommands/add.bash6
-rw-r--r--lib/subcommands/del.bash6
-rw-r--r--lib/subcommands/sync.bash4
-rw-r--r--lib/util.bash7
4 files changed, 15 insertions, 8 deletions
diff --git a/lib/subcommands/add.bash b/lib/subcommands/add.bash
index 644c04f..db3ec40 100644
--- a/lib/subcommands/add.bash
+++ b/lib/subcommands/add.bash
@@ -8,6 +8,8 @@ subcommand()
{
local buffer
local missing_vars=0
+ local playbook_base
+ local playbook_registry
export BASHTARD_PLAYBOOK="$1" ; shift
@@ -17,8 +19,8 @@ subcommand()
return 2
fi
- local playbook_base="$(playbook_path "base")"
- local playbook_registry="$BASHTARD_ETCDIR/registry.d/${BASHTARD_PLATFORM[fqdn]}"
+ playbook_base="$(playbook_path "base")"
+ playbook_registry="$BASHTARD_ETCDIR/registry.d/${BASHTARD_PLATFORM[fqdn]}"
# Make sure we only run add if the playbook is not in the registry yet
if grep -Fqx "$BASHTARD_PLAYBOOK" "$playbook_registry"
diff --git a/lib/subcommands/del.bash b/lib/subcommands/del.bash
index 38d675c..ec2ec80 100644
--- a/lib/subcommands/del.bash
+++ b/lib/subcommands/del.bash
@@ -7,6 +7,8 @@
subcommand()
{
local buffer
+ local playbook_base
+ local playbook_registry
export BASHTARD_PLAYBOOK="$1" ; shift
@@ -16,8 +18,8 @@ subcommand()
return
fi
- local playbook_base="$(playbook_path "base")"
- local playbook_registry="$BASHTARD_ETCDIR/registry.d/${BASHTARD_PLATFORM[fqdn]}"
+ playbook_base="$(playbook_path "base")"
+ playbook_registry="$BASHTARD_ETCDIR/registry.d/${BASHTARD_PLATFORM[fqdn]}"
# Make sure we only run add if the playbook is not in the registry yet
if ! grep -Fqx "$BASHTARD_PLAYBOOK" "$playbook_registry"
diff --git a/lib/subcommands/sync.bash b/lib/subcommands/sync.bash
index 6bda162..8d437f6 100644
--- a/lib/subcommands/sync.bash
+++ b/lib/subcommands/sync.bash
@@ -28,9 +28,11 @@ subcommand()
sync_playbook()
{
- local playbook_base="$(playbook_path "base")"
+ local playbook_base
local missing_vars=0
+ playbook_base="$(playbook_path "base")"
+
notice "bashtard/sync" "Running sync for $BASHTARD_PLAYBOOK"
if [[ ! -d "$playbook_base" ]]
diff --git a/lib/util.bash b/lib/util.bash
index 489ccf1..54ec562 100644
--- a/lib/util.bash
+++ b/lib/util.bash
@@ -112,9 +112,10 @@ fetch_http_wget() {
# template, they are expected to be written as ${key}.
file_template()
{
- local file="$(playbook_path "base")/share/$1" ; shift
+ local file
local sedfile
+ file="$(playbook_path "base")/share/$1" ; shift
sedfile="$(tmpfile)"
if [[ ! -f $file ]]
@@ -192,8 +193,8 @@ playbook_path() {
fi
case "$1" in
- base) printf "$BASHTARD_ETCDIR/playbooks.d/$BASHTARD_PLAYBOOK" ;;
- data) printf "$BASHTARD_ETCDIR/data.d/$BASHTARD_PLAYBOOK" ;;
+ base) printf "%s/playbooks.d/%s" "$BASHTARD_ETCDIR" "$BASHTARD_PLAYBOOK" ;;
+ data) printf "%s/data.d/%s" "$BASHTARD_ETCDIR" "$BASHTARD_PLAYBOOK" ;;
*)
crit "bashtard/playbook_path" "Invalid path '$1'"
return 1