Sha256: 2977a76a905ba7b38ca0395eda2db83cc4ea51e309ab5d550b9c5cda263acc82

Contents?: true

Size: 899 Bytes

Versions: 4

Compression:

Stored size: 899 Bytes

Contents

module DPL
  class Provider
    class Openshift < Provider
      experimental "openshift"
      requires 'rhc'

      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='ssh-rsa')
        api.add_key(option(:key_name), type, File.read(file))
      end

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

      def push_app
        context.shell "git push #{app.git_url} -f"
      end

      def restart
        app.restart
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
dpl-1.3.3 lib/dpl/provider/openshift.rb
dpl-1.3.2 lib/dpl/provider/openshift.rb
dpl-1.3.1 lib/dpl/provider/openshift.rb
dpl-1.3.0 lib/dpl/provider/openshift.rb