Class: VMCAppfog::BindAll

Inherits:
VMC::CLI
  • Object
show all
Defined in:
lib/appfog-vmc-plugin/commands/bind-all.rb

Instance Method Summary collapse

Instance Method Details

#bind_servicesObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/appfog-vmc-plugin/commands/bind-all.rb', line 9

def bind_services
  src_app = input[:src_app]
  fail "No services to bind." if src_app.services.empty?

  dest_app = input[:dest_app]

  src_app.services.each do |service|
    with_progress("Binding service #{c(service.name, :name)} to #{c(dest_app.name, :name)}") do |s|
      if dest_app.binds?(service)
        s.skip do
          err "App #{b(dest_app.name)} already binds #{b(service.name)}."
        end
      else
        dest_app.bind(service)
      end
    end
  end
end