mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-06 17:22:49 +01:00
Added Changes Suggested by Reviewer
Added a missing semi colon between a local variable's declaration and assignment Removed an unused return value Made a TODO more descriptive
This commit is contained in:
@@ -107,9 +107,9 @@ populate_container_lists() {
|
|||||||
systemctl is-active --quiet docker
|
systemctl is-active --quiet docker
|
||||||
|
|
||||||
if [[ $? = 0 ]]; then
|
if [[ $? = 0 ]]; then
|
||||||
# TODO: why use curl when you can just run docker ps?
|
# TODO: look into using docker templates instead of curl and jq
|
||||||
# TODO: why use an indexed array when bash has associtive arrays?
|
# Ex docker ps --format "{{.Names}}\t{{.State}}"
|
||||||
# TODO: why use an array when you can just use a string?
|
# TODO: convert the output to an associtive array
|
||||||
mapfile -t docker_raw_list < <(curl -s --unix-socket /var/run/docker.sock http:/v1.40/containers/json?all=1 \
|
mapfile -t docker_raw_list < <(curl -s --unix-socket /var/run/docker.sock http:/v1.40/containers/json?all=1 \
|
||||||
| jq -c '.[] | { Name: .Names[0], State: .State }' \
|
| jq -c '.[] | { Name: .Names[0], State: .State }' \
|
||||||
| tr -d '/{"}')
|
| tr -d '/{"}')
|
||||||
@@ -255,9 +255,8 @@ main() {
|
|||||||
else
|
else
|
||||||
print_or_parse="print_line"
|
print_or_parse="print_line"
|
||||||
|
|
||||||
if (( __tty == 1 ))
|
if (( __tty == 1 )) ; then
|
||||||
then
|
local focus_color="" ; focus_color="$(tput setaf 3 bold)"
|
||||||
local focus_color="" focus_color="$(tput setaf 3 bold)"
|
|
||||||
local NC=""
|
local NC=""
|
||||||
NC="$(tput sgr0)" # no color
|
NC="$(tput sgr0)" # no color
|
||||||
fi
|
fi
|
||||||
@@ -298,7 +297,6 @@ is_tty() {
|
|||||||
# don't print colors if NO_COLOR is set to anything
|
# don't print colors if NO_COLOR is set to anything
|
||||||
[ "${#NO_COLOR}" -ne 0 ] \
|
[ "${#NO_COLOR}" -ne 0 ] \
|
||||||
&& __tty=0
|
&& __tty=0
|
||||||
return "${__tty}"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ! [ "$(id -u)" = 0 ]; then
|
if ! [ "$(id -u)" = 0 ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user