Module: OsCtld::Utils::Ip

Included in:
NetInterface::Bridge, NetInterface::Routed, NetInterface::Routed
Defined in:
lib/osctld/utils/ip.rb

Instance Method Summary collapse

Instance Method Details

#ip(ip_v, args, opts = {}) ⇒ OsCtl::Lib::SystemCommandResult

Returns:

  • (OsCtl::Lib::SystemCommandResult)


4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/osctld/utils/ip.rb', line 4

def ip(ip_v, args, opts = {})
  cmd = ['ip']

  case ip_v
  when 4
    cmd << '-4'
  when 6
    cmd << '-6'
  when :all
  else
    fail "unknown IP version '#{ip_v}'"
  end

  cmd.concat(args)
  syscmd(cmd.join(' '), opts)
end