mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-24 07:26:29 +00:00
Better error message on task order errors
This commit is contained in:
parent
04b879a53c
commit
7318240f59
3 changed files with 15 additions and 17 deletions
|
@ -1,7 +1,8 @@
|
||||||
|
|
||||||
|
|
||||||
class Phase(object):
|
class Phase(object):
|
||||||
def __init__(self, description):
|
def __init__(self, name, description):
|
||||||
|
self.name = name
|
||||||
self.description = description
|
self.description = description
|
||||||
|
|
||||||
def pos(self):
|
def pos(self):
|
||||||
|
@ -12,7 +13,4 @@ class Phase(object):
|
||||||
return self.pos() - other.pos()
|
return self.pos() - other.pos()
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return '{name}'.format(name=self.__class__.__name__)
|
return self.name
|
||||||
|
|
||||||
def __repr__(self):
|
|
||||||
return self.__str__()
|
|
||||||
|
|
|
@ -21,12 +21,12 @@ class Task(object):
|
||||||
for task in self.before:
|
for task in self.before:
|
||||||
if self.phase > task.phase:
|
if self.phase > task.phase:
|
||||||
msg = ("The task {self} is specified as running before {other}, "
|
msg = ("The task {self} is specified as running before {other}, "
|
||||||
"but its phase {phase} lies after the phase {other_phase}"
|
"but its phase '{phase}' lies after the phase '{other_phase}'"
|
||||||
.format(self=type(self), other=task, phase=self.phase, other_phase=task.phase))
|
.format(self=type(self), other=task, phase=self.phase, other_phase=task.phase))
|
||||||
raise TaskListError(msg)
|
raise TaskListError(msg)
|
||||||
for task in self.after:
|
for task in self.after:
|
||||||
if self.phase < task.phase:
|
if self.phase < task.phase:
|
||||||
msg = ("The task {self} is specified as running after {other}, "
|
msg = ("The task {self} is specified as running after {other}, "
|
||||||
"but its phase {phase} lies before the phase {other_phase}"
|
"but its phase '{phase}' lies before the phase '{other_phase}'"
|
||||||
.format(self=type(self), other=task, phase=self.phase, other_phase=task.phase))
|
.format(self=type(self), other=task, phase=self.phase, other_phase=task.phase))
|
||||||
raise TaskListError(msg)
|
raise TaskListError(msg)
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
from base import Phase
|
from base import Phase
|
||||||
|
|
||||||
preparation = Phase('Initializing connections, fetching data etc.')
|
preparation = Phase('Preparation', 'Initializing connections, fetching data etc.')
|
||||||
volume_creation = Phase('Creating the volume to bootstrap onto')
|
volume_creation = Phase('Volume creation', 'Creating the volume to bootstrap onto')
|
||||||
volume_preparation = Phase('Formatting the bootstrap volume')
|
volume_preparation = Phase('Volume preparation', 'Formatting the bootstrap volume')
|
||||||
volume_mounting = Phase('Mounting bootstrap volume')
|
volume_mounting = Phase('Volume mounting', 'Mounting bootstrap volume')
|
||||||
os_installation = Phase('Installing the operating system')
|
os_installation = Phase('OS installation', 'Installing the operating system')
|
||||||
system_modification = Phase('Installing software, modifying configuration files etc.')
|
system_modification = Phase('System modification', 'Installing software, modifying configuration files etc.')
|
||||||
system_cleaning = Phase('Removing sensitive data, temporary files and other leftovers')
|
system_cleaning = Phase('System cleaning', 'Removing sensitive data, temporary files and other leftovers')
|
||||||
volume_unmounting = Phase('Unmounting the bootstrap volume')
|
volume_unmounting = Phase('Volume unmounting', 'Unmounting the bootstrap volume')
|
||||||
image_registration = Phase('Uploading/Registering with the provider')
|
image_registration = Phase('Image registration', 'Uploading/Registering with the provider')
|
||||||
cleaning = Phase('Removing temporary files')
|
cleaning = Phase('Cleaning', 'Removing temporary files')
|
||||||
|
|
||||||
order = [preparation,
|
order = [preparation,
|
||||||
volume_creation,
|
volume_creation,
|
||||||
|
|
Loading…
Add table
Reference in a new issue