#!/bin/sh
# @description force rudder-agent to run in audit mode
# @man This is useful when you want to ensure that the agent check compliance only,
# @man and won't be doing any modification to your system. If agent is run in non
# @man audit, it will be automatically stopped.
# @man +
# @man *Options*:
# @man +
# @man *-q*: run the command in quiet mode (display only error messages)
# @man +
# @man *-c*: run the command without color output

. "${BASEDIR}/../lib/common.sh"

QUIET=false

while getopts "qc" opt; do
  case $opt in
    q)
      QUIET=true
      ;;
    c)
      clear_colors
      ;;
  esac
done

touch ${RUDDER_DIR}/etc/force-audit-agent

if [ $? -ne 0 ]; then
  printf "${RED}error${NORMAL}: Rudder agent could not be be forced in audit mode.\n"
  exit 1
fi

if [ "$QUIET" = false ]; then
  printf "${GREEN}ok${NORMAL}: Rudder agent is now enforced in audit mode.\n"
fi

