Sha256: 8169e90ac7808ece1c4370940e7433bc2b4c69a4e1e02da1136c2aac284de3a6

Contents?: true

Size: 1.33 KB

Versions: 133

Compression:

Stored size: 1.33 KB

Contents

require 'httpclient'
require 'net/ssh'
require 'net/ssh/gateway'

module DPL
  class Provider
    class Openshift < Provider
      def initialize(context, options)
        super
        @deployment_branch = options[:deployment_branch]
      end

      def api
        @api ||= ::RHC::Rest::Client.new(:user => option(:user), :password => option(:password), :server => 'openshift.redhat.com')
      end

      def user
        @user ||= api.user.login
      end

      def app
        @app ||= api.find_application(option(:domain), option(:app))
      end

      def check_auth
        log "authenticated as %s" % user
      end

      def check_app
        log "found app #{app.name}"
      end

      def setup_key(file, type = nil)
        specified_type, content, comment = File.read(file).split
        api.add_key(option(:key_name), content, type || specified_type)
      end

      def remove_key
        api.delete_key(option(:key_name))
      end

      def push_app
        if @deployment_branch
          log "deployment_branch detected: #{@deployment_branch}"
          app.deployment_branch = @deployment_branch
          context.shell "git push #{app.git_url} -f #{app.deployment_branch}"
        else
          context.shell "git push #{app.git_url} -f"
        end
      end

      def restart
        app.restart
      end

    end
  end
end

Version data entries

133 entries across 133 versions & 1 rubygems

Version Path
dpl-openshift-1.10.17.travis.6637.6 lib/dpl/provider/openshift.rb
dpl-openshift-1.10.16 lib/dpl/provider/openshift.rb
dpl-openshift-1.10.16.travis.6625.6 lib/dpl/provider/openshift.rb
dpl-openshift-1.10.16.travis.6619.6 lib/dpl/provider/openshift.rb
dpl-openshift-1.10.16.travis.5961.5 lib/dpl/provider/openshift.rb
dpl-openshift-1.10.15 lib/dpl/provider/openshift.rb
dpl-openshift-1.10.15.travis.5877.5 lib/dpl/provider/openshift.rb
dpl-openshift-1.10.14 lib/dpl/provider/openshift.rb
dpl-openshift-1.10.13 lib/dpl/provider/openshift.rb
dpl-openshift-1.10.13.travis.4159.5 lib/dpl/provider/openshift.rb
dpl-openshift-1.10.13.travis.4040.5 lib/dpl/provider/openshift.rb
dpl-openshift-1.10.13.travis.4033.5 lib/dpl/provider/openshift.rb
dpl-openshift-1.10.12 lib/dpl/provider/openshift.rb
dpl-openshift-1.10.12.travis.4032.5 lib/dpl/provider/openshift.rb
dpl-openshift-1.10.12.travis.3506.5 lib/dpl/provider/openshift.rb
dpl-openshift-1.10.11.travis.3504.5 lib/dpl/provider/openshift.rb
dpl-openshift-1.10.11 lib/dpl/provider/openshift.rb
dpl-openshift-1.10.11.travis.3499.5 lib/dpl/provider/openshift.rb
dpl-openshift-1.10.11.travis.3497.5 lib/dpl/provider/openshift.rb
dpl-openshift-1.10.10 lib/dpl/provider/openshift.rb