module DockerBoss::Helpers::TemplateHelpers

Public Instance Methods

as_json(hash) click to toggle source
# File lib/docker_boss/helpers.rb, line 42
def as_json(hash)
  hash.to_json
end
interface_ipv4(iface) click to toggle source
# File lib/docker_boss/helpers.rb, line 46
def interface_ipv4(iface)
  ipv4 = `ip addr show docker0 | grep -Po 'inet \\K[\\d.]+'`
  raise ArgumentError, "Could not retrieve IPv4 address for interface `#{iface}`" unless $? == 0
  ipv4.chomp
end
interface_ipv6(iface) click to toggle source
# File lib/docker_boss/helpers.rb, line 52
def interface_ipv6(iface)
  ipv6 = `ip addr show docker0 | grep -Po 'inet6 \\K[\\da-f:]+'`
  raise ArgumentError, "Could not retrieve IPv6 address for interface `#{iface}`" unless $? == 0
  ipv6.chomp
end