mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-24 07:26:29 +00:00
Fallback values in a prettier way
This commit is contained in:
parent
83e1339145
commit
8b5bc77650
3 changed files with 4 additions and 12 deletions
|
@ -29,9 +29,7 @@ class GPTPartitionMap(AbstractPartitionMap):
|
|||
for partition in self.partitions:
|
||||
partition.create(volume)
|
||||
|
||||
boot_idx = self.root.get_index()
|
||||
if hasattr(self, 'boot'):
|
||||
boot_idx = self.boot.get_index()
|
||||
boot_idx = getattr(self, 'boot', self.root).get_index()
|
||||
log_check_call(['/sbin/parted', '--script', volume.device_path,
|
||||
'--', 'set ' + str(boot_idx) + ' boot on'])
|
||||
log_check_call(['/sbin/parted', '--script', volume.device_path,
|
||||
|
|
|
@ -32,8 +32,6 @@ class MBRPartitionMap(AbstractPartitionMap):
|
|||
for partition in self.partitions:
|
||||
partition.create(volume)
|
||||
|
||||
boot_idx = self.root.get_index()
|
||||
if hasattr(self, 'boot'):
|
||||
boot_idx = self.boot.get_index()
|
||||
boot_idx = getattr(self, 'boot', self.root).get_index()
|
||||
log_check_call(['/sbin/parted', '--script', volume.device_path,
|
||||
'--', 'set ' + str(boot_idx) + ' boot on'])
|
||||
|
|
|
@ -10,14 +10,10 @@ class PackageList(object):
|
|||
self.local = set()
|
||||
if 'remote' in data:
|
||||
for package in data['remote']:
|
||||
target = None
|
||||
if isinstance(package, dict):
|
||||
name = package['name']
|
||||
if 'target' in package:
|
||||
target = package['target']
|
||||
self.add(package['name'], package.get('target', None))
|
||||
else:
|
||||
name = package
|
||||
self.add(name, target)
|
||||
self.add(package, None)
|
||||
if 'local' in data:
|
||||
for package_path in data['local']:
|
||||
self.local.add(package_path)
|
||||
|
|
Loading…
Add table
Reference in a new issue