Sha256: 38d81b1660b9f197705d410fbb5c41b43ea5d9d90f864260a7d696759b96dbcd

Contents?: true

Size: 828 Bytes

Versions: 21

Compression:

Stored size: 828 Bytes

Contents

require 'gogetit/version'
require 'gogetit/config'
require 'gogetit/maas'
require 'providers/lxd'
require 'providers/libvirt'

module Gogetit

  class << self
    attr_reader :config, :logger, :maas, :lxd, :libvirt
  end

  @config = Gogetit::Config.config
  @logger = Gogetit::Config.logger
  @maas = Gogetit::GogetMAAS.new(config, logger)
  @lxd = Gogetit::GogetLXD.new(config, maas, logger)
  @libvirt = Gogetit::GogetLibvirt.new(config, maas, logger)

  def self.get_provider_of(name)
    if lxd.container_exists?(name)
      logger.info("Calling <#{__method__.to_s}>, It is a LXD container.")
      return 'lxd'
    elsif libvirt.domain_exists?(name)
      logger.info("Calling <#{__method__.to_s}>, It is a KVM domain.")
      return 'libvirt'
    else
      puts "#{name} is not found"
      return nil
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
gogetit-0.12.3 lib/gogetit.rb
gogetit-0.12.2 lib/gogetit.rb
gogetit-0.12.1 lib/gogetit.rb
gogetit-0.12.0 lib/gogetit.rb
gogetit-0.11.0 lib/gogetit.rb
gogetit-0.10.0 lib/gogetit.rb
gogetit-0.9.0 lib/gogetit.rb
gogetit-0.8.0 lib/gogetit.rb
gogetit-0.7.0 lib/gogetit.rb
gogetit-0.6.0 lib/gogetit.rb
gogetit-0.5.3 lib/gogetit.rb
gogetit-0.5.2 lib/gogetit.rb
gogetit-0.5.1 lib/gogetit.rb
gogetit-0.5.0 lib/gogetit.rb
gogetit-0.4.2 lib/gogetit.rb
gogetit-0.4.1 lib/gogetit.rb
gogetit-0.4.0 lib/gogetit.rb
gogetit-0.3.0 lib/gogetit.rb
gogetit-0.2.1 lib/gogetit.rb
gogetit-0.2.0 lib/gogetit.rb