1
0
mirror of https://github.com/CumulusNetworks/ifupdown2.git synced 2024-05-06 15:54:50 +00:00

ifreload: --allow=class support

Ticket: CM-7939
Reviewed By: CCR-3732
Testing Done: Tested ifreload --allow=class
this now

The ifreload classes already supported allow. This just opens up the
option in /sbin/ifupdown

example 1:
---------
auto swp1
iface swp1

allow-test swp2
iface swp2

allow-test swp3
iface swp3

/* should only act on swp2 and swp3 */

example 2:
---------
auto swp1
iface swp1

allow-test swp2
iface swp2

allow-test br1
iface br1
	bridge-ports swp25 swp26

/* change  bridge name and do an ifreload */
auto swp1
iface swp1

allow-test swp2
iface swp2

allow-test br2
iface br2
	bridge-ports swp25 swp26

should delete br1 and create br2
This commit is contained in:
Roopa Prabhu
2015-11-13 10:06:16 -08:00
parent 641cbd1e7d
commit 1720c3921a

View File

@@ -142,7 +142,7 @@ def run_reload(args):
perfmode=args.perfmode)
ifupdown_handle.reload(['pre-up', 'up', 'post-up'],
['pre-down', 'down', 'post-down'],
auto=args.all, allow=None, ifacenames=None,
auto=args.all, allow=args.CLASS, ifacenames=None,
excludepats=args.excludepats,
usecurrentconfig=args.usecurrentconfig,
currentlyup=args.currentlyup)
@@ -339,6 +339,8 @@ def update_ifreload_argparser(argparser):
action='store_true',
help='only reload auto and other interfaces that are ' +
'currently up')
group.add_argument('--allow', dest='CLASS',
help='ignore non-\"allow-CLASS\" interfaces')
argparser.add_argument('iflist', metavar='IFACE',
nargs='*', help=argparse.SUPPRESS)
argparser.add_argument('-n', '--no-act', dest='noact',
@@ -413,8 +415,8 @@ def validate_args(op, args):
if op == 'query' and args.syntaxhelp:
return True
if op == 'reload':
if not args.all and not args.currentlyup:
print '\'-a\' or \'-c\' option is required'
if not args.all and not args.currentlyup and not args.CLASS:
print '\'-a\' or \'-c\' or \'-allow\' option is required'
return False
elif (not args.iflist and
not args.all and not args.CLASS):