mirror of
https://github.com/systemd/systemd
synced 2024-09-06 08:46:19 +00:00
Merge pull request #28562 from yuwata/ukify-option-length
ukify: check option length
This commit is contained in:
commit
ae85704760
|
@ -144,6 +144,11 @@ def test_apply_config(tmp_path):
|
||||||
assert ns.phase_path_groups == [['enter-initrd:leave-initrd:sysinit:ready:shutdown:final']]
|
assert ns.phase_path_groups == [['enter-initrd:leave-initrd:sysinit:ready:shutdown:final']]
|
||||||
|
|
||||||
def test_parse_args_minimal():
|
def test_parse_args_minimal():
|
||||||
|
try:
|
||||||
|
ukify.parse_args([])
|
||||||
|
except ValueError as e:
|
||||||
|
print(f'expected failure: {e}')
|
||||||
|
|
||||||
opts = ukify.parse_args('arg1 arg2'.split())
|
opts = ukify.parse_args('arg1 arg2'.split())
|
||||||
assert opts.linux == pathlib.Path('arg1')
|
assert opts.linux == pathlib.Path('arg1')
|
||||||
assert opts.initrd == [pathlib.Path('arg2')]
|
assert opts.initrd == [pathlib.Path('arg2')]
|
||||||
|
|
|
@ -1484,7 +1484,7 @@ def finalize_options(opts):
|
||||||
# Figure out which syntax is being used, one of:
|
# Figure out which syntax is being used, one of:
|
||||||
# ukify verb --arg --arg --arg
|
# ukify verb --arg --arg --arg
|
||||||
# ukify linux initrd…
|
# ukify linux initrd…
|
||||||
if opts.positional[0] == 'inspect':
|
if len(opts.positional) >= 1 and opts.positional[0] == 'inspect':
|
||||||
opts.verb = opts.positional[0]
|
opts.verb = opts.positional[0]
|
||||||
opts.files = opts.positional[1:]
|
opts.files = opts.positional[1:]
|
||||||
if not opts.files:
|
if not opts.files:
|
||||||
|
|
Loading…
Reference in a new issue