#!/bin/sh

set -e

echo "Checking that the puppet agent is disabled by default, and that we can enable it"

if [ -e /var/lib/puppet/state/agent_disabled.lock ]; then
  echo "ok: lock file exists"
else
  echo "not ok: lock file does not exist"
  exit 1
fi

puppet agent --enable

if [ ! -e /var/lib/puppet/state/agent_disabled.lock ]; then
  echo "ok: lock file has been removed"
else
  echo "not ok: lock file was not removed"
  exit 1
fi
