diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 02eedd2..8e1e2cd 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -41,7 +41,7 @@ // "forwardPorts": [], "forwardPorts": [ 8000 - ] + ], // Uncomment the next line if you want start specific services in your Docker Compose config. // "runServices": [], @@ -50,7 +50,7 @@ // "shutdownAction": "none", // Uncomment the next line to run commands after the container is created. - // "postCreateCommand": "cat /etc/os-release", + "postCreateCommand": "cat /etc/os-release" // Configure tool-specific properties. // "customizations": {}, diff --git a/CHANGELOG b/CHANGELOG index 2b8aada..2c6161f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,2 +1,4 @@ # Initial creation 11/04/2023 - G -Basic files added. \ No newline at end of file +Basic files added. +# Fix 11/04/2023 - G +Grammar in readme \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 509f1f2..f382a99 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,5 @@ -FROM python:3.12-slim-bullseye +FROM python:3.12-slim-bullseye +# 3.12 is the latest version of Python as of 2021-10-20 # Passed from Github Actions ARG GIT_VERSION_TAG=unspecified @@ -23,21 +24,28 @@ RUN apt-get -yq install --no-install-recommends \ tcpdump traceroute iproute2 dnsutils whois mtr iftop iputils-ping wget nmap netcat-traditional \ procps \ htop \ - # Clean up - && apt-get autoremove -y \ - && apt-get clean -y \ - && rm -rf /var/lib/apt/lists/* + screen tmux \ + unzip zip \ + jq \ + build-essential \ + software-properties-common \ + tree \ + lsof \ + fish \ + && sh -c "curl -fsSL https://starship.rs/install.sh | bash -s -- --yes" \ + && apt-get clean -y \ + && rm -rf /var/lib/apt/lists/* # ensure that there is a place to mount the host files RUN mkdir /host -# Set tthe working directory for installations and login +# Set the working directory for installations and login WORKDIR /app # Copy in any/all additional files from our project ADD src/requirements.txt . -# Istall Python basic libraries +# Install Python basic libraries RUN python3 -m pip install --no-cache-dir -r requirements.txt # Setup a user to match the host and reduce the frustration/confusion of file ownership @@ -92,4 +100,4 @@ ADD --chown=1000:1000 --chmod=+x src/test_net.sh . ADD --chown=1000:1000 src/nodes.list . # Set default command -CMD ["/bin/zsh"] \ No newline at end of file +CMD ["/bin/zsh"] diff --git a/README.md b/README.md index 6a9ac2b..c395b2e 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ The purpose of this container image is to provide tools that can help diagnose i Additionally, this container image can easily used for: -- devlopment new container prototypes +- developing new container prototypes - debugging container builds and deployments - educational intents for container development/examples (i.e. workflows and devcontainers) @@ -77,6 +77,10 @@ Some possible tasks to add-to/replace the default options: Use the `portainer-compose.yml` file and modify to your hearts content. +## Fixed grammer + +Fixed grammar + ## Notes - https://ohmyz.sh/#install diff --git a/ansible/inventory.yml b/ansible/inventory.yml new file mode 100644 index 0000000..d0efe4b --- /dev/null +++ b/ansible/inventory.yml @@ -0,0 +1,10 @@ +myhosts: + hosts: + localhost: + ansible_host: localhost + server1: + ansible_host: server1 + server2: + ansible_host: server2 + server3: + ansible_host: nexus diff --git a/docker-compose.yml b/docker-compose.yml index 306c73e..dfed9d8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,22 +8,22 @@ services: dockerfile: Dockerfile image: ghcr.io/growlf/toolbox:latest environment: - - TESTVAR=${TESTVAR:-app} + - TESTVAR=${TESTVAR:/src} stdin_open: true tty: true command: ["/bin/zsh"] volumes: - - ${HOME}/.gitconfig:/home/ubuntu/.gitconfig - - ${HOME}/.ssh:/home/ubuntu/.ssh - - ${PWD}:/app - - /var/run/docker.sock:/var/run/docker.sock + - ${HOME}/.gitconfig:/home/ubuntu/.gitconfig + - ${HOME}/.ssh:/home/ubuntu/.ssh + - .:/src + - /var/run/docker.sock:/var/run/docker.sock network_mode: "host" # Example container with DooD and host file/net access app1: image: ghcr.io/growlf/toolbox:latest environment: - - TESTVAR=${TESTVAR:-app2} + - TESTVAR=${TESTVAR:/src} stdin_open: true tty: true command: ["/bin/zsh"] @@ -37,7 +37,7 @@ services: app2: image: ghcr.io/growlf/toolbox:latest environment: - - TESTVAR=${TESTVAR:-app2} + - TESTVAR=${TESTVAR:/src} stdin_open: true tty: true command: ["/bin/bash"] diff --git a/src/broker_preflight.sh b/src/broker_preflight.sh index dcc6d4c..5862e49 100755 --- a/src/broker_preflight.sh +++ b/src/broker_preflight.sh @@ -31,18 +31,22 @@ OFFLINE=${OFFLINE:=false} # Output CMDs ####################################### function _banner_msg () { - echo -e "\n$@" + echo -e "\n$(date "+%Y-%m-%d %H:%M:%S") - $@" } function _success_msg () { - echo -e "$@" + echo -e "$(date "+%Y-%m-%d %H:%M:%S") - $@" } function _failure_msg () { - echo -e "FAILURE: $@" + echo -e "$(date "+%Y-%m-%d %H:%M:%S") - FAILURE: $@" exit 1 } function _warning_msg () { - echo "WARNING: $@" + echo "$(date "+%Y-%m-%d %H:%M:%S") - WARNING: $@" } +function _done_msg () { + echo "DONE: $@" +} + ####################################### @@ -232,6 +236,7 @@ function do_arguments() { usage _failure_msg "Error: Unknown Command: ${args}" fi + _done_msg "All checks completed" exit 0 } ####################################### diff --git a/src/requirements.txt b/src/requirements.txt index 462dfd6..4f3b0df 100644 --- a/src/requirements.txt +++ b/src/requirements.txt @@ -6,3 +6,4 @@ portscan==1.1 pyfiglet==1.0.2 speedtest-cli==2.1.3 urllib3==2.1.0 +ansible==9.2.0 diff --git a/src/tasks.py b/src/tasks.py index b993590..88a6fea 100644 --- a/src/tasks.py +++ b/src/tasks.py @@ -89,11 +89,15 @@ def netspeed(c, verbose=0): # If you want to use a single threaded test # threads = 1 - s = speedtest.Speedtest() - s.get_servers(servers) - s.get_best_server() - s.download(threads=threads) - s.upload(threads=threads) + try: + s = speedtest.Speedtest() + s.get_servers(servers) + s.get_best_server() + s.download(threads=threads) + s.upload(threads=threads) + except Exception as e: + raise invoke.Exit("ERROR: Speedtest failed.", e) + results_dict = s.results.dict()