Skip to content

Commit

Permalink
(maint) Add get_container_ip spec helper
Browse files Browse the repository at this point in the history
 - While this is not used anywhere (yet?), make it a helper because
   it took a little bit of effort to figure out how to extract this
   information
  • Loading branch information
Iristyle committed May 4, 2019
1 parent 58e44f4 commit d3a7d5f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions gem/lib/pupperware/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ def get_container_hostname(container)
return fqdn || inspect_container(container, '{{.Config.Hostname}}')
end

# this only works when a container has a single network
def get_container_ip(container)
inspect_container(container, '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}')
end

def emit_log(container)
container_name = get_container_name(container)
STDOUT.puts("#{'*' * 80}\nContainer logs for #{container_name} / #{container}\n#{'*' * 80}\n")
Expand Down

0 comments on commit d3a7d5f

Please sign in to comment.