blob: af74e0f72684fc3de26b708664a6a9cfadcdb16f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
module Puppet::Util
class ExecutionStub
class << self
# Set a stub block that Puppet::Util.execute() should invoke instead
# of actually executing commands on the target machine. Intended
# for spec testing.
#
# The arguments passed to the block are |command, options|, where
# command is an array of strings and options is an options hash.
def set(&block)
@value = block
end
# Uninstall any execution stub, so that calls to
# Puppet::Util.execute() behave normally again.
def reset
@value = nil
end
# Retrieve the current execution stub, or nil if there is no stub.
def current_value
@value
end
end
end
end
|