lib/gogetit/cli.rb in gogetit-0.1.18 vs lib/gogetit/cli.rb in gogetit-0.1.19

- old
+ new

@@ -1,8 +1,8 @@ require 'thor' require 'gogetit' -require 'util' +require 'gogetit/util' module Gogetit class CLI < Thor include Gogetit::Util package_name 'Gogetit' @@ -15,26 +15,28 @@ puts "Listing KVM domains on #{Gogetit.config[:libvirt][:url]}.." system("virsh -c #{Gogetit.config[:libvirt][:url]} list --all") end desc 'create (TYPE) NAME', 'Create either a container or KVM domain.' + method_option :chef, :type => :boolean, :desc => "Enable chef awareness." def create(type='lxd', name) case type when 'lxd' Gogetit.lxd.create(name) when 'libvirt' Gogetit.libvirt.create(name) else abort('Invalid argument entered.') end # post-tasks - knife_bootstrap(name, type, Gogetit.config) + knife_bootstrap(name, type, Gogetit.config) if options[:chef] Gogetit.config[:default][:user] ||= ENV['USER'] puts "ssh #{Gogetit.config[:default][:user]}@#{name}" end desc 'destroy NAME', 'Destroy either a container or KVM domain.' + method_option :chef, :type => :boolean, :desc => "Enable chef awareness." def destroy(name) type = Gogetit.get_provider_of(name) if type case type when 'lxd' @@ -44,10 +46,10 @@ else abort('Invalid argument entered.') end end # post-tasks - knife_remove(name) + knife_remove(name) if options[:chef] end desc 'rebuild NAME', 'Destroy and create either a container or KVM domain again.' def rebuild(type=nil, name) invoke :destroy, [name]