Sha256: b16ecf0d25ecbc3ca781be27bb6ab0e6744674843947dea8f8d08664400752e2

Contents?: true

Size: 1.5 KB

Versions: 47

Compression:

Stored size: 1.5 KB

Contents

module Beaker
  class Aixer < Beaker::Hypervisor

    def initialize(aix_hosts, options)
      @options = options
      @logger = options[:logger]
      @hosts = aix_hosts
      #aix machines are reverted to known state, not a snapshot
      @fog_file = nil
      if File.exists?( @options[:dot_fog] )
        @fog_file = YAML.load_file( @options[:dot_fog] )
      end
      raise "Cant load #{@options[:dot_fog]} config" unless @fog_file

    end

    def provision
      # Running the rake task on rpm-builder
      hypername = @fog_file[:default][:aix_hypervisor_server]
      hyperopts = @options.dup
      hyperopts['HOSTS'] = {
          hypername => { 'platform' => 'el-6-x86_64' }
      }

      @logger.notify "Connecting to hypervisor at #{hypername}"
      hypervisor = Beaker::Host.create( hypername, hyperopts )
      hypervisor[:user] = @fog_file[:default][:aix_hypervisor_username] || hypervisor[:user]
      hypervisor[:ssh][:keys] = [@fog_file[:default][:aix_hypervisor_keyfile]] || hypervisor[:ssh][:keys]

      @hosts.each do |host|
        vm_name = host['vmname'] || host.name

        @logger.notify "Reverting #{vm_name} to aix clean state"
        start = Time.now
        # Restore AIX image, ID'd by the hostname
        hypervisor.exec(Command.new("cd pe-aix && rake restore:#{host.name}"))
        time = Time.now - start
        @logger.notify "Spent %.2f seconds reverting" % time
      end
      hypervisor.close
    end

    def cleanup
      @logger.notify "No cleanup for aix boxes"
    end

  end
end

Version data entries

47 entries across 47 versions & 1 rubygems

Version Path
beaker-1.21.0 lib/beaker/hypervisor/aixer.rb
beaker-2.13.0 lib/beaker/hypervisor/aixer.rb
beaker-2.12.0 lib/beaker/hypervisor/aixer.rb
beaker-2.11.0 lib/beaker/hypervisor/aixer.rb
beaker-2.10.0 lib/beaker/hypervisor/aixer.rb
beaker-2.9.0 lib/beaker/hypervisor/aixer.rb
beaker-2.8.0 lib/beaker/hypervisor/aixer.rb
beaker-2.7.1 lib/beaker/hypervisor/aixer.rb
beaker-2.7.0 lib/beaker/hypervisor/aixer.rb
beaker-2.6.0 lib/beaker/hypervisor/aixer.rb
beaker-2.5.1 lib/beaker/hypervisor/aixer.rb
beaker-2.5.0 lib/beaker/hypervisor/aixer.rb
beaker-2.4.1 lib/beaker/hypervisor/aixer.rb
beaker-2.4.0 lib/beaker/hypervisor/aixer.rb
beaker-2.3.0 lib/beaker/hypervisor/aixer.rb
beaker-2.2.0 lib/beaker/hypervisor/aixer.rb
beaker-2.1.0 lib/beaker/hypervisor/aixer.rb
beaker-2.0.0 lib/beaker/hypervisor/aixer.rb
beaker-1.20.1 lib/beaker/hypervisor/aixer.rb
beaker-1.20.0 lib/beaker/hypervisor/aixer.rb