Skip to content

Commit 224f8a2

Browse files
committed
chore: Apply isort and shellcheck formatting
This commit contains auto-formatting changes: - isort formatting for Python files (profile=black, line_length=120) - shellcheck fixes for shell files (require-variable-braces) These files should not require detailed review.
1 parent c6adfa2 commit 224f8a2

File tree

112 files changed

+234
-755
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+234
-755
lines changed

docker/cluster-cleaner/scripts/clean-failed-namespaces.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ delete_resources_safely() {
77
resource_type="$1"
88
namespace="$2"
99

10-
echo "Attempting normal deletion of $resource_type in $namespace..."
10+
echo "Attempting normal deletion of ${resource_type} in ${namespace}..."
1111
kubectl delete "${resource_type}" --all -n "${namespace}" --wait=true --timeout=10s 2>error.log|| true
1212

1313
# Check if any resources are still stuck
1414
# Let's not fail here and continue deletion
15-
resources=$(kubectl get "$resource_type" -n "${namespace}" --no-headers -o custom-columns=":metadata.name" 2>error.log || true)
15+
resources=$(kubectl get "${resource_type}" -n "${namespace}" --no-headers -o custom-columns=":metadata.name" 2>error.log || true)
1616

1717
for resource in ${resources}; do
1818
echo "${resource_type}/${resource} is still present, force deleting..."
@@ -39,7 +39,7 @@ kubectl get namespace -l "${LABELS}" -o name
3939
for namespace in $(kubectl get namespace -l "${LABELS}" -o name 2>error.log); do
4040
creation_time=$(kubectl get "${namespace}" -o jsonpath='{.metadata.creationTimestamp}' 2>error.log || echo "")
4141

42-
if [ -z "$creation_time" ]; then
42+
if [ -z "${creation_time}" ]; then
4343
echo "Namespace ${namespace} does not exist or has no creation timestamp, skipping."
4444
continue
4545
fi

docker/delve-sidecar/attach-delve.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ while ! pgrep -f "mongodb-mms-automation-agent" > /dev/null; do
88
done
99

1010
APP_PID=$(pgrep -f "mongodb-mms-automation-agent")
11-
echo "Found app with PID: $APP_PID, attaching Delve..."
11+
echo "Found app with PID: ${APP_PID}, attaching Delve..."
1212

13-
dlv attach "$APP_PID" --headless --listen=:2345 --api-version=2 --accept-multiclient --continue
13+
dlv attach "${APP_PID}" --headless --listen=:2345 --api-version=2 --accept-multiclient --continue

docker/mongodb-agent/agent-launcher-shim.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ SCRIPTS_DIR="/opt/scripts"
99
# Function to start the agent launcher
1010
start_agent_launcher() {
1111
echo "Starting agent launcher..."
12-
echo "Final contents of $SCRIPTS_DIR:"
13-
ls -la "$SCRIPTS_DIR"
12+
echo "Final contents of ${SCRIPTS_DIR}:"
13+
ls -la "${SCRIPTS_DIR}"
1414

15-
if [[ -f "$SCRIPTS_DIR/agent-launcher.sh" ]]; then
15+
if [[ -f "${SCRIPTS_DIR}/agent-launcher.sh" ]]; then
1616
echo "Found agent-launcher.sh, executing..."
1717
echo "Note: agent-launcher.sh will become PID 1 and handle all signal processing including cleanup"
18-
exec "$SCRIPTS_DIR/agent-launcher.sh"
18+
exec "${SCRIPTS_DIR}/agent-launcher.sh"
1919
else
2020
echo "ERROR: agent-launcher.sh not found"
2121
exit 1

docker/mongodb-agent/dummy-probe.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,34 @@
44
find_init_container() {
55
local pid
66
pid=$(pgrep -f "agent-utilities-holder_marker" | head -n1)
7-
if [[ -n "$pid" && -d "/proc/$pid/root/probes" ]]; then
8-
echo "$pid"
7+
if [[ -n "${pid}" && -d "/proc/${pid}/root/probes" ]]; then
8+
echo "${pid}"
99
return 0
1010
fi
1111
return 1
1212
}
1313

1414
execute_liveness_probe() {
1515
local init_pid="$1"
16-
local init_probe_path="/proc/$init_pid/root/probes/probe.sh"
16+
local init_probe_path="/proc/${init_pid}/root/probes/probe.sh"
1717

18-
if [[ ! -f "$init_probe_path" ]]; then
19-
echo "ERROR: Liveness probe script not found at $init_probe_path"
18+
if [[ ! -f "${init_probe_path}" ]]; then
19+
echo "ERROR: Liveness probe script not found at ${init_probe_path}"
2020
exit 1
21-
elif [[ ! -x "$init_probe_path" ]]; then
22-
echo "ERROR: Liveness probe script not executable at $init_probe_path"
21+
elif [[ ! -x "${init_probe_path}" ]]; then
22+
echo "ERROR: Liveness probe script not executable at ${init_probe_path}"
2323
exit 1
2424
else
2525
# Execute the actual probe script from the init-database container
2626
# This works because of shared process namespace - the probe can see all processes
27-
exec "$init_probe_path"
27+
exec "${init_probe_path}"
2828
fi
2929
}
3030

3131
# Main execution
3232
if init_pid=$(find_init_container); then
33-
echo "Found init container with PID: $init_pid, executing liveness probe..."
34-
execute_liveness_probe "$init_pid"
33+
echo "Found init container with PID: ${init_pid}, executing liveness probe..."
34+
execute_liveness_probe "${init_pid}"
3535
else
3636
echo "WARNING: Init container not found, falling back to basic liveness check"
3737
# Fallback: if we can't find the init container, just check if this container is alive

docker/mongodb-agent/setup-agent-files.sh

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ SCRIPTS_DIR="/opt/scripts"
88
# readiness always returns failure
99
setup_dummy_probes() {
1010
echo "Setting up dummy probe scripts..."
11-
cp --remove-destination /usr/local/bin/dummy-probe.sh "$SCRIPTS_DIR/probe.sh"
12-
cp --remove-destination /usr/local/bin/dummy-readinessprobe "$SCRIPTS_DIR/readinessprobe"
11+
cp --remove-destination /usr/local/bin/dummy-probe.sh "${SCRIPTS_DIR}/probe.sh"
12+
cp --remove-destination /usr/local/bin/dummy-readinessprobe "${SCRIPTS_DIR}/readinessprobe"
1313
echo "Dummy probe scripts ready"
1414
}
1515

@@ -18,11 +18,11 @@ find_init_container() {
1818
for i in {1..150}; do
1919
local pid
2020
pid=$(pgrep -f "agent-utilities-holder_marker" | head -n1)
21-
if [[ -n "$pid" && -d "/proc/$pid/root/scripts" ]]; then
22-
echo "$pid"
21+
if [[ -n "${pid}" && -d "/proc/${pid}/root/scripts" ]]; then
22+
echo "${pid}"
2323
return 0
2424
fi
25-
echo "Waiting for init container... (attempt $i)" >&2
25+
echo "Waiting for init container... (attempt ${i})" >&2
2626
sleep 2
2727
done
2828
return 1
@@ -33,8 +33,8 @@ link_agent_scripts() {
3333

3434
echo "Linking agent launcher scripts..."
3535
for script in agent-launcher.sh agent-launcher-lib.sh; do
36-
ln -sf "$init_scripts_dir/$script" "$SCRIPTS_DIR/$script"
37-
echo "Linked $script"
36+
ln -sf "${init_scripts_dir}/${script}" "${SCRIPTS_DIR}/${script}"
37+
echo "Linked ${script}"
3838
done
3939
}
4040

@@ -44,26 +44,26 @@ main() {
4444
setup_dummy_probes
4545

4646
if init_pid=$(find_init_container); then
47-
echo "Found init container with PID: $init_pid"
47+
echo "Found init container with PID: ${init_pid}"
4848

49-
init_root="/proc/$init_pid/root"
50-
init_scripts="$init_root/scripts"
51-
init_probes="$init_root/probes"
49+
init_root="/proc/${init_pid}/root"
50+
init_scripts="${init_root}/scripts"
51+
init_probes="${init_root}/probes"
5252

5353
# Verify scripts directory exists
54-
if [[ ! -d "$init_scripts" ]]; then
55-
echo "ERROR: Scripts directory $init_scripts not found"
54+
if [[ ! -d "${init_scripts}" ]]; then
55+
echo "ERROR: Scripts directory ${init_scripts} not found"
5656
exit 1
5757
fi
5858

5959
# Verify probes directory exists
60-
if [[ ! -d "$init_probes" ]]; then
61-
echo "ERROR: Probes directory $init_probes not found"
60+
if [[ ! -d "${init_probes}" ]]; then
61+
echo "ERROR: Probes directory ${init_probes} not found"
6262
exit 1
6363
fi
6464

6565
# Link scripts from init container
66-
link_agent_scripts "$init_scripts"
66+
link_agent_scripts "${init_scripts}"
6767

6868
echo "File setup completed successfully"
6969
exit 0

docker/mongodb-kubernetes-init-database/content/probe.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -Eeou pipefail
44
check_process() {
55
local check_process=$1
66
# shellcheck disable=SC2009
7-
ps -ax | grep -v " grep " | grep -v jq | grep -v tail | grep "$check_process"
7+
ps -ax | grep -v " grep " | grep -v jq | grep -v tail | grep "${check_process}"
88
return $?
99
}
1010

docker/mongodb-kubernetes-tests/kubetester/__init__.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@
1111

1212
# Re-exports
1313
from .kubetester import fixture as find_fixture
14-
from .security_context import (
15-
assert_pod_container_security_context,
16-
assert_pod_security_context,
17-
)
14+
from .security_context import assert_pod_container_security_context, assert_pod_security_context
1815

1916

2017
def create_secret(

docker/mongodb-kubernetes-tests/kubetester/certs.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,12 @@
1313
from kubeobject import CustomObject
1414
from kubernetes import client
1515
from kubernetes.client.rest import ApiException
16-
from kubetester import (
17-
create_secret,
18-
delete_secret,
19-
kubetester,
20-
random_k8s_name,
21-
read_secret,
22-
)
16+
from kubetester import create_secret, delete_secret, kubetester, random_k8s_name, read_secret
2317
from kubetester.kubetester import KubernetesTester
2418
from kubetester.phase import Phase
2519
from opentelemetry import trace
2620
from tests import test_logger
27-
from tests.vaultintegration import (
28-
store_secret_in_vault,
29-
vault_namespace_name,
30-
vault_sts_name,
31-
)
21+
from tests.vaultintegration import store_secret_in_vault, vault_namespace_name, vault_sts_name
3222

3323
TRACER = trace.get_tracer("evergreen-agent")
3424
logger = test_logger.get_test_logger(__name__)

docker/mongodb-kubernetes-tests/kubetester/mongodb.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,7 @@
2323

2424
from .mongodb_common import MongoDBCommon
2525
from .mongodb_utils_state import in_desired_state
26-
from .mongotester import (
27-
MongoTester,
28-
ReplicaSetTester,
29-
ShardedClusterTester,
30-
StandaloneTester,
31-
)
26+
from .mongotester import MongoTester, ReplicaSetTester, ShardedClusterTester, StandaloneTester
3227
from .opsmanager import MongoDBOpsManager
3328
from .phase import Phase
3429

docker/mongodb-kubernetes-tests/kubetester/omtester.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,7 @@
1515
import requests
1616
import semver
1717
from kubetester.automation_config_tester import AutomationConfigTester
18-
from kubetester.kubetester import (
19-
KubernetesTester,
20-
build_agent_auth,
21-
build_auth,
22-
run_periodically,
23-
)
18+
from kubetester.kubetester import KubernetesTester, build_agent_auth, build_auth, run_periodically
2419
from kubetester.mongotester import BackgroundHealthChecker
2520
from kubetester.om_queryable_backups import OMQueryableBackup
2621
from opentelemetry import trace

0 commit comments

Comments
 (0)