You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ryota Arai edited this page May 25, 2015
·
5 revisions
run_command
You can run commands on the server you are provisioning, in a recipe by run_command. This method returns an instance of Specinfra::CommandResult.
Example
# recipe.rb# You can use run_command in a reciperesult=run_command("echo -n Hello")result.stdout == "Hello"result.exit_status == 0define:run_command_in_definitiondo# You can use run_command in definition blockrun_command("echo -n Hello")endexecute"echo Hello"do# You can use run_command in resource blockrun_command("echo -n Hello")endlocal_ruby_block'execute run_command'do# You can use run_command with local_ruby_blockblockdorun_command("echo -n Hello")endend