Created
August 30, 2013 14:34
-
-
Save sbotman/6390495 to your computer and use it in GitHub Desktop.
A Knife Cloudstack plugin command to run commands just from the command line.
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
# | |
# Author:: Sander Botman (<[email protected]>) | |
# Copyright:: Copyright (c) 2013 Sander Botman. | |
# License:: Apache License, Version 2.0 | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
# | |
require 'chef/knife/cs_base' | |
require 'chef/knife/cs_baselist' | |
module KnifeCloudstack | |
class CsCmdRun < Chef::Knife | |
include Chef::Knife::KnifeCloudstackBase | |
include Chef::Knife::KnifeCloudstackBaseList | |
deps do | |
require 'chef/knife' | |
require 'knife-cloudstack/connection' | |
Chef::Knife.load_deps | |
end | |
banner "knife cs cmd run (cmd=val)" | |
def run | |
params = {} | |
@name_args.each do |arg| | |
key = arg.split('=')[0] | |
value = arg.split('=')[1] | |
params["#{key}"] = "#{value}" | |
end | |
connection_result = connection.send_request(params) | |
pp connection_result | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment