Skip to content

Commit 888b565

Browse files
authored
Merge pull request #2900 from OSInside/fix_repo_type_setup_from_cmdline
Fix repo type setup when set from cmdline
2 parents 2577806 + 146774d commit 888b565

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

kiwi/tasks/system_build.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,13 @@ def _get_repo_parameters(self, tokens, credentials):
371371
parameters = self.eleventuple_token(tokens)
372372
signing_keys_index = 6
373373
repo_source_index = 0
374+
repo_type_index = 1
375+
if not parameters[repo_type_index]:
376+
# make sure to pass a None value if an empty string
377+
# is provided as repo type. This will cause no type
378+
# attribute to be set instead of an empty type which
379+
# is not allowed by the schema
380+
parameters[repo_type_index] = None
374381
if not parameters[signing_keys_index]:
375382
# make sure to pass empty list for signing_keys param
376383
parameters[signing_keys_index] = []

test/unit/tasks/system_build_test.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,8 @@ def test_process_system_build_prepare_stage_add_repo(
368368
self.task.command_args['--add-repo'] = [
369369
'http://example1.com,yast2,alias,99,false,true',
370370
'http://example2.com,yast2,alias,99,false,true',
371-
'http://example3.com,yast2,alias,99,false,true'
371+
'http://example3.com,yast2,alias,99,false,true',
372+
'http://example4.com,,alias,99,false,true'
372373
]
373374
self.task.process()
374375
assert mock_add_repo.call_args_list == [
@@ -383,6 +384,10 @@ def test_process_system_build_prepare_stage_add_repo(
383384
call(
384385
'http://example3.com', 'yast2', 'alias', '99',
385386
False, True, [], None, None, None, None
387+
),
388+
call(
389+
'http://example4.com', None, 'alias', '99',
390+
False, True, [], None, None, None, None
386391
)
387392
]
388393
self.task.command_args['--add-repo-credentials'] = [
@@ -403,6 +408,10 @@ def test_process_system_build_prepare_stage_add_repo(
403408
call(
404409
'http://example3.com', 'yast2', 'alias', '99',
405410
False, True, [], None, None, None, None
411+
),
412+
call(
413+
'http://example4.com', None, 'alias', '99',
414+
False, True, [], None, None, None, None
406415
)
407416
]
408417

0 commit comments

Comments
 (0)