Skip to content

Commit a4bee3b

Browse files
authored
Merge pull request #1 from Alphalink/allow_all_classes
Add support to call ifupdown on all interfaces
2 parents bff9eab + 1e4e089 commit a4bee3b

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

ifupdown2/ifupdown/argv.py

+10-3
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,21 @@ def __call__(self, _parser, namespace, values, option_string=None):
142142
help='interface list separated by spaces. ')
143143
argparser.add_argument('-a', '--all', action='store_true',
144144
help='process all interfaces (limited by --allow= filter)')
145-
argparser.add_argument('--allow', dest='CLASS', action='append',
145+
allow_group = argparser.add_mutually_exclusive_group(required=False)
146+
allow_group.add_argument('--allow', dest='CLASS', action='append',
146147
help='ignore non-"allow-CLASS" interfaces (default is [auto] when -a/--all else [])')
148+
# For ifupdown compatibility, '--all' implies '--allow auto'. '--allow-all' parameter offers
149+
# a way to have all interfaces without implicit filter.
150+
allow_group.add_argument('--allow-all', action='store_true',
151+
help='ensure non-"allow-CLASS" is set to []')
147152

148153
def argparser_interfaces_selection_post_validate(self):
149154
""" Set and validate interfaces selection options """
150155

151-
# Default filter scope is auto/allow-auto when -a/--all option is set
152-
if self.args.all and not self.args.CLASS:
156+
if self.args.allow_all:
157+
self.args.CLASS = []
158+
elif self.args.all and not self.args.CLASS:
159+
# Default filter scope is auto/allow-auto when -a/--all option is set
153160
self.args.CLASS = ['auto']
154161

155162
if self.args.iflist and self.args.all:

0 commit comments

Comments
 (0)