def ipv6_addresses(interface):
 with settings(hide('running', 'stdout')):
  res = sudo(("/sbin/ifconfig %(interface)s | grep 'inet6 ' || true" % locals()))
 ret = {}
 if (res == ''):
  return ret
 lines = res.split('\n')
 for line in lines:
  if ('addr' in line):
   addr = res.split()[2]
  else:
   addr = res.split()[1]
  lower_line = line.lower()
  addr_scope = 'unknown'
  for scope in ['host', 'link', 'global']:
   if (scope in lower_line):
    addr_scope = scope
  ret[addr_scope] = addr
 return ret

def ipv6_addresses ( interface ) : with settings ( hide ( 'running' , 'stdout' ) ) : res = sudo ( ( "/sbin/ifconfig %(interface)s | grep 'inet6 ' || true" % locals ( ) ) ) ret = { } if ( res == '' ) : return ret lines = res . split ( '\n' ) for line in lines : if ( 'addr' in line ) : addr = res . split ( ) [ 2 ] else : addr = res . split ( ) [ 1 ] lower_line = line . lower ( ) addr_scope = 'unknown' for scope in [ 'host' , 'link' , 'global' ] : if ( scope in lower_line ) : addr_scope = scope ret [ addr_scope ] = addr return ret
get the ipv6 addresses assigned to an interface .