Sha256: 74c7bb9d945a5649c3a80cda9be119049190da85d4ca281c509643aff1532c1e

Contents?: true

Size: 1.48 KB

Versions: 4

Compression:

Stored size: 1.48 KB

Contents

module VagrantPlugins
  module Invade
    module Validator

      class HostManager

        attr_accessor :env
        attr_accessor :hostmanager

        DEFAULT = {
          'enabled' => true,
          'manage_host' => true,
          'manage_guest' => true,
          'ignore_private_ip' => false,
          'include_offline' => true
        }

        def initialize(hostmanager)
          @hostmanager = hostmanager
        end

        def validate
          return nil unless @hostmanager

          # ENABLED
          @hostmanager['enabled'] = Validator.validate_boolean(
            @hostmanager['enabled'], 'enabled', DEFAULT['enabled']
          )

          # MANAGE HOST
          @hostmanager['manage_host'] = Validator.validate_boolean(
            @hostmanager['manage_host'], 'manage_host', DEFAULT['manage_host']
          )

          # MANAGE GUEST
          @hostmanager['manage_guest'] = Validator.validate_boolean(
            @hostmanager['manage_guest'], 'manage_guest', DEFAULT['manage_guest']
          )

          # IGNORE PRIVATE IP
          @hostmanager['ignore_private_ip'] = Validator.validate_boolean(
            @hostmanager['ignore_private_ip'], 'ignore_private_ip', DEFAULT['ignore_private_ip']
          )

          # INCLUDE OFFLINE
          @hostmanager['include_offline'] = Validator.validate_boolean(
            @hostmanager['include_offline'], 'include_offline', DEFAULT['include_offline']
          )

          @hostmanager
        end

      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
vagrant-invade-0.5.3 lib/vagrant-invade/validator/hostmanager.rb
vagrant-invade-0.5.2 lib/vagrant-invade/validator/hostmanager.rb
vagrant-invade-0.5.1 lib/vagrant-invade/validator/hostmanager.rb
vagrant-invade-0.5.0 lib/vagrant-invade/validator/hostmanager.rb