Class: DPL::Provider::Openshift

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

Instance Method Summary collapse

Instance Method Details

#api ⇒ Object



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

#app ⇒ Object



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

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

#check_app ⇒ Object



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

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

#check_auth ⇒ Object



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

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

#push_app ⇒ Object



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

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

#remove_key ⇒ Object



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

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

#restart ⇒ Object



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

#user ⇒ Object



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

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