Sha256: 7537e120a83bd10ea8ae7683317784c5388614cdbf5f09273b0ebba89b80ac1c

Contents?: true

Size: 1.4 KB

Versions: 16

Compression:

Stored size: 1.4 KB

Contents

require 'mccloud/provider/core/provider'
require 'mccloud/provider/fog/fogconfig'

module Mccloud
  module Provider
    module Fog
      class Provider  < ::Mccloud::Provider::Core::Provider

        attr_accessor :credentials_path

        def initialize(name,options,env)
          super(name,options,env)
          required_gems=%w{fog}
          check_gem_availability(required_gems)
          require 'fog'
          @credentials_path=::Fog.credentials_path
        end

        def check_fog_credentials(keynames)
          ::Fog.credentials_path=@credentials_path

          errormsgs=["Missing Credentials"]
          fogconfig=::Mccloud::Provider::Fog::FogConfig.new(@credential)

          missing_credentials=fogconfig.missing_credentials(keynames)
          unless missing_credentials.empty?

            unless fogconfig.exists?
              errormsgs<<"Create the file #{::Fog.credentials_path} with the following content:"
            else
              errormsgs<<"Add the following snippet to #{::Fog.credentials_path}:"
            end

            errormsgs<< "=====================  snippet begin ====================="
            errormsgs<< fogconfig.missing_snippet(keynames)
            errormsgs<< "=====================  snippet end   ====================="
            errormsg=errormsgs.join("\n")

            raise Mccloud::Error, "#{errormsg}"
          end
        end

      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
mccloud-0.1.1 lib/mccloud/provider/fog/provider.rb
mccloud-0.0.28 lib/mccloud/provider/fog/provider.rb
mccloud-0.0.27 lib/mccloud/provider/fog/provider.rb
mccloud-0.0.26 lib/mccloud/provider/fog/provider.rb
mccloud-0.0.25 lib/mccloud/provider/fog/provider.rb
mccloud-0.0.24 lib/mccloud/provider/fog/provider.rb
mccloud-0.0.23 lib/mccloud/provider/fog/provider.rb
mccloud-0.0.22 lib/mccloud/provider/fog/provider.rb
mccloud-0.0.21 lib/mccloud/provider/fog/provider.rb
mccloud-0.0.20 lib/mccloud/provider/fog/provider.rb
mccloud-0.0.19 lib/mccloud/provider/fog/provider.rb
mccloud-0.0.18 lib/mccloud/provider/fog/provider.rb
mccloud-0.0.17 lib/mccloud/provider/fog/provider.rb
mccloud-0.0.16 lib/mccloud/provider/fog/provider.rb
mccloud-0.0.15 lib/mccloud/provider/fog/provider.rb
mccloud-0.0.14 lib/mccloud/provider/fog/provider.rb