2

I'm starting puppet agent using upstart on a Debian 14.04 embedded system:

description "Puppet Agent"

start on started 2klic-gateway
stop on runlevel [!2345]

respawn

pre-start script
    if [ ! -f /var/lib/sc2klic/system.json ]; then
        stop ; exit 0
    fi
    puppet config set certname "$(hostname)"
end script

exec /usr/local/bin/puppet agent --no-daemonize

The device, or at least this version, doesn't have a hardware clock. So the system starts with a date of January 1, 1970.

When I look in /var/log/upstart/puppet-agent.log I see this error over and over again:

ESC[1;31mError: Could not parse application options: copyright with a year after 1972 is very strange; did you accidentally add or subtract two years?ESC[0m

Is it possible to initialize puppet agent without having a correct date?

Puppet Agent Version 4.10.1

Philip Kirkbride
  • 21,381
  • 38
  • 125
  • 225

1 Answers1

0

This error seems to be related to the documentation so I don't know if it should error here. I proposed a pull-request to make an exception to not trigger in this situation.

That said we know if year is 1970 the device is not online, thus puppet can't be used anyways.

As a work around I added the following to the upstart pre-start script:

while [[ $(date +%Y) == "1970" ]]
do
    sleep 30
done

This way we just keep puppet waiting until the device has connected to an NTP server.

Philip Kirkbride
  • 21,381
  • 38
  • 125
  • 225
  • 1
    im not familiar with the emits from debian 14.04 embedded upstart scripts but could you not just change the start criteria to `start on ntpd` – balder Feb 17 '18 at 22:21
  • @balder I didn't consider that, I will have to check whether ntpd is running or not, because it might be possible that upstart considers it to have started even when I have no Internet connection no? – Philip Kirkbride Feb 17 '18 at 22:23
  • 1
    at the moment you have the puppet job set to start when `2klic-gateway` is started. you would have to check your ntpd upstart script to see when that starts i.e. if it is before or after `2klic-gateway`. if it is after then should change your start command to `start on ntpd` its also possible that ntpd is not managed by upstart in which case you will have to edit the ntpd script to emit the upstart event or create an upstart wrapper script – balder Feb 17 '18 at 22:31