-
-
Save hannesfostie/5ff199f13a24a7f71228 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'slop' | |
options = Slop.parse do | |
banner %{Usage: sock_admin COMMAND [OPTIONS] | |
Control Sock from the command line. | |
} | |
command 'chef' do | |
command 'last' do | |
on :h, :host=, "Get the time of the last Chef run for a host" | |
on :e, :environment=, "Set the Sock environment" | |
on :e, :env=, "Set the Sock environment" | |
run do |options, args| | |
output = "Getting last Chef run for #{options[:host]}" | |
output << " for environment #{options[:environment]}" if options[:environment] | |
output << " for environment #{options[:env]}" if options[:env] | |
puts output | |
end | |
end | |
command 'run' do | |
on :h, :host=, "Run Chef on a host" | |
on :e, :environment=, "Set the Sock environment" | |
on :e, :env=, "Set the Sock environment" | |
run do |options, args| | |
output = "Running Chef on host #{options[:host]}" | |
output << " for environment #{options[:environment]}" if options[:environment] | |
output << " for environment #{options[:env]}" if options[:env] | |
puts output | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment