Class: DPL::Provider::Openshift

Inherits:
DPL::Provider show all
Defined in:
lib/dpl/provider/openshift.rb

Instance Attribute Summary

Attributes inherited from DPL::Provider

#context, #options

Instance Method Summary collapse

Methods inherited from DPL::Provider

#cleanup, context, #create_key, #deploy, #error, experimental, #initialize, #log, #needs_key?, new, npm_g, #option, pip, requires, #run, #setup_git_ssh, #sha, shell

Constructor Details

This class inherits a constructor from DPL::Provider

Instance Method Details

#apiObject



7
8
9
# File 'lib/dpl/provider/openshift.rb', line 7

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

#appObject



15
16
17
# File 'lib/dpl/provider/openshift.rb', line 15

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

#check_appObject



23
24
25
# File 'lib/dpl/provider/openshift.rb', line 23

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

#check_authObject



19
20
21
# File 'lib/dpl/provider/openshift.rb', line 19

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

#push_appObject



35
36
37
# File 'lib/dpl/provider/openshift.rb', line 35

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

#remove_keyObject



31
32
33
# File 'lib/dpl/provider/openshift.rb', line 31

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

#restartObject



39
40
41
# File 'lib/dpl/provider/openshift.rb', line 39

def restart
  app.restart
end

#setup_key(file, type = 'ssh-rsa') ⇒ Object



27
28
29
# File 'lib/dpl/provider/openshift.rb', line 27

def setup_key(file, type='ssh-rsa')
  api.add_key(option(:key_name), type, File.read(file))
end

#userObject



11
12
13
# File 'lib/dpl/provider/openshift.rb', line 11

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