Skip to content

Commit cc0b10b

Browse files
committed
Script cleanup
1 parent 524affe commit cc0b10b

File tree

8 files changed

+14
-14
lines changed

8 files changed

+14
-14
lines changed

deploy-nimbus-nethermind.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
parser.add_argument("--el_p2p_port", type=int, help="Sets the Execution Client's P2P Port", default=EL_P2P_PORT)
106106
parser.add_argument("--el_rpc_port", type=int, help="Sets the Execution Client's RPC Port", default=EL_RPC_PORT)
107107
parser.add_argument("--el_max_peers", type=int, help="Sets the Execution Client's max peer count", default=EL_MAX_PEER_COUNT)
108-
parser.add_argument("--cl_p2p_port", type=int, help="Sets the Consensus Client's P2P Port", default=CL_P2P_PORT)
108+
parser.add_argument("--cl_p2p_port", type=int, help="Sets the Consensus Client's P2P Port", default=CL_P2P_PORT)
109109
parser.add_argument("--cl_rest_port", type=int, help="Sets the Consensus Client's REST Port", default=CL_REST_PORT)
110110
parser.add_argument("--cl_max_peers", type=int, help="Sets the Consensus Client's max peer count", default=CL_MAX_PEER_COUNT)
111111
parser.add_argument("-v", "--version", action="version", version="%(prog)s 1.0.0")
@@ -174,7 +174,7 @@ def is_valid_eth_address(address):
174174
answer=PromptUtils(Screen()).prompt_for_yes_or_no(f"Confirmation: Verify your settings\n\nNetwork: {eth_network.upper()}\nInstall Node Only (Not a validator): {NODE_ONLY}\n\nIs this correct?")
175175

176176
if not answer:
177-
file_name = os.path.basename(sys.argv[0])
177+
file_name = os.path.basename(sys.argv[0])
178178
print(f'\nInstall cancelled by user. \n\nWhen ready, re-run install command:\npython3 {file_name}')
179179
exit(0)
180180

ethpillar.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ while true; do
556556
\nWith the default install, basic alerts for CPU/DISK/RAM are configured.
557557
\nTo receive these alerts:
558558
\n- Navigate to Grafana in your web browser
559-
\n- Click "Alerting" (the alert bell icon) on the left-hand side menu
559+
\n- Click Alerting (the alert bell icon) on the left-hand side menu
560560
\n- Create contact points and notification policies" 20 78
561561
;;
562562
10)

