Hi I am new to resource development, how can I do this in a provider,
Get output of a shell command, if output contains the word "running…"
set new_resource.status should be set to “running”
how can I do that ?
Hi I am new to resource development, how can I do this in a provider,
Get output of a shell command, if output contains the word "running…"
set new_resource.status should be set to “running”
how can I do that ?
Hey Tayrone,
Take a look at the documentation for mixlib-shellout
https://github.com/chef/mixlib-shellout. You can inspect the .stdout of
your command, and use that information.
mycommand = Mixlib::ShellOut.new("some-shell-command --flags")
mycommand.run_commandif mycommand.stdout =~ /running.../
#do somethingelse
#do something elseend
(pardon any syntax errors)
Matt Moretti
On Wed, Apr 8, 2015 at 3:51 PM, Tayrone Isa tayrone.isa@gmail.com wrote:
Hi I am new to resource development, how can I do this in a provider,
Get output of a shell command, if output contains the word "running..."
set new_resource.status should be set to "running"how can I do that ?
you can also include the mixin module in core chef,
and just use shell_out or shell_out!
On Wed, Apr 8, 2015 at 2:48 PM, Matthew Moretti werebus@gmail.com wrote:
Hey Tayrone,
Take a look at the documentation for mixlib-shellout
https://github.com/chef/mixlib-shellout. You can inspect the .stdout of
your command, and use that information.mycommand = Mixlib::ShellOut.new("some-shell-command --flags")
mycommand.run_commandif mycommand.stdout =~ /running.../
#do somethingelse
#do something elseend(pardon any syntax errors)
Matt Moretti
On Wed, Apr 8, 2015 at 3:51 PM, Tayrone Isa tayrone.isa@gmail.com wrote:
Hi I am new to resource development, how can I do this in a provider,
Get output of a shell command, if output contains the word "running..."
set new_resource.status should be set to "running"how can I do that ?