diff options
author | Patrick Spek <p.spek@tyil.nl> | 2022-04-17 22:56:59 +0200 |
---|---|---|
committer | Patrick Spek <p.spek@tyil.nl> | 2022-04-17 22:56:59 +0200 |
commit | fba67928920f3b1e6d10123de9a7efae0dac177f (patch) | |
tree | 1b94866fde92c24c660f181fd1631f380595b349 /lib/subcommands | |
parent | fa150b95d3d9d9b3ea51a03e9243d2b4b2a6c761 (diff) |
Make shellcheck happy
Diffstat (limited to 'lib/subcommands')
-rw-r--r-- | lib/subcommands/add.bash | 5 | ||||
-rw-r--r-- | lib/subcommands/bootstrap.bash | 4 | ||||
-rw-r--r-- | lib/subcommands/del.bash | 5 | ||||
-rw-r--r-- | lib/subcommands/ssh.bash | 5 | ||||
-rw-r--r-- | lib/subcommands/sync.bash | 8 |
5 files changed, 18 insertions, 9 deletions
diff --git a/lib/subcommands/add.bash b/lib/subcommands/add.bash index 590c8ec..c72582b 100644 --- a/lib/subcommands/add.bash +++ b/lib/subcommands/add.bash @@ -6,6 +6,8 @@ subcommand() { + local buffer + export BASHTARD_PLAYBOOK="$1" ; shift if [[ -z "$BASHTARD_PLAYBOOK" ]] @@ -38,6 +40,7 @@ subcommand() return 1 fi + # shellcheck disable=SC1090 . "$playbook_base/playbook.bash" if ! playbook_add @@ -46,7 +49,7 @@ subcommand() return 1 fi - local buffer="$(tmpfile)" + buffer="$(tmpfile)" # Add the playbook to the registry cp -- "$playbook_registry" "$buffer" diff --git a/lib/subcommands/bootstrap.bash b/lib/subcommands/bootstrap.bash index 343547d..a457a2f 100644 --- a/lib/subcommands/bootstrap.bash +++ b/lib/subcommands/bootstrap.bash @@ -15,7 +15,7 @@ subcommand() return fi - bootstrap_remote + bootstrap_remote "$@" } bootstrap_local() @@ -69,7 +69,7 @@ bootstrap_remote() touch -- "$file" done - while read -r playbook url branch + while read -r playbook url _ do notice "bashtard/bootstrap" "Cloning $playbook from $url" git clone "$url" "$BASHTARD_ETCDIR/playbooks.d/$playbook" diff --git a/lib/subcommands/del.bash b/lib/subcommands/del.bash index 9f01c3c..f5204d8 100644 --- a/lib/subcommands/del.bash +++ b/lib/subcommands/del.bash @@ -6,6 +6,8 @@ subcommand() { + local buffer + export BASHTARD_PLAYBOOK="$1" ; shift if [[ -z "$BASHTARD_PLAYBOOK" ]] @@ -38,6 +40,7 @@ subcommand() return 1 fi + # shellcheck disable=SC1090 . "$playbook_base/playbook.bash" if ! playbook_del @@ -46,7 +49,7 @@ subcommand() return 1 fi - local buffer="$(tmpfile)" + buffer="$(tmpfile)" # Remove the playbook from the registry cp -- "$playbook_registry" "$buffer" diff --git a/lib/subcommands/ssh.bash b/lib/subcommands/ssh.bash index 0eb4be8..b5712cc 100644 --- a/lib/subcommands/ssh.bash +++ b/lib/subcommands/ssh.bash @@ -6,7 +6,9 @@ subcommand() { - local ssh="$(config app.ssh)" + local ssh + + ssh="$(config "app.ssh")" if [[ ! -d "$BASHTARD_ETCDIR/hosts.d" ]] then @@ -20,7 +22,6 @@ subcommand() do local user local host - local ip user="$(config_for "$node" "ssh.user" "root")" diff --git a/lib/subcommands/sync.bash b/lib/subcommands/sync.bash index 7722e2d..0ec2ffc 100644 --- a/lib/subcommands/sync.bash +++ b/lib/subcommands/sync.bash @@ -9,7 +9,7 @@ subcommand() export BASHTARD_PLAYBOOK="$1" ; shift # If a specific playbook is given, sync that - if [[ ! -z "$BASHTARD_PLAYBOOK" ]] + if [[ -n "$BASHTARD_PLAYBOOK" ]] then sync_playbook "$BASHTARD_PLAYBOOK" return @@ -19,9 +19,10 @@ subcommand() notice "bashtard/sync" "Syncing remote playbooks" # Update all playbook sources - while read -r playbook url branch + while read -r playbook _ branch do - pushd -- "$BASHTARD_ETCDIR/playbooks.d/$playbook" + pushd -- "$BASHTARD_ETCDIR/playbooks.d/$playbook" \ + || return 2 git pull origin "$branch" done < "$BASHTARD_ETCDIR/playbooks.d/remotes" @@ -51,6 +52,7 @@ sync_playbook() return 1 fi + # shellcheck disable=SC1090 . "$playbook_base/playbook.bash" playbook_sync |