Sha256: 9818279de93ce6a1bffcc9078b4f5348a19f75b50e27401cbfb448966262d7f3

Contents?: true

Size: 1.59 KB

Versions: 3

Compression:

Stored size: 1.59 KB

Contents

require "vagrant"
require "iniparse"

module VagrantPlugins
  module G5K
    class Config < Vagrant.plugin("2", :config)
      # G5K username
      #
      # @return [String]
      attr_accessor :username

      # G5K private_key
      #
      # @return [String]
      attr_accessor :private_key

      # G5K project_id
      #
      # @return [String]
      attr_accessor :project_id

      # G5K walltime
      #
      # @return [String]
      attr_accessor :walltime

      # G5K site
      #
      # @return [String]
      attr_accessor :site

      # G5K gateway
      #
      # @return [String]
      attr_accessor :gateway

      # G5K image
      #
      # @return [Hash]
      attr_accessor :image


      # G5K ports mapping
      # 
      #
      # @return [Array]
      attr_accessor :ports

      # OAR resource selection
      # 
      #
      # @return [String]
      attr_accessor :oar

      def initialize()
        @username         = ENV['USER']
        @project_id       = nil
        @site             = nil
        @gateway          = nil
        @walltime         = "01:00:00"
        @oar              = ""
      end

      def finalize!()
        # This is call by the plugin mecanism after initialize
      end


      def validate(machine)
        errors = _detected_errors

        errors << "g5k project_id is required" if @project_id.nil?
        errors << "g5k site is required" if @site.nil?
        errors << "g5k image is required" if @image.nil?
        errors << "g5k image must be a Hash" if !@image.is_a?(Hash)
        
        { "G5K Provider" => errors }
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
vagrant-g5k-0.0.16 lib/vagrant-g5k/config.rb
vagrant-g5k-0.0.15 lib/vagrant-g5k/config.rb
vagrant-g5k-0.0.14 lib/vagrant-g5k/config.rb