mirror of
https://github.com/rapid7/metasploitable3.git
synced 2024-07-15 00:01:26 +02:00
22 lines
597 B
Ruby
22 lines
597 B
Ruby
|
module DockerCookbook
|
||
|
class DockerExec < DockerBase
|
||
|
resource_name :docker_exec
|
||
|
|
||
|
property :host, [String, nil], default: lazy { default_host }
|
||
|
property :command, Array
|
||
|
property :container, String
|
||
|
property :timeout, Numeric, default: 60
|
||
|
|
||
|
property :container_obj, Docker::Container, desired_state: false
|
||
|
|
||
|
alias cmd command
|
||
|
|
||
|
action :run do
|
||
|
converge_by "executing #{command} on #{container}" do
|
||
|
with_retries { container_obj Docker::Container.get(container, {}, connection) }
|
||
|
container_obj.exec(command, wait: timeout)
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|