From 07b5f1d23e2907f490e64dc341f9a4465e69eebb Mon Sep 17 00:00:00 2001 From: Jason Ertel Date: Fri, 15 Jan 2021 08:55:30 -0500 Subject: [PATCH] Rename functions to avoid naming conflict with setup vars --- salt/common/tools/sbin/so-common | 6 +++--- salt/common/tools/sbin/so-tcpreplay | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/salt/common/tools/sbin/so-common b/salt/common/tools/sbin/so-common index 427721a49..4b722f57e 100755 --- a/salt/common/tools/sbin/so-common +++ b/salt/common/tools/sbin/so-common @@ -157,7 +157,7 @@ set_version() { } require_manager() { - if is_manager; then + if is_manager_node; then echo "This is a manager, We can proceed." else echo "Please run this command on the manager; the manager controls the grid." @@ -165,7 +165,7 @@ require_manager() { fi } -is_manager() { +is_manager_node() { # Check to see if this is a manager node role=$(lookup_role) is_single_node_grid && return 0 @@ -175,7 +175,7 @@ is_manager() { return 1 } -is_sensor() { +is_sensor_node() { # Check to see if this is a sensor (forward) node role=$(lookup_role) is_single_node_grid && return 0 diff --git a/salt/common/tools/sbin/so-tcpreplay b/salt/common/tools/sbin/so-tcpreplay index e8e24a474..22722ac9b 100755 --- a/salt/common/tools/sbin/so-tcpreplay +++ b/salt/common/tools/sbin/so-tcpreplay @@ -47,25 +47,25 @@ if ! docker ps | grep -q so-tcpreplay; then echo "Replay functionality not enabled; attempting to enable now (may require Internet access)..." echo - if is_manager; then + if is_manager_node; then TRUSTED_CONTAINERS=("so-tcpreplay") mkdir -p /opt/so/log/tcpreplay update_docker_containers "tcpreplay" "" "" "/opt/so/log/tcpreplay/init.log" fi - if is_sensor; then - if ! is_manager; then + if is_sensor_node; then + if ! is_manager_node; then echo "Attempting to start replay container. If this fails then you may need to run this command on the manager first." fi so-tcpreplay-start || fail "Unable to initialize tcpreplay" fi fi -if is_sensor; then +if is_sensor_node; then echo "Replaying PCAP(s) at ${REPLAYSPEED} Mbps on interface ${REPLAYIFACE}..." docker exec so-tcpreplay /usr/bin/bash -c "/usr/local/bin/tcpreplay -i ${REPLAYIFACE} -M${REPLAYSPEED} $@" echo "Replay completed. Warnings shown above are typically expected." -elif is_manager; then +elif is_manager_node; then echo "The sensor nodes in this grid can now replay traffic." else echo "Unable to replay traffic since this node is not a sensor node."