Distinguishing between regular and one-time invocations in Puppet code
Can a Puppet script find out whether it was invoked as part of regular configuration run, i.e. a Puppet agent applying configurations at regular intervals (i.e.
puppet agent), or because of one-time actions (e.g.
puppet agent -t,
I have not tried this yet in practice, but the following may allow a way forward:
The Puppet master variable
$servernameidentifies the Puppet master for
puppet agentruns and is (perhaps)
Hence a recipe for an overall solution may look as follows:
$onetime = $settings::test or $settings::onetime or ($servername == undef)