Class: KnifeLxc::LxcServerDelete
- Inherits:
-
Chef::Knife
- Object
- Chef::Knife
- KnifeLxc::LxcServerDelete
- Includes:
- Toft
- Defined in:
- lib/chef/knife/lxc_server_delete.rb
Instance Method Summary collapse
- #container_exists?(name) ⇒ Boolean
-
#run ⇒ Object
This method will be executed when you run this knife command.
Instance Method Details
#container_exists?(name) ⇒ Boolean
25 26 27 |
# File 'lib/chef/knife/lxc_server_delete.rb', line 25 def container_exists?(name) `lxc-ls` =~ /#{name}/ end |
#run ⇒ Object
This method will be executed when you run this knife command.
18 19 20 21 22 23 |
# File 'lib/chef/knife/lxc_server_delete.rb', line 18 def run puts "Delete container #{config[:node_name]}" raise "Container not exists!! " unless container_exists? config[:node_name] n = Node.new(config[:node_name]) n.destroy end |