Skip to content

Commit 4bd9f91

Browse files
committed
fixup! Add new-style 2.0 command names for Airflow 1.10.x
1 parent 06f15f9 commit 4bd9f91

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

airflow/bin/cli.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4298,13 +4298,15 @@ class CLIFactory(object):
42984298
'args': (),
42994299
},
43004300
)
4301-
deprecated_subparsers_dict = {sp['func'].__name__: sp for sp in deprecated_subparsers}
43024301
deprecated_dag_subparsers = (
43034302
'list_tasks', 'backfill', 'test', 'run', 'pause', 'unpause', 'list_dag_runs')
43044303

43054304
@classmethod
43064305
def get_parser(cls, dag_parser=False):
43074306
"""Creates and returns command line argument parser"""
4307+
4308+
deprecated_subparsers_dict = {sp['func'].__name__: sp for sp in cls.deprecated_subparsers}
4309+
43084310
class DefaultHelpParser(argparse.ArgumentParser):
43094311
"""Override argparse.ArgumentParser.error and use print_help instead of print_usage"""
43104312
def error(self, message):
@@ -4321,9 +4323,9 @@ def error(self, message):
43214323
# Deprecated "mode select", and new sub-command version? Merge them
43224324
# so they both work, but don't show help for the deprecated
43234325
# options!
4324-
if sub_name in cls.deprecated_subparsers_dict and action is not None:
4326+
if sub_name in deprecated_subparsers_dict and action is not None:
43254327
sp, sub_subparsers = action
4326-
deprecated = cls.deprecated_subparsers_dict.pop(sub_name)
4328+
deprecated = deprecated_subparsers_dict.pop(sub_name)
43274329
sp.set_defaults(func=deprecated['func'])
43284330
sub_subparsers.required = False
43294331

@@ -4338,12 +4340,12 @@ def error(self, message):
43384340

43394341
if dag_parser:
43404342
subparser_list = [
4341-
(cls.deprecated_subparsers_dict[name], False)
4343+
(deprecated_subparsers_dict[name], False)
43424344
for name in cls.deprecated_dag_subparsers
43434345
]
43444346
else:
43454347
current = zip(cls.subparsers, itertools.repeat(False))
4346-
deprecated = zip(cls.deprecated_subparsers_dict.values(), itertools.repeat(True))
4348+
deprecated = zip(deprecated_subparsers_dict.values(), itertools.repeat(True))
43474349
subparser_list = itertools.chain(current, deprecated)
43484350
for (sub, hide_from_toplevel_help) in subparser_list:
43494351
if hide_from_toplevel_help and BUILD_DOCS:

0 commit comments

Comments
 (0)