Sha256: 346857b18f0b5d4e70d996c7b8237b3399a71c167b77358d190d88b798696e52

Contents?: true

Size: 1.41 KB

Versions: 1

Compression:

Stored size: 1.41 KB

Contents

#!/usr/bin/env ruby

require 'rubygems'
require 'abiquo-etk'

begin
  v = AETK::System.abiquo_version
  if v !~ /1\.7\.5/
    raise Exception.new
  end
rescue Exception => e
  $stderr.puts 'This version of abicli only supports Abiquo 1.7.5. Use abiquo-etk <= 0.4.42'
  $stderr.puts "DEBUG: #{e.message}"
  exit 1
end

if `whoami`.strip.chomp != 'root'
  puts 'You need to run this as root.'
  exit
end

begin
  require 'lib/abiquo-etk'
rescue LoadError
  require 'rubygems'
  require 'abiquo-etk'
end

class String
  include Term::ANSIColor
end

class MyCLI
  include Mixlib::CLI

  option :debug,
    :long  => "--debug",
    :description => "Set the log level to debug",
    #:required => true,
    :proc => Proc.new { |l| AETK::Log.instance.level = Logger::DEBUG }
  
  option :extra_plugins,
    :long => '--extra-plugins DIR',
    :description => 'Extra plugins directory',
    :default => nil

  option :version,
    :long => '--version',
    :short => '-v',
    :proc => Proc.new { puts "Abiquo Elite Toolkit Version " + File.read(File.dirname(__FILE__) + '/../VERSION') },
    :exit => 0
    
  option :help,
    :short => "-h",
    :long => "--help",
    :description => "Show this message",
    :on => :tail,
    :boolean => true,
    :show_options => true,
    :exit => 0

end

# ARGV = [ '-c', 'foo.rb', '-l', 'debug' ]
cli = MyCLI.new
cli.parse_options

AETK.load_plugins(cli.config[:extra_plugins])
include AETK::OutputFormatters

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
abiquo-etk-0.5.3 bin/abiquo-check-install