def delete_net_dev(dev): """Delete a network device only if it exists.""" if device_exists(dev): try: processutils.execute('sudo', 'ip', 'link', 'delete', dev, check_exit_code=[0, 2, 254]) LOG.debug("Net device removed: '%s'", dev) except processutils.ProcessExecutionError: with excutils.save_and_reraise_exception(): LOG.error(_LE("Failed removing net device: '%s'"), dev)
def delete_net_dev(dev): """Delete a network device only if it exists.""" if device_exists(dev): try: processutils.execute('sudo', 'ip', 'link', 'delete', dev, check_exit_code=[0, 2, 254]) LOG.debug("Net device removed: '%s'", dev) except processutils.ProcessExecutionError: with excutils.save_and_reraise_exception(): LOG.error(_LE("Failed removing net device: '%s'"), dev)
def coerce(obj, attr, value): if isinstance(value, six.string_types): newvalue = value.lower() if PCIAddress._REGEX.match(newvalue): return newvalue raise ValueError(_LE("Malformed PCI address %s"), value)