- call(self._render_config('route_add', dict(
- dev = device.name,
- net_addr = route.net_addr,
- prefix = route.prefix,
- gateway = route.gateway,
- )
+ try:
+ log.debug(u'IpHandler._write_config: adding %r', route)
+ call(self._render_config('route_add', dict(
+ dev = device.name,
+ net_addr = route.net_addr,
+ prefix = route.prefix,
+ gateway = route.gateway,
+ )), shell=True)
+ except ExecutionError, e:
+ log.debug(u'IpHandler._write_config: error adding -> %r', e)
+ if self.hops:
+ log.debug(u'IpHandler._write_config: we have hops: %r', self.hops)
+ try:
+ log.debug(u'IpHandler._write_config: flushing default route')
+ call('ip route del default', shell=True)
+ except ExecutionError, e:
+ log.debug(u'IpHandler._write_config: error adding -> %r', e)
+ try:
+ log.debug(u'IpHandler._write_config: configuring hops')
+ call(self._render_config('hop', dict(
+ hops = self.hops,
+ )