Skip to content

Commit 8a75613

Browse files
(maint) Merge up f638242 to main
Generated by CI * commit 'f6382423c4236c9d068a566e681ba06af2afa8f7': (packaging) Updating manpage file for 6.x (PUP-9998) Check agent disabled status after sleeping Conflicts: man/man8/puppet-key.8 man/man8/puppet-man.8 man/man8/puppet-status.8
2 parents ac45fe2 + f638242 commit 8a75613

19 files changed

+70
-30
lines changed

lib/puppet/agent.rb

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,25 @@ def needing_restart?
3838
# Perform a run with our client.
3939
def run(client_options = {})
4040
if disabled?
41-
Puppet.notice _("Skipping run of %{client_class}; administratively disabled (Reason: '%{disable_message}');\nUse 'puppet agent --enable' to re-enable.") % { client_class: client_class, disable_message: disable_message }
41+
log_disabled_message
4242
return
4343
end
4444

4545
result = nil
4646
wait_for_lock_deadline = nil
4747
block_run = Puppet::Application.controlled_run do
48-
# splay may sleep for awhile!
49-
splay(client_options.fetch(:splay, Puppet[:splay]))
48+
# splay may sleep for awhile when running onetime! If not onetime, then
49+
# the job scheduler splays (only once) so that agents assign themselves a
50+
# slot within the splay interval.
51+
do_splay = client_options.fetch(:splay, Puppet[:splay])
52+
if do_splay
53+
splay(do_splay)
54+
55+
if disabled?
56+
log_disabled_message
57+
break
58+
end
59+
end
5060

5161
# waiting for certs may sleep for awhile depending on onetime, waitforcert and maxwaitforcert!
5262
# this needs to happen before forking so that if we fail to obtain certs and try to exit, then
@@ -59,14 +69,19 @@ def run(client_options = {})
5969
begin
6070
# lock may sleep for awhile depending on waitforlock and maxwaitforlock!
6171
lock do
62-
# NOTE: Timeout is pretty heinous as the location in which it
63-
# throws an error is entirely unpredictable, which means that
64-
# it can interrupt code blocks that perform cleanup or enforce
65-
# sanity. The only thing a Puppet agent should do after this
66-
# error is thrown is die with as much dignity as possible.
67-
Timeout.timeout(Puppet[:runtimeout], RunTimeoutError) do
68-
Puppet.override(ssl_context: ssl_context) do
69-
client.run(client_args)
72+
if disabled?
73+
log_disabled_message
74+
nil
75+
else
76+
# NOTE: Timeout is pretty heinous as the location in which it
77+
# throws an error is entirely unpredictable, which means that
78+
# it can interrupt code blocks that perform cleanup or enforce
79+
# sanity. The only thing a Puppet agent should do after this
80+
# error is thrown is die with as much dignity as possible.
81+
Timeout.timeout(Puppet[:runtimeout], RunTimeoutError) do
82+
Puppet.override(ssl_context: ssl_context) do
83+
client.run(client_args)
84+
end
7085
end
7186
end
7287
end
@@ -88,8 +103,7 @@ def run(client_options = {})
88103
end
89104
rescue RunTimeoutError => detail
90105
Puppet.log_exception(detail, _("Execution of %{client_class} did not complete within %{runtimeout} seconds and was terminated.") %
91-
{client_class: client_class,
92-
runtimeout: Puppet[:runtimeout]})
106+
{client_class: client_class, runtimeout: Puppet[:runtimeout]})
93107
nil
94108
rescue StandardError => detail
95109
Puppet.log_exception(detail, _("Could not run %{client_class}: %{detail}") % { client_class: client_class, detail: detail })
@@ -155,4 +169,8 @@ def wait_for_certificates(options)
155169
sm = Puppet::SSL::StateMachine.new(waitforcert: waitforcert, onetime: Puppet[:onetime])
156170
sm.ensure_client_certificate
157171
end
172+
173+
def log_disabled_message
174+
Puppet.notice _("Skipping run of %{client_class}; administratively disabled (Reason: '%{disable_message}');\nUse 'puppet agent --enable' to re-enable.") % { client_class: client_class, disable_message: disable_message }
175+
end
158176
end

man/man8/puppet-apply.8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.\" generated with Ronn/v0.7.3
22
.\" http://github.com/rtomayko/ronn/tree/0.7.3
33
.
4-
.TH "PUPPET\-APPLY" "8" "May 2022" "Puppet, Inc." "Puppet manual"
4+
.TH "PUPPET\-APPLY" "8" "June 2022" "Puppet, Inc." "Puppet manual"
55
.
66
.SH "NAME"
77
\fBpuppet\-apply\fR \- Apply Puppet manifests locally

man/man8/puppet-catalog.8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.\" generated with Ronn/v0.7.3
22
.\" http://github.com/rtomayko/ronn/tree/0.7.3
33
.
4-
.TH "PUPPET\-CATALOG" "8" "May 2022" "Puppet, Inc." "Puppet manual"
4+
.TH "PUPPET\-CATALOG" "8" "June 2022" "Puppet, Inc." "Puppet manual"
55
.
66
.SH "NAME"
77
\fBpuppet\-catalog\fR \- Compile, save, view, and convert catalogs\.

man/man8/puppet-config.8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.\" generated with Ronn/v0.7.3
22
.\" http://github.com/rtomayko/ronn/tree/0.7.3
33
.
4-
.TH "PUPPET\-CONFIG" "8" "May 2022" "Puppet, Inc." "Puppet manual"
4+
.TH "PUPPET\-CONFIG" "8" "June 2022" "Puppet, Inc." "Puppet manual"
55
.
66
.SH "NAME"
77
\fBpuppet\-config\fR \- Interact with Puppet\'s settings\.

man/man8/puppet-describe.8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.\" generated with Ronn/v0.7.3
22
.\" http://github.com/rtomayko/ronn/tree/0.7.3
33
.
4-
.TH "PUPPET\-DESCRIBE" "8" "May 2022" "Puppet, Inc." "Puppet manual"
4+
.TH "PUPPET\-DESCRIBE" "8" "June 2022" "Puppet, Inc." "Puppet manual"
55
.
66
.SH "NAME"
77
\fBpuppet\-describe\fR \- Display help about resource types

man/man8/puppet-device.8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.\" generated with Ronn/v0.7.3
22
.\" http://github.com/rtomayko/ronn/tree/0.7.3
33
.
4-
.TH "PUPPET\-DEVICE" "8" "May 2022" "Puppet, Inc." "Puppet manual"
4+
.TH "PUPPET\-DEVICE" "8" "June 2022" "Puppet, Inc." "Puppet manual"
55
.
66
.SH "NAME"
77
\fBpuppet\-device\fR \- Manage remote network devices

man/man8/puppet-doc.8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.\" generated with Ronn/v0.7.3
22
.\" http://github.com/rtomayko/ronn/tree/0.7.3
33
.
4-
.TH "PUPPET\-DOC" "8" "May 2022" "Puppet, Inc." "Puppet manual"
4+
.TH "PUPPET\-DOC" "8" "June 2022" "Puppet, Inc." "Puppet manual"
55
.
66
.SH "NAME"
77
\fBpuppet\-doc\fR \- Generate Puppet references

man/man8/puppet-epp.8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.\" generated with Ronn/v0.7.3
22
.\" http://github.com/rtomayko/ronn/tree/0.7.3
33
.
4-
.TH "PUPPET\-EPP" "8" "May 2022" "Puppet, Inc." "Puppet manual"
4+
.TH "PUPPET\-EPP" "8" "June 2022" "Puppet, Inc." "Puppet manual"
55
.
66
.SH "NAME"
77
\fBpuppet\-epp\fR \- Interact directly with the EPP template parser/renderer\.

man/man8/puppet-generate.8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.\" generated with Ronn/v0.7.3
22
.\" http://github.com/rtomayko/ronn/tree/0.7.3
33
.
4-
.TH "PUPPET\-GENERATE" "8" "May 2022" "Puppet, Inc." "Puppet manual"
4+
.TH "PUPPET\-GENERATE" "8" "June 2022" "Puppet, Inc." "Puppet manual"
55
.
66
.SH "NAME"
77
\fBpuppet\-generate\fR \- Generates Puppet code from Ruby definitions\.

man/man8/puppet-help.8

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.\" generated with Ronn/v0.7.3
22
.\" http://github.com/rtomayko/ronn/tree/0.7.3
33
.
4-
.TH "PUPPET\-HELP" "8" "May 2022" "Puppet, Inc." "Puppet manual"
4+
.TH "PUPPET\-HELP" "8" "June 2022" "Puppet, Inc." "Puppet manual"
55
.
66
.SH "NAME"
77
\fBpuppet\-help\fR \- Display Puppet help\.

0 commit comments

Comments
 (0)