#!/bin/sh
# @description allow agent to run in enforce mode (default)
# @man Cancel the change made by rudder agent set-force-audit.
# @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

rm -f ${RUDDER_DIR}/etc/force-audit-agent

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

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