From 1720c3921af9d3c70e87c81b098a7b0a56b4db4e Mon Sep 17 00:00:00 2001 From: Roopa Prabhu Date: Fri, 13 Nov 2015 10:06:16 -0800 Subject: [PATCH] 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 --- sbin/ifupdown | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sbin/ifupdown b/sbin/ifupdown index 8dd2757..e89c04b 100755 --- a/sbin/ifupdown +++ b/sbin/ifupdown @@ -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):