Skip to content

Commit

Permalink
Merge pull request #1 from Alphalink/allow_all_classes
Browse files Browse the repository at this point in the history
Add support to call ifupdown on all interfaces
  • Loading branch information
sohorx committed Jan 10, 2024
2 parents bff9eab + 1e4e089 commit a4bee3b
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions ifupdown2/ifupdown/argv.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,21 @@ def __call__(self, _parser, namespace, values, option_string=None):
help='interface list separated by spaces. ')
argparser.add_argument('-a', '--all', action='store_true',
help='process all interfaces (limited by --allow= filter)')
argparser.add_argument('--allow', dest='CLASS', action='append',
allow_group = argparser.add_mutually_exclusive_group(required=False)
allow_group.add_argument('--allow', dest='CLASS', action='append',
help='ignore non-"allow-CLASS" interfaces (default is [auto] when -a/--all else [])')
# For ifupdown compatibility, '--all' implies '--allow auto'. '--allow-all' parameter offers
# a way to have all interfaces without implicit filter.
allow_group.add_argument('--allow-all', action='store_true',
help='ensure non-"allow-CLASS" is set to []')

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

# Default filter scope is auto/allow-auto when -a/--all option is set
if self.args.all and not self.args.CLASS:
if self.args.allow_all:
self.args.CLASS = []
elif self.args.all and not self.args.CLASS:
# Default filter scope is auto/allow-auto when -a/--all option is set
self.args.CLASS = ['auto']

if self.args.iflist and self.args.all:
Expand Down

0 comments on commit a4bee3b

Please sign in to comment.