Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions lib/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,9 @@ get_meta() {
local key=$1
local max_tries=${2:-10}
declare -i attempts=0
[ -v EC2_IF_INITIAL_SETUP ] && debug "[get_meta] Querying IMDS for ${key}"
if [ -v EC2_IF_INITIAL_SETUP ]; then
debug "[get_meta] Querying IMDS for ${key}"
fi

if [[ -z $imds_endpoint || -z $imds_token || -z $imds_interface ]]; then
error "[get_meta] Unable to obtain IMDS token, endpoint, or interface"
Expand Down Expand Up @@ -617,7 +619,9 @@ maybe_reload_networkd() {
networkctl reload
debug "Reloaded networkd"
else
[ -v EC2_IF_INITIAL_SETUP ] && debug "No networkd reload needed"
if [ -v EC2_IF_INITIAL_SETUP ]; then
debug "No networkd reload needed"
fi
fi
else
debug "Deferring networkd reload to another process"
Expand All @@ -638,7 +642,7 @@ register_networkd_reloader() {
while [ $cnt -lt $max ]; do
cnt+=1
mkdir -p "$lockdir"
trap '[ -v EC2_IF_INITIAL_SETUP ] && debug "Called trap" ; maybe_reload_networkd' EXIT
trap 'if [ -v EC2_IF_INITIAL_SETUP ]; then debug "Called trap"; fi; maybe_reload_networkd' EXIT
# If the redirect fails, most likely because the target file
# already exists and -o noclobber is in effect, $? will be set
# nonzero. If it succeeds, it is set to 0
Expand Down