Class: DPL::Provider::BluemixCloudFoundry
- Inherits:
-
DPL::Provider
- Object
- DPL::Provider
- DPL::Provider::BluemixCloudFoundry
- Defined in:
- lib/dpl/provider/bluemix_cloud_foundry.rb
Constant Summary collapse
- REGIONS =
NOTE: Much of this class is duplicated from CloudFoundry. This is by design. By duplicating a manageable amount of code here, we prevent this provider and its gem ‘dpl-bluemix_cloud_foundry` from having a dependency on `dpl-cloudfoundry`. Having less dependency is desirable when we install this gem from source.
Hash.new {"api.ng.bluemix.net"}.update( "eu-gb" => "api.eu-gb.bluemix.net", "eu-de" => "api.eu-de.bluemix.net", "au-syd" => "api.au-syd.bluemix.net" )
Instance Method Summary collapse
- #app_name ⇒ Object
- #check_app ⇒ Object
- #check_auth ⇒ Object
- #cleanup ⇒ Object
- #initial_go_tools_install ⇒ Object
- #manifest ⇒ Object
- #needs_key? ⇒ Boolean
- #push_app ⇒ Object
- #set_api ⇒ Object
- #uncleanup ⇒ Object
Instance Method Details
#app_name ⇒ Object
52 53 54 |
# File 'lib/dpl/provider/bluemix_cloud_foundry.rb', line 52 def app_name [:app_name].nil? ? "" : " '#{[:app_name]}'" end |
#check_app ⇒ Object
29 30 31 32 33 |
# File 'lib/dpl/provider/bluemix_cloud_foundry.rb', line 29 def check_app if [:manifest] error 'Application must have a manifest.yml for unattended deployment' unless File.exists? [:manifest] end end |
#check_auth ⇒ Object
22 23 24 25 26 27 |
# File 'lib/dpl/provider/bluemix_cloud_foundry.rb', line 22 def check_auth set_api initial_go_tools_install context.shell "./cf api #{option(:api)} #{'--skip-ssl-validation' if [:skip_ssl_validation]}" context.shell "./cf login -u #{option(:username)} -p #{option(:password)} -o #{option(:organization)} -s #{option(:space)}" end |
#cleanup ⇒ Object
46 47 |
# File 'lib/dpl/provider/bluemix_cloud_foundry.rb', line 46 def cleanup end |
#initial_go_tools_install ⇒ Object
18 19 20 |
# File 'lib/dpl/provider/bluemix_cloud_foundry.rb', line 18 def initial_go_tools_install context.shell 'test $(uname) = "Linux" && rel="linux64-binary" || rel="macosx64"; wget "https://cli.run.pivotal.io/stable?release=${rel}&source=github" -qO cf.tgz && tar -zxvf cf.tgz && rm cf.tgz' end |
#manifest ⇒ Object
56 57 58 |
# File 'lib/dpl/provider/bluemix_cloud_foundry.rb', line 56 def manifest [:manifest].nil? ? "" : " -f #{[:manifest]}" end |
#needs_key? ⇒ Boolean
35 36 37 |
# File 'lib/dpl/provider/bluemix_cloud_foundry.rb', line 35 def needs_key? false end |
#push_app ⇒ Object
39 40 41 42 43 44 |
# File 'lib/dpl/provider/bluemix_cloud_foundry.rb', line 39 def push_app error 'Failed to push app' unless context.shell("./cf push#{app_name}#{manifest}") ensure context.shell "./cf logout" end |
#set_api ⇒ Object
60 61 62 63 |
# File 'lib/dpl/provider/bluemix_cloud_foundry.rb', line 60 def set_api region = [:region] || "ng" [:api] = [:api] || REGIONS[region] end |
#uncleanup ⇒ Object
49 50 |
# File 'lib/dpl/provider/bluemix_cloud_foundry.rb', line 49 def uncleanup end |