Skip to content

Commit

Permalink
Merge pull request #1417 from brightbox/add_dns_name
Browse files Browse the repository at this point in the history
[Brightbox] Adds #dns_name to server
  • Loading branch information
tokengeek committed Dec 24, 2012
2 parents 3c6bf2d + aa66911 commit 2e83766
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/fog/brightbox/models/compute/server.rb
Expand Up @@ -129,6 +129,14 @@ def image
connection.images.get(image_id)
end

# Returns the public DNS name of the server
#
# @return [String]
#
def dns_name
["public", fqdn].join(".")
end

def private_ip_address
unless interfaces.empty?
interfaces.first["ipv4_address"]
Expand Down
21 changes: 21 additions & 0 deletions tests/brightbox/models/compute/server_tests.rb
@@ -0,0 +1,21 @@
Shindo.tests("Fog::Compute[:brightbox] | Server model", ["brightbox"]) do

pending if Fog.mocking?

tests("success") do

unless Fog.mocking?
@server = Brightbox::Compute::TestSupport.get_test_server
server_id = @server.id
end

tests("#dns_name") do
pending if Fog.mocking?
returns("public.#{@server.fqdn}") { @server.dns_name }
end

unless Fog.mocking?
@server.destroy
end
end
end

0 comments on commit 2e83766

Please sign in to comment.