Skip to content

Commit

Permalink
Removes the errexit shell option from generate_network_config.sh (#276)
Browse files Browse the repository at this point in the history
* Removes the bash -e shopt to avoid script exiting on error

The script runs a loop that checks for a files that may not exist. With -e set,
if it tries to list the files and they don't exist then the script exits. This
commit simply removes the -e shell option. There is likely some other
workaround, but this is pretty simple.

* Changes fq qdisc config script to look for carrier file

The file /sys/class/net/ethN/carrier is what the generate-network-config script
uses, and is probably more appropriate to the intention, and it was just an
oversight that this file didn't previously get changed too.
  • Loading branch information
nkinkade authored Oct 30, 2024
1 parent 66d46c8 commit ead392a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions configs/stage3_ubuntu/opt/mlab/bin/configure_tc_fq.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

set -ux

# This script writes out a Prometheus metric file which will be collected by the
# node_exporter textfile collector. Make sure that METRIC_DIR exists.
METRIC_DIR=/cache/data/node-exporter
Expand All @@ -23,8 +25,8 @@ function write_metric_file {
# with a link. Set the default to eth0 as a fallback.
DEVICE="eth0"
for i in /sys/class/net/eth*; do
STATE=$(cat $i/operstate)
if [[ $STATE == "up" ]]; then
CARRIER=$(cat $i/carrier)
if [[ $CARRIER == "1" ]]; then
DEVICE=$(basename $i)
break
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# writes a networkd configuration file for the static IP to the named file.
# generate_network_config also sets the machine hostname.

set -euxo pipefail
set -ux

OUTPUT=${1:?Please provide the name for writing config file}

Expand Down

0 comments on commit ead392a

Please sign in to comment.