functions.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ getNetworkConfig() {
3030

3131
exit_on_error() {
3232
exit_code=$1
33-
last_command=${@:2}
33+
last_command="${@:2}"
3434
if [ $exit_code -ne 0 ]; then
3535
>&2 echo "\"${last_command}\" command failed with exit code ${exit_code}."
3636
exit $exit_code
@@ -209,7 +209,7 @@ getPubKeys(){
209209
_teku+=(0x$(sudo -u validator bash -c "cat $json | jq -r '.pubkey'"))
210210
done
211211
# Convert to string
212-
TEMP=${_teku[@]}
212+
TEMP="${_teku[@]}"
213213
convertLIST
214214
;;
215215
Nimbus)
@@ -479,7 +479,7 @@ generateVoluntaryExitMessage(){
479479
# Prompt user for path to keystores
480480
read -r -p "Enter path to your keystore-m_##.json file(s): " KEYSTORE_PATH
481481
# Check number of keystores
482-
local COUNT=$(ls ${KEYSTORE_PATH}/keystore*.json | wc -l)
482+
local COUNT=$(ls "${KEYSTORE_PATH}"/keystore*.json | wc -l)
483483
if [[ $COUNT -gt 0 ]]; then
484484
echo "INFO: Found $COUNT keystore files"
485485
echo "INFO: Using keystore path: $KEYSTORE_PATH"
@@ -495,7 +495,7 @@ generateVoluntaryExitMessage(){
495495
echo "INFO: Using keystore passphrase: $KEYSTORE_PASSPHRASE"
496496

497497
# Iterate through each file and create the VEM
498-
for KEYSTORE in $(ls ${KEYSTORE_PATH}/keystore*.json);
498+
for KEYSTORE in "${KEYSTORE_PATH}"/keystore*.json;
499499
do
500500
ethdo validator exit --validator=${KEYSTORE} "--passphrase=${KEYSTORE_PASSPHRASE}" --json > $VEM_PATH/exit_tmp.json
501501
INDEX=$(cat $VEM_PATH/exit_tmp.json | jq -r .message.validator_index)
@@ -539,7 +539,7 @@ broadcastVoluntaryExitMessageLocally(){
539539
read -r -p "Enter path to your VEM file(s) (Press enter to use default: $VEM_PATH_DEFAULT):" VEM_PATH
540540
VEM_PATH=${VEM_PATH:-$VEM_PATH_DEFAULT}
541541
# Check number of keystores
542-
local COUNT=$(ls ${VEM_PATH}/exit*.json | wc -l)
542+
local COUNT=$(ls "${VEM_PATH}"/exit*.json | wc -l)
543543
if [[ $COUNT -gt 0 ]]; then
544544
echo "INFO: Found $COUNT VEM files"
545545
echo "INFO: Using VEM path: $VEM_PATH"
@@ -553,7 +553,7 @@ broadcastVoluntaryExitMessageLocally(){
553553
# Final confirmation
554554
if whiptail --title "Broadcast Voluntary Exit Messages" --defaultno --yesno "This will voluntary exit ${COUNT} validator(s).\nAre you sure you want to continue?" 9 78; then
555555
# Iterate through each file and broadcast the VEM
556-
for VEM in $(ls ${VEM_PATH}/exit*.json);
556+
for VEM in "${VEM_PATH}"/exit*.json;
557557
do
558558
ethdo --connection ${API_BN_ENDPOINT} validator exit --signed-operations ${VEM}
559559
INDEX=$(cat $VEM | jq -r .message.validator_index)

install-nimbus-nethermind.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ getc() {
3434

3535
exit_on_error() {
3636
exit_code=$1
37-
last_command=${@:2}
37+
last_command="${@:2}"
3838
if [ $exit_code -ne 0 ]; then
3939
>&2 echo "\"${last_command}\" command failed with exit code ${exit_code}."
4040
exit $exit_code

install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ getc() {
3131

3232
exit_on_error() {
3333
exit_code=$1
34-
last_command=${@:2}
34+
last_command="${@:2}"
3535
if [ $exit_code -ne 0 ]; then
3636
>&2 echo "\"${last_command}\" command failed with exit code ${exit_code}."
3737
exit $exit_code

patches/001-alerts.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,5 @@ whiptail --title "Configure Alerting with Grafana" --msgbox "Grafana enables use
4040
\nWith the default install, basic alerts for CPU/DISK/RAM are configured.
4141
\nTo receive these alerts:
4242
\n- Navigate to Grafana in your web browser
43-
\n- Click "Alerting" (the alert bell icon) on the left-hand side menu
43+
\n- Click Alerting (the alert bell icon) on the left-hand side menu
4444
\n- Create contact points and notification policies" 20 78

update_consensus.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ function updateClient(){
114114
;;
115115
Nimbus)
116116
RELEASE_URL="https://api.github.com/repos/status-im/nimbus-eth2/releases/latest"
117-
BINARIES_URL="$(curl -s $RELEASE_URL | jq -r ".assets[] | select(.name) | .browser_download_url" | grep _Linux_amd64.*.tar.gz$)"
117+
BINARIES_URL="$(curl -s $RELEASE_URL | jq -r ".assets[] | select(.name) | .browser_download_url" | grep "_Linux_amd64.*.tar.gz$")"
118118
echo Downloading URL: $BINARIES_URL
119119
cd $HOME
120120
wget -O nimbus.tar.gz $BINARIES_URL

view_logs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ fi
1515
current_user=$(whoami)
1616
group_members=$(getent group systemd-journal | cut -d: -f2-)
1717

18-
if ! echo "$current_user" | grep -qw "$current_user" <<<"$group_members"; then
18+
if ! echo "$group_members" | grep -qE -o -- "$current_user"; then
1919
clear
2020
# Add the user to the systemd-journal group if they're not already a member
2121
sudo usermod -aG systemd-journal $current_user

0 commit comments

Comments
 (0)