Skip to content
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.

Commit

Permalink
rabbitmq tunnel support, + addressable dependency
Browse files Browse the repository at this point in the history
Change-Id: I7ed2d4431effdc48b3ac87865958896d9012aebf
  • Loading branch information
Alex Suraci committed Nov 8, 2011
1 parent 68abf0e commit 2142ef6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
18 changes: 14 additions & 4 deletions lib/cli/tunnel_helper.rb
@@ -1,5 +1,6 @@
# Copyright (c) 2009-2011 VMware, Inc.

require 'addressable/uri'
require 'caldecott'

module VMC::Cli
Expand Down Expand Up @@ -107,11 +108,16 @@ def tunnel_connection_info(type, service, token)
display "OK".green

info = JSON.parse(response)
['hostname', 'port', 'password'].each do |k|
err "Could not determine #{k} for #{service}" if info[k].nil?
end

case type
when "rabbitmq"
uri = Addressable::URI.parse info["url"]
info["hostname"] = uri.host
info["port"] = uri.port
info["vhost"] = uri.path[1..-1]
info["user"] = uri.user
info["password"] = uri.password
info.delete "url"

# we use "db" as the "name" for mongo
# existing "name" is junk
when "mongodb"
Expand All @@ -123,6 +129,10 @@ def tunnel_connection_info(type, service, token)
info.delete "name"
end

['hostname', 'port', 'password'].each do |k|
err "Could not determine #{k} for #{service}" if info[k].nil?
end

info
end

Expand Down
1 change: 1 addition & 0 deletions vmc.gemspec
Expand Up @@ -21,6 +21,7 @@ spec = Gem::Specification.new do |s|
s.add_dependency "terminal-table", "~> 1.4.2"
s.add_dependency "interact", "~> 0.3.0"
s.add_dependency "caldecott", "0.0.3"
s.add_dependency "addressable", "~> 2.2.6"

s.add_development_dependency "rake"
s.add_development_dependency "rspec", "~> 1.3.0"
Expand Down

0 comments on commit 2142ef6

Please sign in to comment.