This repository has been archived by the owner on Jan 30, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
jtimberman
committed
Oct 22, 2012
0 parents
commit 9b5cbfc
Showing
2 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
require 'chef/knife' | ||
|
||
module KnifePlugins | ||
class GemInstall < Chef::Knife | ||
deps do | ||
require 'chef/mixin/shell_out' | ||
include Chef::Mixin::ShellOut | ||
end | ||
|
||
banner "knife gem install GEMNAME" | ||
|
||
def run | ||
knife_gem = shell_out("#{Gem.bindir}/gem install #{name_args[0]}") | ||
ui.info knife_gem.stdout | ||
end | ||
end | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
require 'chef/knife' | ||
|
||
module KnifePlugins | ||
class Nukular < Chef::Knife | ||
deps do | ||
require 'fission' | ||
require 'chef/node' | ||
require 'chef/api_client' | ||
end | ||
|
||
banner "knife nukular VM SNAPSHOT [NODE]" | ||
|
||
def run | ||
vm, snapshot = @name_args | ||
node = @name_args[2].nil? ? vm : @name_args[2] | ||
Fission::Command::SnapshotRevert.new(args=[vm, snapshot]).execute | ||
Fission::Command::Start.new(args=[vm]).execute | ||
begin | ||
Chef::Node.load(node).destroy | ||
ui.msg "Deleted node #{node}" | ||
rescue | ||
ui.msg "Could not find node #{node}" | ||
end | ||
begin | ||
Chef::ApiClient.load(node).destroy | ||
ui.msg "Deleted client #{node}" | ||
rescue | ||
ui.msg "Could not find client #{node}" | ||
end | ||
end | ||
end | ||
end |