29: def run(*args)
30: if running?
31: Puppet.notice "Run of #{client_class} already in progress; skipping"
32: return
33: end
34: result = nil
35: block_run = Puppet::Application.controlled_run do
36: splay
37: with_client do |client|
38: begin
39: sync.synchronize { lock { result = client.run(*args) } }
40: rescue SystemExit,NoMemoryError
41: raise
42: rescue Exception => detail
43: puts detail.backtrace if Puppet[:trace]
44: Puppet.err "Could not run #{client_class}: #{detail}"
45: end
46: end
47: true
48: end
49: Puppet.notice "Shutdown/restart in progress; skipping run" unless block_run
50: result
51: end