# File lib/openshift-origin-controller/app/models/application.rb, line 768
  def expose_port(dependency=nil)
    reply = ResultIO.new
    self.comp_instance_map.each do |comp_inst_name, comp_inst|
      next if !dependency.nil? and (comp_inst.parent_cart_name != dependency)
      next if comp_inst.name == "@@app"
      next if comp_inst.parent_cart_name == self.name
      next if comp_inst.parent_cart_name == self.proxy_cartridge

      group_inst = self.group_instance_map[comp_inst.group_instance_name]
      s,f = run_on_gears(group_inst.gears, reply, false) do |gear, r|
        r.append gear.expose_port(comp_inst)
      end

      # Not all cartridges will have this hook.
      f.each do |fail|
        next if fail[:exception].resultIO.exitcode == 127
        raise fail[:exception]
      end

    end
    reply
  end