Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F11722287
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/salt-wrapper.sh b/salt-wrapper.sh
index 39536d6..6c384ab 100755
--- a/salt-wrapper.sh
+++ b/salt-wrapper.sh
@@ -1,53 +1,53 @@
#!/bin/sh
# -------------------------------------------------------------
# Salt wrapper
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Created: 2016-04-10
# License: BSD-2-Clause
# Usage: salt-wrapper salt-call --local state.highstate
# -------------------------------------------------------------
# -------------------------------------------------------------
# Helper functions
#
# :: contains
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# contains(string, substring)
#
# Returns 0 if the specified string contains the specified substring,
# otherwise returns 1.
# See: https://stackoverflow.com/a/8811800/1930997
contains() {
string="$1"
substring="$2"
if test "${string#*$substring}" != "$string"
then
return 0 # $substring is in $string
else
return 1 # $substring is not in $string
fi
}
# -------------------------------------------------------------
# Wrapper code
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CONFIG_DIR=$(salt-get-config-dir)
CODE=$?
if [ $CODE -ne 0 ]; then
- exit $CODE
+ exit $CODE
fi
EXECUTABLE=$1
shift
# The default user is salt, but if we need to target the Salt
# master without a minion running, we need to run as root.
SALT_USER=salt
if [ "$EXECUTABLE" = "salt-call" ]; then
- contains "$*" "--local" && SALT_USER=root
+ contains "$*" "--local" && SALT_USER=root
fi
sudo -u $SALT_USER "$EXECUTABLE" --config-dir="$CONFIG_DIR" "$@"
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Thu, Sep 18, 02:07 (1 d, 13 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2989772
Default Alt Text
(1 KB)
Attached To
Mode
rSW salt-wrapper
Attached
Detach File
Event Timeline
Log In to Comment