1
0
mirror of https://github.com/CumulusNetworks/ifupdown2.git synced 2024-05-06 15:54:50 +00:00
Julien Fortin 24d5192df2 addons: vlan: retry vlan creation if bridge_binding capability is missing
On older ubuntu version bridge_binding is not supported, we can't rely
on `ip link help` to detect this. We have manually check if the first
netlink request is rejected then retry with iproute2.

Signed-off-by: Julien Fortin <jfortin@nvidia.com>
2022-02-11 12:33:49 +01:00

50 lines
1.4 KiB
Python

# Copyright (C) 2017, 2018, 2019 Cumulus Networks, Inc. all rights reserved
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; version 2.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#
# https://www.gnu.org/licenses/gpl-2.0-standalone.html
#
# Author:
# Julien Fortin, julien@cumulusnetworks.com
#
# ifupdown2 custom exceptions
#
class Ifupdown2Exception(Exception):
pass
class ExitWithStatus(Ifupdown2Exception):
def __init__(self, status):
Ifupdown2Exception.__init__(self)
self.status = status
def get_status(self):
return self.status
class ExitWithStatusAndError(ExitWithStatus):
def __init__(self, status, message):
ExitWithStatus.__init__(self, status)
self.message = message
class RetryCMD(Ifupdown2Exception):
def __init__(self, cmd):
Ifupdown2Exception.__init__(self)
self.cmd = cmd