Skip to content

Commit 583109d

Browse files
authored
Remove the unnecessary cat commands, the logic remains unchanged (#421)
1 parent d17ecbe commit 583109d

12 files changed

+22
-48
lines changed

scripts/delete-network-policies.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ oc delete --filename ./test-target/egress-deny-all-np.yaml --namespace "$TNF_EXA
1010

1111
# Render the script with vars
1212
mkdir -p ./temp
13-
14-
# shellcheck disable=SC2002 # Useless cat.
15-
cat ./test-target/pod-to-pod-np.yaml | TNF_EXAMPLE_CNF_NAMESPACE=$TNF_EXAMPLE_CNF_NAMESPACE "$SCRIPT_DIR"/mo >./temp/rendered-pod-to-pod-np.yaml
13+
TNF_EXAMPLE_CNF_NAMESPACE=$TNF_EXAMPLE_CNF_NAMESPACE "$SCRIPT_DIR"/mo ./test-target/pod-to-pod-np.yaml >./temp/rendered-pod-to-pod-np.yaml
1614
oc delete --filename ./temp/rendered-pod-to-pod-np.yaml --namespace "$TNF_EXAMPLE_CNF_NAMESPACE" --ignore-not-found
1715
oc delete --filename ./temp/rendered-pod-to-pod-np.yaml --namespace default --ignore-not-found
1816
rm ./temp/rendered-pod-to-pod-np.yaml

scripts/delete-pod-disruption-budget.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ source "$SCRIPT_DIR"/init-env.sh
88

99
# Delete test PDB
1010
mkdir -p ./temp
11-
12-
# shellcheck disable=SC2002 # Useless cat.
13-
cat ./test-target/pod-disruption-budget.yaml | APP_1="testdp" APP_2="testss" "$SCRIPT_DIR"/mo >./temp/rendered-pod-disruption-budget-template.yaml
11+
APP_1="testdp" APP_2="testss" "$SCRIPT_DIR"/mo ./test-target/pod-disruption-budget.yaml >./temp/rendered-pod-disruption-budget-template.yaml
1412
oc delete --filename ./temp/rendered-pod-disruption-budget-template.yaml --namespace "$TNF_EXAMPLE_CNF_NAMESPACE" --ignore-not-found=true
1513
rm ./temp/rendered-pod-disruption-budget-template.yaml

scripts/delete-storage.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ source "$SCRIPT_DIR"/init-env.sh
88

99
mkdir -p ./temp
1010

11-
# shellcheck disable=SC2002 # Useless cat.
12-
cat ./test-target/storage.yaml | "$SCRIPT_DIR"/mo >./temp/rendered-test-storage.yaml
11+
"$SCRIPT_DIR"/mo ./test-target/storage.yaml >./temp/rendered-test-storage.yaml
1312
oc delete --filename ./temp/rendered-test-storage.yaml -n "$TNF_EXAMPLE_CNF_NAMESPACE" --ignore-not-found=true
1413
rm ./temp/rendered-test-storage.yaml

scripts/deploy-community-operator.sh

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,24 +45,19 @@ fi
4545

4646
# Create the operator group
4747
mkdir -p ./temp
48-
49-
# shellcheck disable=SC2002 # Useless cat.
50-
cat ./test-target/community-operator-group.yaml | TNF_EXAMPLE_CNF_NAMESPACE=$TNF_EXAMPLE_CNF_NAMESPACE "$SCRIPT_DIR"/mo >./temp/rendered-local-community-operator-group.yaml
48+
TNF_EXAMPLE_CNF_NAMESPACE=$TNF_EXAMPLE_CNF_NAMESPACE "$SCRIPT_DIR"/mo ./test-target/community-operator-group.yaml >./temp/rendered-local-community-operator-group.yaml
5149
oc apply --filename ./temp/rendered-local-community-operator-group.yaml
5250
cat ./temp/rendered-local-community-operator-group.yaml
5351
rm ./temp/rendered-local-community-operator-group.yaml
5452

5553
# Create the Subscription
5654
mkdir -p ./temp
57-
58-
# shellcheck disable=SC2002 # Useless cat.
59-
cat ./test-target/community-operator-subscription.yaml |
60-
OPERATOR_BASE=$COMMUNITY_OPERATOR_BASE \
61-
OPERATOR_NAME=$COMMUNITY_OPERATOR_NAME \
62-
CATALOG_SOURCE=$CATALOG_SOURCE \
63-
CATALOG_NAMESPACE=$CATALOG_NAMESPACE \
64-
TNF_EXAMPLE_CNF_NAMESPACE=$TNF_EXAMPLE_CNF_NAMESPACE \
65-
"$SCRIPT_DIR"/mo >./temp/rendered-local-community-operator-subscription.yaml
55+
OPERATOR_BASE=$COMMUNITY_OPERATOR_BASE \
56+
OPERATOR_NAME=$COMMUNITY_OPERATOR_NAME \
57+
CATALOG_SOURCE=$CATALOG_SOURCE \
58+
CATALOG_NAMESPACE=$CATALOG_NAMESPACE \
59+
TNF_EXAMPLE_CNF_NAMESPACE=$TNF_EXAMPLE_CNF_NAMESPACE \
60+
"$SCRIPT_DIR"/mo ./test-target/community-operator-subscription.yaml >./temp/rendered-local-community-operator-subscription.yaml
6661
oc apply --filename ./temp/rendered-local-community-operator-subscription.yaml
6762
cat ./temp/rendered-local-community-operator-subscription.yaml
6863
rm ./temp/rendered-local-community-operator-subscription.yaml

scripts/deploy-cpu-scheduling-test-pods.sh

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,8 @@ SCRIPT_DIR=$(dirname "$0")
66
# shellcheck disable=SC1091 # Not following.
77
source "$SCRIPT_DIR"/init-env.sh
88
mkdir -p ./temp
9-
10-
# shellcheck disable=SC2002 # Useless cat.
11-
cat ./test-target/cpu-exclusive-pool-rt-sched-policy-pod.yaml | "$SCRIPT_DIR"/mo >./temp/rendered-cpu-exclusive-pool-rt-sched-policy-pod.yaml
12-
13-
# shellcheck disable=SC2002 # Useless cat.
14-
cat ./test-target/cpu-shared-pool-non-rt-sched-policy-pod.yaml | "$SCRIPT_DIR"/mo >./temp/rendered-cpu-shared-pool-non-rt-sched-policy-pod.yaml
9+
"$SCRIPT_DIR"/mo ./test-target/cpu-exclusive-pool-rt-sched-policy-pod.yaml >./temp/rendered-cpu-exclusive-pool-rt-sched-policy-pod.yaml
10+
"$SCRIPT_DIR"/mo ./test-target/cpu-shared-pool-non-rt-sched-policy-pod.yaml >./temp/rendered-cpu-shared-pool-non-rt-sched-policy-pod.yaml
1511
oc apply --filename ./temp/rendered-cpu-exclusive-pool-rt-sched-policy-pod.yaml
1612
oc apply --filename ./temp/rendered-cpu-shared-pool-non-rt-sched-policy-pod.yaml
1713
rm ./temp/rendered-cpu-exclusive-pool-rt-sched-policy-pod.yaml

scripts/deploy-multus-network.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ if $TNF_NON_OCP_CLUSTER; then
4949
# Creates the network attachment with ptp plugin on partner namespace
5050
mkdir -p ./temp
5151

52-
# shellcheck disable=SC2002,SC2001 # Useless cat, echo.
53-
cat ./config/k8s-cluster/multus.yaml | IP_NUM=$(echo "$2" | sed 's/NUM/'"${NUM}"'/g') NET_NAME_NUM="$NET_NAME-$1-$NUM" "$SCRIPT_DIR"/mo >./temp/rendered-multus.yaml
52+
# shellcheck disable=SC2001 # Useless echo.
53+
IP_NUM=$(echo "$2" | sed 's/NUM/'"${NUM}"'/g') NET_NAME_NUM="$NET_NAME-$1-$NUM" "$SCRIPT_DIR"/mo ./config/k8s-cluster/multus.yaml >./temp/rendered-multus.yaml
5454
oc apply --filename ./temp/rendered-multus.yaml
5555
rm ./temp/rendered-multus.yaml
5656
done

scripts/deploy-network-policies.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ oc apply --filename ./test-target/egress-deny-all-np.yaml --namespace "$TNF_EXAM
1515

1616
# Render the script with vars
1717
mkdir -p ./temp
18-
19-
# shellcheck disable=SC2002 # Useless cat.
20-
cat ./test-target/pod-to-pod-np.yaml | TNF_EXAMPLE_CNF_NAMESPACE=$TNF_EXAMPLE_CNF_NAMESPACE "$SCRIPT_DIR"/mo >./temp/rendered-pod-to-pod-np.yaml
18+
TNF_EXAMPLE_CNF_NAMESPACE=$TNF_EXAMPLE_CNF_NAMESPACE "$SCRIPT_DIR"/mo ./test-target/pod-to-pod-np.yaml >./temp/rendered-pod-to-pod-np.yaml
2119

2220
# Apply policies to allow pod-to-pod communication (aka make the ping test work)
2321
oc apply --filename ./temp/rendered-pod-to-pod-np.yaml --namespace "$TNF_EXAMPLE_CNF_NAMESPACE"

scripts/deploy-pod-disruption-budget.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ SCRIPT_DIR=$(dirname "$0")
77
source "$SCRIPT_DIR"/init-env.sh
88
mkdir -p ./temp
99

10-
# shellcheck disable=SC2002 # Useless cat.
11-
cat ./test-target/pod-disruption-budget.yaml | APP_1="testdp" APP_2="testss" "$SCRIPT_DIR"/mo >./temp/rendered-pod-disruption-budget-template.yaml
10+
APP_1="testdp" APP_2="testss" "$SCRIPT_DIR"/mo ./test-target/pod-disruption-budget.yaml >./temp/rendered-pod-disruption-budget-template.yaml
1211
oc apply --filename ./temp/rendered-pod-disruption-budget-template.yaml --namespace "$TNF_EXAMPLE_CNF_NAMESPACE"
1312
rm ./temp/rendered-pod-disruption-budget-template.yaml

scripts/deploy-statefulset-test-pods.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ NUM_NODES="${NUM_NODES%"${NUM_NODES##*[![:space:]]}"}"
1515
if [[ $NUM_NODES == 1 ]]; then
1616
REPLICAS=1
1717
fi
18-
19-
# shellcheck disable=SC2002 # Useless cat.
20-
cat ./test-target/local-pod-under-test.yaml | APP="testss" RESOURCE_TYPE="StatefulSet" MULTUS_ANNOTATION=$MULTUS_ANNOTATION REPLICAS=$REPLICAS "$SCRIPT_DIR"/mo >./temp/rendered-local-statefulset-pod-under-test-template.yaml
18+
APP="testss" RESOURCE_TYPE="StatefulSet" MULTUS_ANNOTATION=$MULTUS_ANNOTATION REPLICAS=$REPLICAS "$SCRIPT_DIR"/mo ./test-target/local-pod-under-test.yaml >./temp/rendered-local-statefulset-pod-under-test-template.yaml
2119
oc apply --filename ./temp/rendered-local-statefulset-pod-under-test-template.yaml
2220
rm ./temp/rendered-local-statefulset-pod-under-test-template.yaml
2321
sleep 3

scripts/deploy-storage.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ source "$SCRIPT_DIR"/init-env.sh
88

99
mkdir -p ./temp
1010

11-
# shellcheck disable=SC2002 # Useless cat.
12-
cat ./test-target/storage.yaml | "$SCRIPT_DIR"/mo >./temp/rendered-test-storage.yaml
11+
"$SCRIPT_DIR"/mo ./test-target/storage.yaml >./temp/rendered-test-storage.yaml
1312
oc apply --filename ./temp/rendered-test-storage.yaml --namespace "$TNF_EXAMPLE_CNF_NAMESPACE"
1413
rm ./temp/rendered-test-storage.yaml

0 commit comments

Comments
 (0)