setup disk: fix padding

ogServer expects a 4-partition setup. When specifying less than that,
the partition setup needs to be padded with EMPTY partitions.

Fixes a bug in which this padding is not valid.
master v0.1
Jose M. Guisado 2022-05-17 11:40:07 +02:00
parent b765ee50d3
commit e7b302c8b8
1 changed files with 2 additions and 1 deletions

View File

@ -134,8 +134,9 @@ class OgDisk():
'format': do_format}
payload['partition_setup'].append(part)
last_partnum = int(parsed_args.part[-1][0][0])
# Pad with empty partitions if no 4th part was defined
for i in range(len(parsed_args.part)+1, 5):
for i in range(last_partnum + 1, 5):
part = {'partition': str(i), 'code':'EMPTY',
'filesystem': 'EMPTY', 'size': '0',
'format': '0'}