Sha256: 528ff052101b7164e9c1ff7d47e43d2cc838bceb2fc7725b64b4621d06652ab3

Contents?: true

Size: 845 Bytes

Versions: 1

Compression:

Stored size: 845 Bytes

Contents

module Vagrant
  module Notify
    class Config < Vagrant.plugin(2, :config)
      attr_accessor :enable

      def initialize()
        @enable = UNSET_VALUE
      end

      def validate(machine)
        errors = _detected_errors

        if backed_by_cloud_provider?(machine)
          machine.ui.warn("Disabling vagrant-notify, cloud provider #{machine.provider_name} in use.")

          @enable = false
        end

        if @enable != 0
          if @enable != false && @enable != true
            errors << "Unknown option: #{@enable}"

            { "notify" => errors }
          end
        end
      end

      def finalize!
        @enable = 0 if @enable == UNSET_VALUE
      end

      private

      def backed_by_cloud_provider?(machine)
        CLOUD_PROVIDERS.include?(machine.provider_name.to_s)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vagrant-notify-0.5.1 lib/vagrant-notify/config.rb