class Chef::Knife::JoyentFwUpdate
Public Instance Methods
run()
click to toggle source
# File lib/chef/knife/joyent_fw_update.rb, line 24 def run id = name_args.first unless id || (!config.key?(:rule) || !config.key?(:enabled)) show_usage exit 1 end res = self.connection.request( :method => "POST", :path => "/my/fwrules/#{id}", :body => { "enabled" => config[:enabled], "rule" => config[:rule], } ) unless res.status == 200 output_error(res) else r = res.body ui.info ui.color("Updated Firewall Rule: #{r["id"]}", :bold) msg_pair "RULE", r["rule"] msg_pair "ENABLED", (r["enabled"] ? ui.color("✓ YES", :cyan) : "✗ NO") end end