diff --git a/image_creator/dialog_main.py b/image_creator/dialog_main.py index 1aadf11f93ef4f60e780f91057836d7068c35ae6..ffeca46159a4d119fd40ce3066397339ba5750d7 100644 --- a/image_creator/dialog_main.py +++ b/image_creator/dialog_main.py @@ -50,7 +50,7 @@ def create_image(d, media, out, tmp, snapshot): d.setBackgroundTitle('snf-image-creator') gauge = GaugeOutput(d, "Initialization", "Initializing...") - out.add(gauge) + out.append(gauge) disk = Disk(media, out, tmp) def signal_handler(signum, frame): diff --git a/image_creator/dialog_menu.py b/image_creator/dialog_menu.py index c38e2a882a2a70b6ca5d6fbf50a6731eeb3f5fe1..0f969d4922b05e7b3b68f65e3e82a0c902f5d608 100644 --- a/image_creator/dialog_menu.py +++ b/image_creator/dialog_menu.py @@ -144,7 +144,7 @@ def upload_image(session): gauge = GaugeOutput(d, "Image Upload", "Uploading ...") try: out = image.out - out.add(gauge) + out.append(gauge) kamaki.out = out try: if 'checksum' not in session: @@ -243,7 +243,7 @@ def register_image(session): gauge = GaugeOutput(d, "Image Registration", "Registering image ...") try: out = session['image'].out - out.add(gauge) + out.append(gauge) try: try: out.output("Registering %s image with the cloud ..." % @@ -789,7 +789,7 @@ def install_virtio_drivers(session): title = "VirtIO Drivers Installation" infobox = InfoBoxOutput(d, title) try: - image.out.add(infobox) + image.out.append(infobox) try: image.os.install_virtio_drivers() infobox.finalize() @@ -876,7 +876,7 @@ def sysprep(session): infobox = InfoBoxOutput(d, "Image Configuration") try: - image.out.add(infobox) + image.out.append(infobox) try: # The checksum is invalid. We have mounted the image rw if 'checksum' in session: diff --git a/image_creator/dialog_util.py b/image_creator/dialog_util.py index e85f84c90e136a1e2ab6d9ffb8dfa6b86c508145..42cebf74897dcf2e34e27b050d6ea39d7f2161aa 100644 --- a/image_creator/dialog_util.py +++ b/image_creator/dialog_util.py @@ -194,7 +194,7 @@ def extract_image(session): try: image = session['image'] out = image.out - out.add(gauge) + out.append(gauge) try: if "checksum" not in session: session['checksum'] = image.md5() diff --git a/image_creator/dialog_wizard.py b/image_creator/dialog_wizard.py index 0b047d1aa7f3465e287e63b6a556f9f71e83e945..c5f514ea95558963e1ba9546f148d2ad13cc0e3f 100644 --- a/image_creator/dialog_wizard.py +++ b/image_creator/dialog_wizard.py @@ -445,7 +445,7 @@ def create_image(session, answers): image = session['image'] with_progress = OutputWthProgress(True) - image.out.add(with_progress) + image.out.append(with_progress) try: image.out.clear() diff --git a/image_creator/output/composite.py b/image_creator/output/composite.py index 51e19967c7a565047e6b926367be882a979333f1..0d2b94197cc70c59d3ec60b55b77964568459a88 100644 --- a/image_creator/output/composite.py +++ b/image_creator/output/composite.py @@ -20,7 +20,7 @@ from image_creator.output import Output -class CompositeOutput(Output): +class CompositeOutput(Output, list): """This class can be used to composite different outputs into a single one You may create an instance of this class and then add other output @@ -31,44 +31,36 @@ class CompositeOutput(Output): def __init__(self, outputs=[]): """Add initial output instances""" - self._outputs = outputs - - def add(self, output): - """Add another output instance""" - self._outputs.append(output) - - def remove(self, output): - """Remove an output instance""" - self._outputs.remove(output) + self.extend(outputs) def error(self, msg, new_line=True): """Call the error method of each of the output instances""" - for out in self._outputs: + for out in self: out.error(msg, new_line) def warn(self, msg, new_line=True): """Call the warn method of each of the output instances""" - for out in self._outputs: + for out in self: out.warn(msg, new_line) def success(self, msg, new_line=True): """Call the success method of each of the output instances""" - for out in self._outputs: + for out in self: out.success(msg, new_line) def output(self, msg='', new_line=True): """Call the output method of each of the output instances""" - for out in self._outputs: + for out in self: out.output(msg, new_line) def cleanup(self): """Call the cleanup method of each of the output instances""" - for out in self._outputs: + for out in self: out.cleanup() def clear(self): """Call the clear method of each of the output instances""" - for out in self._outputs: + for out in self: out.clear() class _Progress(object): @@ -77,7 +69,7 @@ class CompositeOutput(Output): def __init__(self, size, title, bar_type='default'): """Create a progress on each of the added output instances""" self._progresses = [] - for out in self.parent._outputs: + for out in self.parent: self._progresses.append(out.Progress(size, title, bar_type)) def goto(self, dest):