diff options
author | RĂ©mi Duraffort <remi.duraffort@linaro.org> | 2018-04-03 11:03:38 +0200 |
---|---|---|
committer | Neil Williams <neil.williams@linaro.org> | 2018-04-25 09:31:22 +0100 |
commit | 2e84699d8e5c28f33c81fc102eb72f8b2cd3aecb (patch) | |
tree | a20b38486c8b8fd27330241299579c5d2f13a8ee | |
parent | e3b0974709cde794a279280b6287ce82f9080ac2 (diff) |
Port classes to python3 only
Change-Id: I8bc55876f82817533dfef42128aefea15c904311
88 files changed, 504 insertions, 516 deletions
diff --git a/doc/v2/development.rst b/doc/v2/development.rst index c51a7b266..4213331fa 100644 --- a/doc/v2/development.rst +++ b/doc/v2/development.rst @@ -301,9 +301,9 @@ service to be restarted. .. code-block:: python - super(ThisClass, self).validate() + super().validate() - connection = super(ThisClass, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) * When adding or modifying ``run`` functions in subclasses of ``Action``, **always** ensure that each return point out of the ``run`` function returns diff --git a/lava_dispatcher/actions/boot/__init__.py b/lava_dispatcher/actions/boot/__init__.py index 29b310bb1..466c5dcff 100644 --- a/lava_dispatcher/actions/boot/__init__.py +++ b/lava_dispatcher/actions/boot/__init__.py @@ -87,7 +87,7 @@ class SecondaryShell(Boot): compatibility = 6 def __init__(self, parent, parameters): - super(SecondaryShell, self).__init__(parent) + super().__init__(parent) self.action = SecondaryShellAction() self.action.section = self.action_type self.action.job = self.job @@ -143,7 +143,7 @@ class AutoLoginAction(Action): summary = "Auto-login after boot with support for kernel messages." def __init__(self): - super(AutoLoginAction, self).__init__() + super().__init__() self.check_prompt_characters_warning = ( "The string '%s' does not look like a typical prompt and" " could match status messages instead. Please check the" @@ -155,7 +155,7 @@ class AutoLoginAction(Action): self.booting = True # if a boot is expected, False for second UART or ssh. def validate(self): # pylint: disable=too-many-branches - super(AutoLoginAction, self).validate() + super().validate() # Skip auto login if the configuration is not found self.method = self.parameters['method'] params = self.parameters.get('auto_login', None) @@ -260,7 +260,7 @@ class AutoLoginAction(Action): if not any([True for c in DISTINCTIVE_PROMPT_CHARACTERS if c in chk_prompt]): self.logger.warning(self.check_prompt_characters_warning, chk_prompt) - connection = super(AutoLoginAction, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) if not connection: return connection prompts = self.parameters.get('prompts', None) @@ -374,7 +374,7 @@ class BootloaderCommandOverlay(Action): summary = "replace placeholders with job data" def __init__(self): - super(BootloaderCommandOverlay, self).__init__() + super().__init__() self.commands = None self.method = "" self.use_bootscript = False @@ -383,7 +383,7 @@ class BootloaderCommandOverlay(Action): self.ram_disk = None def validate(self): - super(BootloaderCommandOverlay, self).validate() + super().validate() self.method = self.parameters['method'] device_methods = self.job.device['actions']['boot']['methods'] if isinstance(self.parameters['commands'], list): @@ -417,7 +417,7 @@ class BootloaderCommandOverlay(Action): """ # Multiple deployments would overwrite the value if parsed in the validate step. # FIXME: implement isolation for repeated steps. - connection = super(BootloaderCommandOverlay, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) ip_addr = dispatcher_ip(self.job.parameters['dispatcher']) self.ram_disk = self.get_namespace_data(action='compress-ramdisk', label='file', key='ramdisk') @@ -520,7 +520,7 @@ class BootloaderSecondaryMedia(Action): summary = "set bootloader strings for deployed media" def validate(self): - super(BootloaderSecondaryMedia, self).validate() + super().validate() if 'media' not in self.job.device.get('parameters', []): return media_keys = self.job.device['parameters']['media'].keys() @@ -557,7 +557,7 @@ class OverlayUnpack(Action): summary = 'transfer and unpack overlay' def validate(self): - super(OverlayUnpack, self).validate() + super().validate() if 'transfer_overlay' not in self.parameters: self.errors = "Unable to identify transfer commands for overlay." return @@ -567,7 +567,7 @@ class OverlayUnpack(Action): self.errors = "Unable to identify unpack command for overlay." def run(self, connection, max_end_time, args=None): - connection = super(OverlayUnpack, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) if not connection: raise LAVABug("Cannot transfer overlay, no connection available.") ip_addr = dispatcher_ip(self.job.parameters['dispatcher']) @@ -597,13 +597,13 @@ class BootloaderInterruptAction(Action): timeout_exception = InfrastructureError def __init__(self): - super(BootloaderInterruptAction, self).__init__() + super().__init__() self.params = {} self.method = None self.needs_interrupt = False def validate(self): - super(BootloaderInterruptAction, self).validate() + super().validate() # 'to' only exists in deploy, this action can be used in boot too. if self.parameters.get('to', "") == 'fastboot' or self.parameters.get('method', "") == 'fastboot': if self.job.device.get('fastboot_via_uboot', False): @@ -632,7 +632,7 @@ class BootloaderInterruptAction(Action): def run(self, connection, max_end_time, args=None): if not connection: raise LAVABug("%s started without a connection already in use" % self.name) - connection = super(BootloaderInterruptAction, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) if self.needs_interrupt: connection.prompt_str = self.interrupt_prompt self.wait(connection) @@ -660,14 +660,14 @@ class BootloaderCommandsAction(Action): timeout_exception = InfrastructureError def __init__(self, expect_final=True): - super(BootloaderCommandsAction, self).__init__() + super().__init__() self.params = None self.timeout = Timeout(self.name, BOOTLOADER_DEFAULT_CMD_TIMEOUT) self.method = "" self.expect_final = expect_final def validate(self): - super(BootloaderCommandsAction, self).validate() + super().validate() self.method = self.parameters['method'] self.params = self.job.device['actions']['boot']['methods'][self.method]['parameters'] @@ -677,7 +677,7 @@ class BootloaderCommandsAction(Action): def run(self, connection, max_end_time, args=None): if not connection: self.errors = "%s started without a connection already in use" % self.name - connection = super(BootloaderCommandsAction, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) connection.raw_connection.linesep = self.line_separator() connection.prompt_str = [self.params['bootloader_prompt']] at_bootloader_prompt = self.get_namespace_data(action='interrupt', label='interrupt', key='at_bootloader_prompt') diff --git a/lava_dispatcher/actions/boot/cmsis_dap.py b/lava_dispatcher/actions/boot/cmsis_dap.py index 918ae82a1..5be3f848d 100644 --- a/lava_dispatcher/actions/boot/cmsis_dap.py +++ b/lava_dispatcher/actions/boot/cmsis_dap.py @@ -38,7 +38,7 @@ class CMSIS(Boot): compatibility = 4 # FIXME: change this to 5 and update test cases def __init__(self, parent, parameters): - super(CMSIS, self).__init__(parent) + super().__init__(parent) self.action = BootCMSIS() self.action.section = self.action_type self.action.job = self.job @@ -79,7 +79,7 @@ class BootCMSISRetry(RetryAction): summary = "boot cmsis usb image with retry" def validate(self): - super(BootCMSISRetry, self).validate() + super().validate() method_params = self.job.device['actions']['boot']['methods']['cmsis-dap']['parameters'] usb_mass_device = method_params.get('usb_mass_device', None) if not usb_mass_device: @@ -106,12 +106,12 @@ class FlashCMSISAction(Action): summary = "flash cmsis to usb mass storage" def __init__(self): - super(FlashCMSISAction, self).__init__() + super().__init__() self.filelist = [] self.usb_mass_device = None def validate(self): - super(FlashCMSISAction, self).validate() + super().validate() if self.job.device['board_id'] == '0000000000': self.errors = "board_id unset" method_parameters = self.job.device['actions']['boot']['methods']['cmsis-dap']['parameters'] @@ -124,7 +124,7 @@ class FlashCMSISAction(Action): self.filelist.extend([action_arg]) def run(self, connection, max_end_time, args=None): - connection = super(FlashCMSISAction, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) dstdir = mkdtemp() mount_command = "mount -t vfat %s %s" % (self.usb_mass_device, dstdir) self.run_command(mount_command.split(' '), allow_silent=True) diff --git a/lava_dispatcher/actions/boot/depthcharge.py b/lava_dispatcher/actions/boot/depthcharge.py index cfc52c9f3..ddae0f7dc 100644 --- a/lava_dispatcher/actions/boot/depthcharge.py +++ b/lava_dispatcher/actions/boot/depthcharge.py @@ -52,7 +52,7 @@ class Depthcharge(Boot): device tree blob, and the other contains the kernel arguments. """ def __init__(self, parent, parameters): - super(Depthcharge, self).__init__(parent) + super().__init__(parent) self.action = DepthchargeAction() self.action.section = self.action_type self.action.job = self.job @@ -81,11 +81,11 @@ class DepthchargeCommandOverlay(BootloaderCommandOverlay): name = "depthcharge-overlay" def __init__(self): - super(DepthchargeCommandOverlay, self).__init__() + super().__init__() self.cmdline = None def validate(self): - super(DepthchargeCommandOverlay, self).validate() + super().validate() method = self.job.device['actions']['boot']['methods'][self.method] commands_name = self.parameters['commands'] method_params = method[commands_name] @@ -94,8 +94,7 @@ class DepthchargeCommandOverlay(BootloaderCommandOverlay): self.errors = "No cmdline found in {}".format(commands_name) def run(self, connection, max_end_time, args=None): - connection = super(DepthchargeCommandOverlay, self).run( - connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) # Create the cmdline file, this is not set by any bootloader command ip_addr = dispatcher_ip(self.job.parameters['dispatcher']) @@ -187,8 +186,7 @@ class DepthchargeRetry(BootAction): self.internal_pipeline.add_action(ExportDeviceEnvironment()) def run(self, connection, max_end_time, args=None): - connection = super(DepthchargeRetry, self).run( - connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) self.set_namespace_data( action='shared', label='shared', key='connection', value=connection) return connection @@ -204,11 +202,11 @@ class DepthchargeStart(Action): summary = "Depthcharge start" def __init__(self): - super(DepthchargeStart, self).__init__() + super().__init__() self.start_message = None def validate(self): - super(DepthchargeStart, self).validate() + super().validate() if self.job.device.connect_command == '': self.errors = "Unable to connect to device" method = self.job.device['actions']['boot']['methods']['depthcharge'] @@ -217,8 +215,7 @@ class DepthchargeStart(Action): self.errors = "Missing Depthcharge start message for device" def run(self, connection, max_end_time, args=None): - connection = super(DepthchargeStart, self).run( - connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) connection.prompt_str = self.start_message self.logger.debug("Changing prompt to '%s'", connection.prompt_str) self.wait(connection) diff --git a/lava_dispatcher/actions/boot/dfu.py b/lava_dispatcher/actions/boot/dfu.py index 71c21acd3..da8efa784 100644 --- a/lava_dispatcher/actions/boot/dfu.py +++ b/lava_dispatcher/actions/boot/dfu.py @@ -38,7 +38,7 @@ class DFU(Boot): compatibility = 4 # FIXME: change this to 5 and update test cases def __init__(self, parent, parameters): - super(DFU, self).__init__(parent) + super().__init__(parent) self.action = BootDFU() self.action.section = self.action_type self.action.job = self.job @@ -89,7 +89,7 @@ class FlashDFUAction(Action): summary = "use dfu to flash the images" def __init__(self): - super(FlashDFUAction, self).__init__() + super().__init__() self.base_command = [] self.exec_list = [] self.board_id = '0000000000' @@ -97,7 +97,7 @@ class FlashDFUAction(Action): self.usb_product_id = '0000' def validate(self): - super(FlashDFUAction, self).validate() + super().validate() try: boot = self.job.device['actions']['boot']['methods']['dfu'] dfu_binary = which(boot['parameters']['command']) @@ -138,7 +138,7 @@ class FlashDFUAction(Action): self.errors = "No DFU command to execute" def run(self, connection, max_end_time, args=None): - connection = super(FlashDFUAction, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) count = 1 for dfu_command in self.exec_list: if count == (len(self.exec_list)): diff --git a/lava_dispatcher/actions/boot/docker.py b/lava_dispatcher/actions/boot/docker.py index b5e096b10..0f9ee007d 100644 --- a/lava_dispatcher/actions/boot/docker.py +++ b/lava_dispatcher/actions/boot/docker.py @@ -38,7 +38,7 @@ class BootDocker(Boot): compatibility = 4 def __init__(self, parent, parameters): - super(BootDocker, self).__init__(parent) + super().__init__(parent) self.action = BootDockerAction() self.action.section = self.action_type self.action.job = self.job @@ -86,12 +86,12 @@ class CallDockerAction(Action): summary = "call docker run" def __init__(self): - super(CallDockerAction, self).__init__() + super().__init__() self.cleanup_required = False self.extra_options = '' def validate(self): - super(CallDockerAction, self).validate() + super().validate() self.container = "lava-%s-%s" % (self.job.job_id, self.level) options = self.job.device['actions']['boot']['methods']['docker']['options'] @@ -123,13 +123,13 @@ class CallDockerAction(Action): self.cleanup_required = True shell_connection = ShellSession(self.job, shell) - shell_connection = super(CallDockerAction, self).run(shell_connection, max_end_time, args) + shell_connection = super().run(shell_connection, max_end_time, args) self.set_namespace_data(action='shared', label='shared', key='connection', value=shell_connection) return shell_connection def cleanup(self, connection): - super(CallDockerAction, self).cleanup(connection) + super().cleanup(connection) if self.cleanup_required: self.logger.debug("Stopping container %s", self.container) self.run_command(["docker", "stop", self.container], allow_fail=True) diff --git a/lava_dispatcher/actions/boot/environment.py b/lava_dispatcher/actions/boot/environment.py index 2d1447140..ebc9bf55e 100644 --- a/lava_dispatcher/actions/boot/environment.py +++ b/lava_dispatcher/actions/boot/environment.py @@ -31,11 +31,11 @@ class ExportDeviceEnvironment(Action): summary = "Exports environment variables action" def __init__(self): - super(ExportDeviceEnvironment, self).__init__() + super().__init__() self.env = [] def validate(self): - super(ExportDeviceEnvironment, self).validate() + super().validate() shell_file = self.get_namespace_data(action='deploy-device-env', label='environment', key='shell_file') environment = self.get_namespace_data(action='deploy-device-env', @@ -53,7 +53,7 @@ class ExportDeviceEnvironment(Action): if not connection: return - connection = super(ExportDeviceEnvironment, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) shell_file = self.get_namespace_data( action='deploy-device-env', diff --git a/lava_dispatcher/actions/boot/fastboot.py b/lava_dispatcher/actions/boot/fastboot.py index 94a4b1014..e19b03d77 100644 --- a/lava_dispatcher/actions/boot/fastboot.py +++ b/lava_dispatcher/actions/boot/fastboot.py @@ -61,7 +61,7 @@ class BootFastboot(Boot): compatibility = 1 def __init__(self, parent, parameters): - super(BootFastboot, self).__init__(parent) + super().__init__(parent) self.action = BootFastbootAction() self.action.section = self.action_type self.action.job = self.job @@ -85,7 +85,7 @@ class BootFastbootAction(BootAction): summary = "fastboot boot" def validate(self): - super(BootFastbootAction, self).validate() + super().validate() sequences = self.job.device['actions']['boot']['methods'].get( 'fastboot', []) if sequences is not None: @@ -143,13 +143,13 @@ class WaitFastBootInterrupt(Action): summary = "watch output and try to interrupt fastboot" def __init__(self, type): - super(WaitFastBootInterrupt, self).__init__() + super().__init__() self.type = type self.prompt = None self.string = None def validate(self): - super(WaitFastBootInterrupt, self).validate() + super().validate() if 'fastboot_serial_number' not in self.job.device: self.errors = "device fastboot serial number missing" elif self.job.device['fastboot_serial_number'] == '0000000000': @@ -168,7 +168,7 @@ class WaitFastBootInterrupt(Action): def run(self, connection, max_end_time, args=None): if not connection: raise LAVABug("%s started without a connection already in use" % self.name) - connection = super(WaitFastBootInterrupt, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) # device is to be put into a reset state, either by issuing 'reboot' or power-cycle connection.prompt_str = self.prompt self.logger.debug("Changing prompt to '%s'", connection.prompt_str) @@ -188,7 +188,7 @@ class FastbootBootAction(Action): summary = "attempt to fastboot boot" def validate(self): - super(FastbootBootAction, self).validate() + super().validate() if 'fastboot_serial_number' not in self.job.device: self.errors = "device fastboot serial number missing" elif self.job.device['fastboot_serial_number'] == '0000000000': @@ -199,7 +199,7 @@ class FastbootBootAction(Action): self.errors = "device fastboot options is not a list" def run(self, connection, max_end_time, args=None): - connection = super(FastbootBootAction, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) # this is the device namespace - the lxc namespace is not accessible lxc_name = None protocol = [protocol for protocol in self.job.protocols if protocol.name == LxcProtocol.name][0] @@ -246,7 +246,7 @@ class FastbootRebootAction(Action): summary = "attempt to fastboot reboot" def validate(self): - super(FastbootRebootAction, self).validate() + super().validate() if 'fastboot_serial_number' not in self.job.device: self.errors = "device fastboot serial number missing" elif self.job.device['fastboot_serial_number'] == '0000000000': @@ -257,7 +257,7 @@ class FastbootRebootAction(Action): self.errors = "device fastboot options is not a list" def run(self, connection, max_end_time, args=None): - connection = super(FastbootRebootAction, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) # this is the device namespace - the lxc namespace is not accessible lxc_name = None protocol = [protocol for protocol in self.job.protocols if protocol.name == LxcProtocol.name][0] @@ -292,7 +292,7 @@ class EnterFastbootAction(Action): summary = "enter fastboot" def validate(self): - super(EnterFastbootAction, self).validate() + super().validate() if 'adb_serial_number' not in self.job.device: self.errors = "device adb serial number missing" elif self.job.device['adb_serial_number'] == '0000000000': @@ -307,7 +307,7 @@ class EnterFastbootAction(Action): self.errors = "device fastboot options is not a list" def run(self, connection, max_end_time, args=None): - connection = super(EnterFastbootAction, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) # this is the device namespace - the lxc namespace is not accessible lxc_name = None protocol = [protocol for protocol in self.job.protocols if protocol.name == LxcProtocol.name][0] diff --git a/lava_dispatcher/actions/boot/grub.py b/lava_dispatcher/actions/boot/grub.py index 762e78209..eebeea208 100644 --- a/lava_dispatcher/actions/boot/grub.py +++ b/lava_dispatcher/actions/boot/grub.py @@ -55,7 +55,7 @@ class GrubSequence(Boot): compatibility = 3 def __init__(self, parent, parameters): - super(GrubSequence, self).__init__(parent) + super().__init__(parent) self.action = GrubSequenceAction() self.action.section = self.action_type self.action.job = self.job @@ -88,7 +88,7 @@ class Grub(Boot): compatibility = 3 def __init__(self, parent, parameters): - super(Grub, self).__init__(parent) + super().__init__(parent) self.action = GrubMainAction() self.action.section = self.action_type self.action.job = self.job @@ -133,11 +133,11 @@ class GrubSequenceAction(BootAction): summary = "run grub boot using specified sequence of actions" def __init__(self): - super(GrubSequenceAction, self).__init__() + super().__init__() self.expect_shell = False def validate(self): - super(GrubSequenceAction, self).validate() + super().validate() sequences = self.job.device['actions']['boot']['methods']['grub'].get( 'sequence', []) for sequence in sequences: @@ -145,7 +145,7 @@ class GrubSequenceAction(BootAction): self.errors = "Unknown boot sequence '%s'" % sequence def populate(self, parameters): - super(GrubSequenceAction, self).populate(parameters) + super().populate(parameters) self.internal_pipeline = Pipeline(parent=self, job=self.job, parameters=parameters) sequences = self.job.device['actions']['boot']['methods']['grub'].get( @@ -178,7 +178,7 @@ class GrubMainAction(BootAction): summary = "run grub boot from power to system" def __init__(self): - super(GrubMainAction, self).__init__() + super().__init__() self.expect_shell = True def populate(self, parameters): @@ -214,7 +214,7 @@ class GrubMainAction(BootAction): self.internal_pipeline.add_action(PowerOff()) def run(self, connection, max_end_time, args=None): - connection = super(GrubMainAction, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) self.set_namespace_data(action='shared', label='shared', key='connection', value=connection) return connection @@ -226,7 +226,7 @@ class GrubMenuSelector(UefiMenuSelector): # pylint: disable=too-many-instance-a summary = 'select grub options in the efi menu' def __init__(self): - super(GrubMenuSelector, self).__init__() + super().__init__() self.selector.prompt = "Start:" self.commands = [] self.boot_message = None @@ -241,7 +241,7 @@ class GrubMenuSelector(UefiMenuSelector): # pylint: disable=too-many-instance-a self.errors = "Missing entry for menu item to use for %s" % self.method_name return self.commands = self.params['menu_options'] - super(GrubMenuSelector, self).validate() + super().validate() def run(self, connection, max_end_time, args=None): # Needs to get the interrupt_prompt from the bootloader device config @@ -251,7 +251,7 @@ class GrubMenuSelector(UefiMenuSelector): # pylint: disable=too-many-instance-a connection.prompt_str = interrupt_prompt # override base class behaviour to interact with grub. self.boot_message = None - connection = super(GrubMenuSelector, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) return connection @@ -265,16 +265,16 @@ class InstallerWait(Action): summary = "wait for task to finish match arbitrary string" def __init__(self): - super(InstallerWait, self).__init__() + super().__init__() self.type = "grub" def validate(self): - super(InstallerWait, self).validate() + super().validate() if "boot_finished" not in self.parameters: self.errors = "Missing boot_finished string" def run(self, connection, max_end_time, args=None): - connection = super(InstallerWait, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) wait_string = self.parameters['boot_finished'] msg = wait_string if isinstance(wait_string, str) else ', '.join(wait_string) self.logger.debug("Not expecting a shell, so waiting for boot_finished: %s", msg) diff --git a/lava_dispatcher/actions/boot/ipxe.py b/lava_dispatcher/actions/boot/ipxe.py index 4299beab6..7a173e69c 100644 --- a/lava_dispatcher/actions/boot/ipxe.py +++ b/lava_dispatcher/actions/boot/ipxe.py @@ -53,7 +53,7 @@ class IPXE(Boot): compatibility = 1 def __init__(self, parent, parameters): - super(IPXE, self).__init__(parent) + super().__init__(parent) self.action = BootloaderAction() self.action.section = self.action_type self.action.job = self.job @@ -94,7 +94,7 @@ class BootloaderRetry(BootAction): summary = "uboot commands with retry" def __init__(self): - super(BootloaderRetry, self).__init__() + super().__init__() self.type = "ipxe" self.force_prompt = False @@ -114,7 +114,7 @@ class BootloaderRetry(BootAction): self.internal_pipeline.add_action(ExportDeviceEnvironment()) def validate(self): - super(BootloaderRetry, self).validate() + super().validate() if 'bootloader_prompt' not in self.job.device['actions']['boot']['methods'][self.type]['parameters']: self.errors = "Missing bootloader prompt for device" self.set_namespace_data( @@ -125,6 +125,6 @@ class BootloaderRetry(BootAction): ) def run(self, connection, max_end_time, args=None): - connection = super(BootloaderRetry, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) self.set_namespace_data(action='shared', label='shared', key='connection', value=connection) return connection diff --git a/lava_dispatcher/actions/boot/iso.py b/lava_dispatcher/actions/boot/iso.py index fc7b6285c..453937e12 100644 --- a/lava_dispatcher/actions/boot/iso.py +++ b/lava_dispatcher/actions/boot/iso.py @@ -45,7 +45,7 @@ class BootIsoInstaller(Boot): compatibility = 3 def __init__(self, parent, parameters): - super(BootIsoInstaller, self).__init__(parent) + super().__init__(parent) self.action = BootIsoInstallerAction() self.action.section = self.action_type self.action.job = self.job @@ -122,7 +122,7 @@ class IsoCommandLine(Action): # pylint: disable=too-many-instance-attributes shell_connection = ShellSession(self.job, shell) shell_connection.prompt_str = self.get_namespace_data( action='prepare-qemu-commands', label='prepare-qemu-commands', key='prompts') - shell_connection = super(IsoCommandLine, self).run(shell_connection, max_end_time, args) + shell_connection = super().run(shell_connection, max_end_time, args) return shell_connection @@ -139,11 +139,11 @@ class MonitorInstallerSession(Action): summary = "Watch for error strings or end of install" def __init__(self): - super(MonitorInstallerSession, self).__init__() + super().__init__() self.force_prompt = True def validate(self): - super(MonitorInstallerSession, self).validate() + super().validate() if 'prompts' not in self.parameters: self.errors = "Unable to identify test image prompts from parameters." @@ -160,11 +160,11 @@ class IsoRebootAction(Action): summary = 'reboot into installed image' def __init__(self): - super(IsoRebootAction, self).__init__() + super().__init__() self.sub_command = None def validate(self): - super(IsoRebootAction, self).validate() + super().validate() if 'prompts' not in self.parameters: self.errors = "Unable to identify boot prompts from job definition." try: @@ -203,7 +203,7 @@ class IsoRebootAction(Action): self.logger.debug("started a shell command") shell_connection = ShellSession(self.job, shell) - shell_connection = super(IsoRebootAction, self).run(shell_connection, max_end_time, args) + shell_connection = super().run(shell_connection, max_end_time, args) shell_connection.prompt_str = [INSTALLER_QUIET_MSG] self.wait(shell_connection) self.set_namespace_data(action='shared', label='shared', key='connection', value=shell_connection) diff --git a/lava_dispatcher/actions/boot/kexec.py b/lava_dispatcher/actions/boot/kexec.py index 49371112e..421b6b950 100644 --- a/lava_dispatcher/actions/boot/kexec.py +++ b/lava_dispatcher/actions/boot/kexec.py @@ -39,7 +39,7 @@ class BootKExec(Boot): compatibility = 1 def __init__(self, parent, parameters): - super(BootKExec, self).__init__(parent) + super().__init__(parent) self.action = BootKexecAction() self.action.section = self.action_type self.action.job = self.job @@ -84,12 +84,12 @@ class KexecAction(Action): description = "call kexec with specified arguments" def __init__(self): - super(KexecAction, self).__init__() + super().__init__() self.command = '' self.load_command = '' def validate(self): - super(KexecAction, self).validate() + super().validate() self.command = self.parameters.get('command', '/sbin/kexec') self.load_command = self.command[:] # local copy for idempotency self.command += ' -e' @@ -110,7 +110,7 @@ class KexecAction(Action): If kexec fails, there is no real chance at diagnostics because the device will be hung. Get the output prior to the call, in case this helps after the job fails. """ - connection = super(KexecAction, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) if 'kernel-config' in self.parameters: cmd = "zgrep -i kexec %s |grep -v '^#'" % self.parameters['kernel-config'] self.logger.debug("Checking for kexec: %s", cmd) diff --git a/lava_dispatcher/actions/boot/lxc.py b/lava_dispatcher/actions/boot/lxc.py index 4f6537def..3ce7ddde3 100644 --- a/lava_dispatcher/actions/boot/lxc.py +++ b/lava_dispatcher/actions/boot/lxc.py @@ -45,7 +45,7 @@ class BootLxc(Boot): compatibility = 1 def __init__(self, parent, parameters): - super(BootLxc, self).__init__(parent) + super().__init__(parent) self.action = BootLxcAction() self.action.section = self.action_type self.action.job = self.job @@ -105,7 +105,7 @@ class LxcAddStaticDevices(Action): return usb_devices def validate(self): - super(LxcAddStaticDevices, self).validate() + super().validate() # If there are no USB devices under static_info then this action should be idempotent. # If we are allowed to use a filesystem label, we don't require a board_id @@ -124,7 +124,7 @@ class LxcAddStaticDevices(Action): self.errors = "Invalid parameters for %s" % self.name def run(self, connection, max_end_time, args=None): - connection = super(LxcAddStaticDevices, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) lxc_name = self.get_namespace_data(action='lxc-create-action', label='lxc', key='name') # If there are no USB devices under static_info then this action should be idempotent. if not self.get_usb_devices(): @@ -150,15 +150,15 @@ class LxcStartAction(Action): summary = "attempt to boot" def __init__(self): - super(LxcStartAction, self).__init__() + super().__init__() self.sleep = 10 def validate(self): - super(LxcStartAction, self).validate() + super().validate() which('lxc-start') def run(self, connection, max_end_time, args=None): - connection = super(LxcStartAction, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) lxc_name = self.get_namespace_data(action='lxc-create-action', label='lxc', key='name') lxc_cmd = ['lxc-start', '-n', lxc_name, '-d'] command_output = self.run_command(lxc_cmd) @@ -197,11 +197,11 @@ class LxcStopAction(Action): summary = "stop lxc" def validate(self): - super(LxcStopAction, self).validate() + super().validate() which('lxc-stop') def run(self, connection, max_end_time, args=None): - connection = super(LxcStopAction, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) lxc_name = self.get_namespace_data(action='lxc-create-action', label='lxc', key='name') lxc_cmd = ['lxc-stop', '-k', '-n', lxc_name] diff --git a/lava_dispatcher/actions/boot/minimal.py b/lava_dispatcher/actions/boot/minimal.py index e68b14043..b41415cef 100644 --- a/lava_dispatcher/actions/boot/minimal.py +++ b/lava_dispatcher/actions/boot/minimal.py @@ -38,7 +38,7 @@ class Minimal(Boot): compatibility = 1 def __init__(self, parent, parameters): - super(Minimal, self).__init__(parent) + super().__init__(parent) self.action = MinimalBoot() self.action.section = self.action_type self.action.job = self.job @@ -74,6 +74,6 @@ class MinimalBoot(BootAction): self.internal_pipeline.add_action(ExportDeviceEnvironment()) def run(self, connection, max_end_time, args=None): - connection = super(MinimalBoot, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) self.set_namespace_data(action='shared', label='shared', key='connection', value=connection) return connection diff --git a/lava_dispatcher/actions/boot/pyocd.py b/lava_dispatcher/actions/boot/pyocd.py index de843afe8..c81d7c39f 100644 --- a/lava_dispatcher/actions/boot/pyocd.py +++ b/lava_dispatcher/actions/boot/pyocd.py @@ -37,7 +37,7 @@ class PyOCD(Boot): compatibility = 4 # FIXME: change this to 5 and update test cases def __init__(self, parent, parameters): - super(PyOCD, self).__init__(parent) + super().__init__(parent) self.action = BootPyOCD() self.action.section = self.action_type self.action.job = self.job @@ -89,12 +89,12 @@ class FlashPyOCDAction(Action): summary = "flash pyocd to boot the image" def __init__(self): - super(FlashPyOCDAction, self).__init__() + super().__init__() self.base_command = [] self.exec_list = [] def validate(self): - super(FlashPyOCDAction, self).validate() + super().validate() boot = self.job.device['actions']['boot']['methods']['pyocd'] pyocd_binary = boot['parameters']['command'] which(pyocd_binary) @@ -125,7 +125,7 @@ class FlashPyOCDAction(Action): self.errors = "No PyOCD command to execute" def run(self, connection, max_end_time, args=None): - connection = super(FlashPyOCDAction, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) for pyocd_command in self.exec_list: pyocd = ' '.join(pyocd_command) self.logger.info("PyOCD command: %s", pyocd) diff --git a/lava_dispatcher/actions/boot/qemu.py b/lava_dispatcher/actions/boot/qemu.py index d3748fe5b..c2c14b18a 100644 --- a/lava_dispatcher/actions/boot/qemu.py +++ b/lava_dispatcher/actions/boot/qemu.py @@ -56,7 +56,7 @@ class BootQEMU(Boot): compatibility = 4 def __init__(self, parent, parameters): - super(BootQEMU, self).__init__(parent) + super().__init__(parent) self.action = BootQEMUImageAction() self.action.section = self.action_type self.action.job = self.job @@ -110,7 +110,7 @@ class CallQemuAction(Action): summary = "execute qemu to boot the image" def __init__(self): - super(CallQemuAction, self).__init__() + super().__init__() self.sub_command = [] self.substitutions = {} self.commands = [] @@ -118,7 +118,7 @@ class CallQemuAction(Action): self.nfsrootfs = None def validate(self): - super(CallQemuAction, self).validate() + super().validate() # 'arch' must be defined in job definition context. try: @@ -242,7 +242,7 @@ class CallQemuAction(Action): self.logger.debug("started a shell command") shell_connection = ShellSession(self.job, shell) - shell_connection = super(CallQemuAction, self).run(shell_connection, max_end_time, args) + shell_connection = super().run(shell_connection, max_end_time, args) self.set_namespace_data(action='shared', label='shared', key='connection', value=shell_connection) return shell_connection diff --git a/lava_dispatcher/actions/boot/ssh.py b/lava_dispatcher/actions/boot/ssh.py index a81f8c18f..9270ce65f 100644 --- a/lava_dispatcher/actions/boot/ssh.py +++ b/lava_dispatcher/actions/boot/ssh.py @@ -41,7 +41,7 @@ class SshLogin(Boot): compatibility = 1 def __init__(self, parent, parameters): - super(SshLogin, self).__init__(parent) + super().__init__(parent) self.action = SshAction() self.action.job = self.job parent.add_action(self.action, parameters) @@ -91,12 +91,12 @@ class Scp(ConnectSsh): summary = "scp over the ssh connection" def __init__(self, key): - super(Scp, self).__init__() + super().__init__() self.key = key self.scp = [] def validate(self): - super(Scp, self).validate() + super().validate() params = self._check_params() which('scp') if 'ssh' not in self.job.device['actions']['deploy']['methods']: @@ -146,7 +146,7 @@ class Scp(ConnectSsh): command = self.scp[:] # local copy # add the argument for setting the port (-P port) command.extend(self.scp_port) - connection = super(Scp, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) if self.identity_file: command.extend(['-i', self.identity_file]) # add arguments to ignore host key checking of the host device @@ -159,7 +159,7 @@ class Scp(ConnectSsh): command.extend(["%s@%s:/%s" % (self.ssh_user, host_address, destination)]) self.logger.info(yaml.dump(command)) self.run_command(command) - connection = super(Scp, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) self.results = {'success': 'ssh deployment'} self.set_namespace_data(action=self.name, label='scp-overlay-unpack', key='overlay', value=destination) self.set_namespace_data(action='shared', label='shared', key='connection', value=connection) @@ -176,7 +176,7 @@ class PrepareSsh(Action): summary = "set the host address of the ssh connection" def __init__(self): - super(PrepareSsh, self).__init__() + super().__init__() self.primary = False def validate(self): @@ -187,7 +187,7 @@ class PrepareSsh(Action): self.primary = True def run(self, connection, max_end_time, args=None): - connection = super(PrepareSsh, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) if not self.primary: host_data = self.get_namespace_data( action=MultinodeProtocol.name, @@ -211,7 +211,7 @@ class ScpOverlayUnpack(Action): summary = "unpack the overlay on the remote device" def run(self, connection, max_end_time, args=None): - connection = super(ScpOverlayUnpack, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) if not connection: raise LAVABug("Cannot unpack, no connection available.") filename = self.get_namespace_data(action='scp-deploy', label='scp-overlay-unpack', key='overlay') @@ -226,7 +226,7 @@ class ScpOverlayUnpack(Action): class Schroot(Boot): def __init__(self, parent, parameters): - super(Schroot, self).__init__(parent) + super().__init__(parent) self.action = SchrootAction() self.action.job = self.job parent.add_action(self.action, parameters) @@ -258,7 +258,7 @@ class SchrootAction(Action): summary = "enter specified schroot" def __init__(self): - super(SchrootAction, self).__init__() + super().__init__() self.section = 'boot' self.schroot = None self.command = None diff --git a/lava_dispatcher/actions/boot/u_boot.py b/lava_dispatcher/actions/boot/u_boot.py index 48b3600de..d3f415ff4 100644 --- a/lava_dispatcher/actions/boot/u_boot.py +++ b/lava_dispatcher/actions/boot/u_boot.py @@ -58,7 +58,7 @@ class UBoot(Boot): compatibility = 1 def __init__(self, parent, parameters): - super(UBoot, self).__init__(parent) + super().__init__(parent) self.action = UBootAction() self.action.section = self.action_type self.action.job = self.job @@ -87,7 +87,7 @@ class UBootAction(BootAction): summary = "pass uboot commands" def validate(self): - super(UBootAction, self).validate() + super().validate() if 'type' in self.parameters: self.logger.warning("Specifying a type in the boot action is deprecated. " "Please specify the kernel type in the deploy parameters.") @@ -130,7 +130,7 @@ class UBootRetry(BootAction): self.internal_pipeline.add_action(ExportDeviceEnvironment()) def validate(self): - super(UBootRetry, self).validate() + super().validate() self.set_namespace_data( action=self.name, label='bootloader_prompt', @@ -139,7 +139,7 @@ class UBootRetry(BootAction): ) def run(self, connection, max_end_time, args=None): - connection = super(UBootRetry, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) self.set_namespace_data(action='shared', label='shared', key='connection', value=connection) return connection @@ -160,7 +160,7 @@ class UBootSecondaryMedia(BootloaderSecondaryMedia): media_keys = self.job.device['parameters']['media'].keys() if self.parameters['commands'] not in list(media_keys): return - super(UBootSecondaryMedia, self).validate() + super().validate() if 'kernel_type' not in self.parameters: self.errors = "Missing kernel_type for secondary media boot" self.logger.debug("Mapping kernel_type: %s", self.parameters['kernel_type']) @@ -198,7 +198,7 @@ class UBootEnterFastbootAction(BootAction): summary = "uboot commands to enter fastboot mode" def __init__(self): - super(UBootEnterFastbootAction, self).__init__() + super().__init__() self.params = {} def populate(self, parameters): @@ -211,7 +211,7 @@ class UBootEnterFastbootAction(BootAction): self.internal_pipeline.add_action(ConnectLxc()) def validate(self): - super(UBootEnterFastbootAction, self).validate() + super().validate() if 'u-boot' not in self.job.device['actions']['deploy']['methods']: self.errors = "uboot method missing" @@ -220,9 +220,7 @@ class UBootEnterFastbootAction(BootAction): self.errors = "uboot command missing" def run(self, connection, max_end_time, args=None): - connection = super(UBootEnterFastbootAction, self).run(connection, - max_end_time, - args) + connection = super().run(connection, max_end_time, args) connection.prompt_str = self.params['bootloader_prompt'] self.logger.debug("Changing prompt to %s", connection.prompt_str) self.wait(connection) diff --git a/lava_dispatcher/actions/boot/uefi.py b/lava_dispatcher/actions/boot/uefi.py index ff56d8797..341af2d16 100644 --- a/lava_dispatcher/actions/boot/uefi.py +++ b/lava_dispatcher/actions/boot/uefi.py @@ -44,7 +44,7 @@ class UefiShell(Boot): compatibility = 3 def __init__(self, parent, parameters): - super(UefiShell, self).__init__(parent) + super().__init__(parent) self.action = UefiShellAction() self.action.section = self.action_type self.action.job = self.job @@ -72,7 +72,7 @@ class UefiShellAction(BootAction): summary = "run UEFI shell to system" def __init__(self): - super(UefiShellAction, self).__init__() + super().__init__() self.shell_menu = [] def _skip_menu(self, parameters): @@ -107,13 +107,13 @@ class UefiShellAction(BootAction): self.internal_pipeline.add_action(ExportDeviceEnvironment()) def run(self, connection, max_end_time, args=None): - connection = super(UefiShellAction, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) connection.raw_connection.linesep = UEFI_LINE_SEPARATOR self.set_namespace_data(action='shared', label='shared', key='connection', value=connection) return connection def validate(self): - super(UefiShellAction, self).validate() + super().validate() params = self.job.device['actions']['boot']['methods']['uefi']['parameters'] self.set_namespace_data( action=self.name, @@ -130,7 +130,7 @@ class UefiShellMenuInterrupt(UEFIMenuInterrupt): summary = 'interrupt default boot and to menu' def __init__(self): - super(UefiShellMenuInterrupt, self).__init__() + super().__init__() # Take parameters from the uefi method, not uefi menu. self.method = 'uefi' @@ -156,7 +156,7 @@ class UefiShellInterrupt(MenuInterrupt): if not connection: self.logger.debug("%s called without active connection", self.name) return - connection = super(UefiShellInterrupt, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) # param keys already checked in accepts() classmethod params = self.job.device['actions']['boot']['methods']['uefi']['parameters'] connection.prompt_str = params['shell_interrupt_prompt'] @@ -176,7 +176,7 @@ class UefiShellMenuSelector(UefiMenuSelector): summary = 'use uefi menu to drop to shell' def __init__(self): - super(UefiShellMenuSelector, self).__init__() + super().__init__() # Take parameters from the uefi method, not uefi menu. self.method_name = 'uefi' # Default menu command name: drop to shell @@ -195,6 +195,6 @@ class UefiShellMenuSelector(UefiMenuSelector): self.errors = "Missing menu commands for %s" % self.commands if 'menu_boot_message' in params: self.boot_message = params['menu_boot_message'] - super(UefiShellMenuSelector, self).validate() + super().validate() if 'menu_prompt' in params: self.selector.prompt = params['menu_prompt'] diff --git a/lava_dispatcher/actions/boot/uefi_menu.py b/lava_dispatcher/actions/boot/uefi_menu.py index 6816dba7b..644ba9035 100644 --- a/lava_dispatcher/actions/boot/uefi_menu.py +++ b/lava_dispatcher/actions/boot/uefi_menu.py @@ -52,7 +52,7 @@ class UefiMenu(Boot): """ def __init__(self, parent, parameters): - super(UefiMenu, self).__init__(parent) + super().__init__(parent) self.action = UefiMenuAction() self.action.section = self.action_type self.action.job = self.job @@ -78,12 +78,12 @@ class UEFIMenuInterrupt(MenuInterrupt): summary = 'interrupt for uefi menu' def __init__(self): - super(UEFIMenuInterrupt, self).__init__() + super().__init__() self.params = None self.method = 'uefi-menu' def validate(self): - super(UEFIMenuInterrupt, self).validate() + super().validate() self.params = self.job.device['actions']['boot']['methods'][self.method]['parameters'] if 'interrupt_prompt' not in self.params: self.errors = "Missing interrupt prompt" @@ -94,7 +94,7 @@ class UEFIMenuInterrupt(MenuInterrupt): if not connection: self.logger.debug("%s called without active connection", self.name) return - connection = super(UEFIMenuInterrupt, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) connection.prompt_str = self.params['interrupt_prompt'] self.wait(connection) connection.raw_connection.send(self.params['interrupt_string']) @@ -108,7 +108,7 @@ class UefiMenuSelector(SelectorMenuAction): # pylint: disable=too-many-instance summary = 'select options in the uefi menu' def __init__(self): - super(UefiMenuSelector, self).__init__() + super().__init__() self.selector.prompt = "Start:" self.method_name = 'uefi-menu' self.commands = [] @@ -170,7 +170,7 @@ class UefiMenuSelector(SelectorMenuAction): # pylint: disable=too-many-instance self.line_sep = LINE_SEPARATOR else: self.errors = "Unrecognised line separator configuration." - super(UefiMenuSelector, self).validate() + super().validate() def run(self, connection, max_end_time, args=None): lxc_active = any([protocol for protocol in self.job.protocols if protocol.name == LxcProtocol.name]) @@ -186,7 +186,7 @@ class UefiMenuSelector(SelectorMenuAction): # pylint: disable=too-many-instance connection.raw_connection.linesep = self.line_sep self.logger.debug("Looking for %s", self.selector.prompt) self.wait(connection) - connection = super(UefiMenuSelector, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) if self.boot_message: self.logger.debug("Looking for %s", self.boot_message) connection.prompt_str = self.boot_message @@ -202,11 +202,11 @@ class UefiSubstituteCommands(Action): summary = 'substitute job values into uefi commands' def __init__(self): - super(UefiSubstituteCommands, self).__init__() + super().__init__() self.items = None def validate(self): - super(UefiSubstituteCommands, self).validate() + super().validate() if self.parameters['commands'] not in self.job.device['actions']['boot']['methods']['uefi-menu']: self.errors = "Missing commands for %s" % self.parameters['commands'] self.items = self.job.device['actions']['boot']['methods']['uefi-menu'][self.parameters['commands']] @@ -215,7 +215,7 @@ class UefiSubstituteCommands(Action): self.errors = "Invalid device configuration for %s: %s" % (self.name, item) def run(self, connection, max_end_time, args=None): - connection = super(UefiSubstituteCommands, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) ip_addr = dispatcher_ip(self.job.parameters['dispatcher']) substitution_dictionary = { '{SERVER_IP}': ip_addr, @@ -249,11 +249,11 @@ class UefiMenuAction(BootAction): summary = 'interact with uefi menu' def __init__(self): - super(UefiMenuAction, self).__init__() + super().__init__() self.method = 'uefi-menu' def validate(self): - super(UefiMenuAction, self).validate() + super().validate() self.set_namespace_data( action=self.name, label='bootloader_prompt', diff --git a/lava_dispatcher/actions/commands.py b/lava_dispatcher/actions/commands.py index 02da3a1c6..b15951724 100644 --- a/lava_dispatcher/actions/commands.py +++ b/lava_dispatcher/actions/commands.py @@ -32,13 +32,13 @@ class CommandAction(Action): summary = "execute commands" def __init__(self): - super(CommandAction, self).__init__() + super().__init__() self.section = "command" self.cmd = None self.ran = False def validate(self): - super(CommandAction, self).validate() + super().validate() cmd_name = self.parameters['name'] try: user_commands = self.job.device['commands']['users'] @@ -57,7 +57,7 @@ class CommandAction(Action): return False def run(self, connection, max_end_time, args=None): - connection = super(CommandAction, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) self.logger.debug("Running user command '%s'", self.parameters['name']) self.ran = True diff --git a/lava_dispatcher/actions/deploy/apply_overlay.py b/lava_dispatcher/actions/deploy/apply_overlay.py index 15d506035..325e1a37c 100644 --- a/lava_dispatcher/actions/deploy/apply_overlay.py +++ b/lava_dispatcher/actions/deploy/apply_overlay.py @@ -65,11 +65,11 @@ class ApplyOverlayGuest(Action): summary = "build a guest filesystem with the overlay" def __init__(self): - super(ApplyOverlayGuest, self).__init__() + super().__init__() self.guest_filename = 'lava-guest.qcow2' def validate(self): - super(ApplyOverlayGuest, self).validate() + super().validate() self.set_namespace_data(action=self.name, label='guest', key='name', value=self.guest_filename) if 'guest' not in self.job.device['actions']['deploy']['methods']['image']['parameters']: self.errors = "Device configuration does not specify size of guest filesystem." @@ -97,7 +97,7 @@ class ApplyOverlayImage(Action): summary = "apply overlay to test image" def __init__(self, image_key='image', use_root_partition=True): - super(ApplyOverlayImage, self).__init__() + super().__init__() self.image_key = image_key self.use_root_partition = use_root_partition @@ -129,11 +129,11 @@ class ApplyOverlaySparseImage(Action): summary = "apply overlay to sparse image" def __init__(self, image_key): - super(ApplyOverlaySparseImage, self).__init__() + super().__init__() self.image_key = image_key # the sparse image key in the parameters def validate(self): - super(ApplyOverlaySparseImage, self).validate() + super().validate() which('simg2img') which('mount') which('umount') @@ -177,7 +177,7 @@ class PrepareOverlayTftp(Action): self.internal_pipeline.add_action(PrepareKernelAction()) def run(self, connection, max_end_time, args=None): - connection = super(PrepareOverlayTftp, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) ramdisk = self.get_namespace_data( action='download-action', label='file', @@ -202,7 +202,7 @@ class ApplyOverlayTftp(Action): summary = "apply lava overlay test files" def validate(self): - super(ApplyOverlayTftp, self).validate() + super().validate() persist = self.parameters.get('persistent_nfs', None) if persist: if not isinstance(persist, dict): @@ -211,7 +211,7 @@ class ApplyOverlayTftp(Action): self.errors = "Missing address for persistent NFS" def run(self, connection, max_end_time, args=None): # pylint: disable=too-many-branches - connection = super(ApplyOverlayTftp, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) directory = None nfs_address = None overlay_file = None @@ -292,7 +292,7 @@ class ExtractRootfs(Action): # pylint: disable=too-many-instance-attributes summary = "unpack rootfs, ready to apply lava overlay" def __init__(self): - super(ExtractRootfs, self).__init__() + super().__init__() self.param_key = 'rootfs' self.file_key = "root" self.extra_compression = ['xz'] @@ -302,7 +302,7 @@ class ExtractRootfs(Action): # pylint: disable=too-many-instance-attributes def run(self, connection, max_end_time, args=None): if not self.parameters.get(self.param_key, None): # idempotency return connection - connection = super(ExtractRootfs, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) root = self.get_namespace_data(action='download-action', label=self.param_key, key='file') root_dir = self.mkdtemp() untar_file(root, root_dir) @@ -321,12 +321,12 @@ class ExtractNfsRootfs(ExtractRootfs): summary = "unpack nfsrootfs, ready to apply lava overlay" def __init__(self): - super(ExtractNfsRootfs, self).__init__() + super().__init__() self.param_key = 'nfsrootfs' self.file_key = "nfsroot" def validate(self): - super(ExtractNfsRootfs, self).validate() + super().validate() if not self.parameters.get(self.param_key, None): # idempotency return if not self.get_namespace_data( @@ -344,7 +344,7 @@ class ExtractNfsRootfs(ExtractRootfs): def run(self, connection, max_end_time, args=None): if not self.parameters.get(self.param_key, None): # idempotency return connection - connection = super(ExtractNfsRootfs, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) if 'prefix' in self.parameters[self.param_key]: prefix = self.parameters[self.param_key]['prefix'] @@ -377,7 +377,7 @@ class ExtractModules(Action): def run(self, connection, max_end_time, args=None): if not self.parameters.get('modules', None): # idempotency return connection - connection = super(ExtractModules, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) modules = self.get_namespace_data(action='download-action', label='modules', key='file') if not self.parameters.get('ramdisk', None): if not self.parameters.get('nfsrootfs', None): @@ -425,11 +425,11 @@ class ExtractRamdisk(Action): summary = "extract the ramdisk" def __init__(self): - super(ExtractRamdisk, self).__init__() + super().__init__() self.skip = False def validate(self): - super(ExtractRamdisk, self).validate() + super().validate() if not self.parameters.get('ramdisk', None): # idempotency return if not self.parameters['ramdisk'].get('install_modules', True) and \ @@ -448,7 +448,7 @@ class ExtractRamdisk(Action): # declare the original ramdisk as the name to be used later. self.set_namespace_data(action='compress-ramdisk', label='file', key='ramdisk', value=filename) return - connection = super(ExtractRamdisk, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) ramdisk_dir = self.mkdtemp() extracted_ramdisk = os.path.join(ramdisk_dir, 'ramdisk') os.mkdir(extracted_ramdisk, 0o755) @@ -490,13 +490,13 @@ class CompressRamdisk(Action): summary = "compress ramdisk with overlay" def __init__(self): - super(CompressRamdisk, self).__init__() + super().__init__() self.mkimage_arch = None self.add_header = None self.skip = False def validate(self): - super(CompressRamdisk, self).validate() + super().validate() if not self.parameters.get('ramdisk', None): # idempotency return if not self.parameters['ramdisk'].get('install_modules', True) and \ @@ -520,7 +520,7 @@ class CompressRamdisk(Action): return connection if self.skip: return connection - connection = super(CompressRamdisk, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) ramdisk_dir = self.get_namespace_data( action='extract-overlay-ramdisk', label='extracted_ramdisk', key='directory') ramdisk_data = self.get_namespace_data( @@ -597,19 +597,19 @@ class ApplyLxcOverlay(Action): summary = "apply overlay on the container" def __init__(self): - super(ApplyLxcOverlay, self).__init__() + super().__init__() self.lava_test_dir = os.path.realpath( '%s/../../lava_test_shell' % os.path.dirname(__file__)) self.scripts_to_copy = ['lava-test-runner'] def validate(self): - super(ApplyLxcOverlay, self).validate() + super().validate() which('tar') if not os.path.exists(self.lava_test_dir): self.errors = "Missing lava-test-runner: %s" % self.lava_test_dir def run(self, connection, max_end_time, args=None): - connection = super(ApplyLxcOverlay, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) overlay_file = self.get_namespace_data(action='compress-overlay', label='output', key='file') if overlay_file is None: self.logger.debug("skipped %s", self.name) diff --git a/lava_dispatcher/actions/deploy/docker.py b/lava_dispatcher/actions/deploy/docker.py index 25a366b88..8da90f556 100644 --- a/lava_dispatcher/actions/deploy/docker.py +++ b/lava_dispatcher/actions/deploy/docker.py @@ -36,7 +36,7 @@ class DockerAction(DeployAction): summary = "deploy docker" def validate(self): - super(DockerAction, self).validate() + super().validate() which("docker") # Print docker version @@ -75,7 +75,7 @@ class DockerAction(DeployAction): msg = "Unable to pull docker image '%s'" % self.parameters["image"] raise JobError(msg) - return super(DockerAction, self).run(connection, max_end_time, args) + return super().run(connection, max_end_time, args) class Docker(Deployment): @@ -83,7 +83,7 @@ class Docker(Deployment): name = 'docker' def __init__(self, parent, parameters): - super(Docker, self).__init__(parent) + super().__init__(parent) self.action = DockerAction() self.action.section = self.action_type self.action.job = self.job diff --git a/lava_dispatcher/actions/deploy/download.py b/lava_dispatcher/actions/deploy/download.py index 815a07b1e..f38f2e91b 100644 --- a/lava_dispatcher/actions/deploy/download.py +++ b/lava_dispatcher/actions/deploy/download.py @@ -84,7 +84,7 @@ class DownloaderAction(RetryAction): summary = "download-retry" def __init__(self, key, path, uniquify=True): - super(DownloaderAction, self).__init__() + super().__init__() self.max_retries = 3 self.key = key # the key in the parameters of what to download self.path = path # where to download @@ -131,7 +131,7 @@ class DownloadHandler(Action): # pylint: disable=too-many-instance-attributes summary = "download-action" def __init__(self, key, path, url, uniquify=True): - super(DownloadHandler, self).__init__() + super().__init__() self.url = url self.key = key # If uniquify is True, store the files in a sub-directory to keep the @@ -147,7 +147,7 @@ class DownloadHandler(Action): # pylint: disable=too-many-instance-attributes self.logger.debug("Cleaning up download directory: %s", self.path) shutil.rmtree(self.path) self.set_namespace_data(action='download-action', label=self.key, key='file', value='') - super(DownloadHandler, self).cleanup(connection) + super().cleanup(connection) def _url_to_fname_suffix(self, path, modify): filename = os.path.basename(self.url.path) @@ -162,7 +162,7 @@ class DownloadHandler(Action): # pylint: disable=too-many-instance-attributes parts[-1]) def validate(self): - super(DownloadHandler, self).validate() + super().validate() if 'images' in self.parameters and self.key in self.parameters['images']: image = self.parameters['images'][self.key] self.url = lavaurl.urlparse(image['url']) @@ -214,7 +214,7 @@ class DownloadHandler(Action): # pylint: disable=too-many-instance-attributes return (condition, percent, "progress %3d%% (%dMB)" % (percent, int(downloaded_sz / (1024 * 1024))) if condition else "") - connection = super(DownloadHandler, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) # self.cookies = self.job.context.config.lava_cookies # FIXME: work out how to restore md5 = hashlib.md5() sha256 = hashlib.sha256() @@ -412,7 +412,7 @@ class FileDownloadAction(DownloadHandler): summary = "local file copy" def validate(self): - super(FileDownloadAction, self).validate() + super().validate() try: self.size = os.stat(self.url.path).st_size except OSError: @@ -443,7 +443,7 @@ class HttpDownloadAction(DownloadHandler): summary = "http download" def validate(self): - super(HttpDownloadAction, self).validate() + super().validate() res = None try: self.logger.debug("Validating that %s exists", self.url.geturl()) @@ -496,7 +496,7 @@ class ScpDownloadAction(DownloadHandler): summary = "scp download" def validate(self): - super(ScpDownloadAction, self).validate() + super().validate() try: size = subprocess.check_output(['nice', 'ssh', self.url.netloc, @@ -539,21 +539,20 @@ class LxcDownloadAction(Action): summary = "lxc download" def __init__(self, key, path, url): - super(LxcDownloadAction, self).__init__() + super().__init__() self.key = key self.path = path self.url = url def validate(self): - super(LxcDownloadAction, self).validate() + super().validate() if self.url.scheme != 'lxc': self.errors = "lxc:/// url scheme is invalid" if not self.url.path: self.errors = "Invalid path in lxc:/// url" def run(self, connection, max_end_time, args=None): - connection = super(LxcDownloadAction, self).run(connection, - max_end_time, args) + connection = super().run(connection, max_end_time, args) # this is the device namespace - the lxc namespace is not accessible lxc_name = None protocol = [protocol for protocol in self.job.protocols if protocol.name == LxcProtocol.name][0] @@ -586,11 +585,11 @@ class QCowConversionAction(Action): summary = "qcow conversion" def __init__(self, key): - super(QCowConversionAction, self).__init__() + super().__init__() self.key = key def run(self, connection, max_end_time, args=None): - connection = super(QCowConversionAction, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) fname = self.get_namespace_data( action='download-action', label=self.key, @@ -627,7 +626,7 @@ class Download(Deployment): name = 'download' def __init__(self, parent, parameters): - super(Download, self).__init__(parent) + super().__init__(parent) self.action = DownloadAction() self.action.section = self.action_type self.action.job = self.job @@ -649,11 +648,11 @@ class DownloadAction(DeployAction): # pylint:disable=too-many-instance-attribut summary = "download deployment" def __init__(self): - super(DownloadAction, self).__init__() + super().__init__() self.download_dir = None def validate(self): - super(DownloadAction, self).validate() + super().validate() self.set_namespace_data(action=self.name, label='download-dir', key='dir', value=self.download_dir) @@ -699,13 +698,12 @@ class CopyToLxcAction(DeployAction): summary = "copy to lxc" def __init__(self): - super(CopyToLxcAction, self).__init__() + super().__init__() self.retries = 3 self.sleep = 10 def run(self, connection, max_end_time, args=None): # pylint: disable=too-many-locals - connection = super(CopyToLxcAction, self).run(connection, max_end_time, - args) + connection = super().run(connection, max_end_time, args) # this is the device namespace - the lxc namespace is not accessible lxc_name = None protocol = [protocol for protocol in self.job.protocols if protocol.name == LxcProtocol.name][0] diff --git a/lava_dispatcher/actions/deploy/environment.py b/lava_dispatcher/actions/deploy/environment.py index b47cac41f..e2729bd56 100644 --- a/lava_dispatcher/actions/deploy/environment.py +++ b/lava_dispatcher/actions/deploy/environment.py @@ -35,11 +35,11 @@ class DeployDeviceEnvironment(Action): summary = "deploy device environment" def __init__(self): - super(DeployDeviceEnvironment, self).__init__() + super().__init__() self.env = "" def validate(self): - super(DeployDeviceEnvironment, self).validate() + super().validate() if 'lava_test_shell_file' not in \ self.parameters['deployment_data'].keys(): self.errors = "Invalid deployment data - missing lava_test_shell_file" diff --git a/lava_dispatcher/actions/deploy/fastboot.py b/lava_dispatcher/actions/deploy/fastboot.py index 1ac291025..e88452525 100644 --- a/lava_dispatcher/actions/deploy/fastboot.py +++ b/lava_dispatcher/actions/deploy/fastboot.py @@ -57,7 +57,7 @@ class Fastboot(Deployment): name = 'fastboot' def __init__(self, parent, parameters): - super(Fastboot, self).__init__(parent) + super().__init__(parent) self.action = FastbootAction() self.action.section = self.action_type self.action.job = self.job @@ -89,11 +89,11 @@ class FastbootAction(DeployAction): # pylint:disable=too-many-instance-attribut summary = "fastboot deployment" def __init__(self): - super(FastbootAction, self).__init__() + super().__init__() self.force_prompt = False def validate(self): - super(FastbootAction, self).validate() + super().validate() if not self.test_needs_deployment(self.parameters): return protocol = [protocol for protocol in self.job.protocols if protocol.name == LxcProtocol.name] @@ -146,7 +146,7 @@ class FastbootFlashOrderAction(DeployAction): summary = "Handle reset and options for each flash url." def __init__(self): - super(FastbootFlashOrderAction, self).__init__() + super().__init__() self.retries = 3 self.sleep = 10 self.interrupt_prompt = None @@ -177,7 +177,7 @@ class FastbootFlashOrderAction(DeployAction): self.internal_pipeline.add_action(ReadFeedback(repeat=True)) def validate(self): - super(FastbootFlashOrderAction, self).validate() + super().validate() self.set_namespace_data( action=FastbootFlashAction.name, label='interrupt', key='reboot', value=self.reboot) @@ -204,7 +204,7 @@ class FastbootFlashAction(Action): summary = "Execute fastboot flash command" def __init__(self, cmd=None): - super(FastbootFlashAction, self).__init__() + super().__init__() self.retries = 3 self.sleep = 10 self.command = cmd @@ -212,7 +212,7 @@ class FastbootFlashAction(Action): self.interrupt_string = None def validate(self): - super(FastbootFlashAction, self).validate() + super().validate() if not self.command: self.errors = "Invalid configuration - missing flash command" device_methods = self.job.device['actions']['deploy']['methods'] @@ -221,7 +221,7 @@ class FastbootFlashAction(Action): self.interrupt_string = device_methods['fastboot'].get('interrupt_string') def run(self, connection, max_end_time, args=None): # pylint: disable=too-many-locals - connection = super(FastbootFlashAction, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) # this is the device namespace - the lxc namespace is not accessible lxc_name = None protocol = [protocol for protocol in self.job.protocols if protocol.name == LxcProtocol.name][0] @@ -271,7 +271,7 @@ class FastbootReboot(Action): def run(self, connection, max_end_time, args=None): # pylint: disable=too-many-locals - connection = super(FastbootReboot, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) # this is the device namespace - the lxc namespace is not accessible lxc_name = None protocol = [protocol for protocol in self.job.protocols if protocol.name == LxcProtocol.name][0] @@ -301,7 +301,7 @@ class FastbootRebootBootloader(Action): def run(self, connection, max_end_time, args=None): # pylint: disable=too-many-locals - connection = super(FastbootRebootBootloader, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) # this is the device namespace - the lxc namespace is not accessible lxc_name = None protocol = [protocol for protocol in self.job.protocols if protocol.name == LxcProtocol.name][0] diff --git a/lava_dispatcher/actions/deploy/flasher.py b/lava_dispatcher/actions/deploy/flasher.py index 92d24eca7..b90cc6dab 100644 --- a/lava_dispatcher/actions/deploy/flasher.py +++ b/lava_dispatcher/actions/deploy/flasher.py @@ -32,7 +32,7 @@ from lava_dispatcher.utils.strings import substitute class FlasherAction(DeployAction): def __init__(self): - super(FlasherAction, self).__init__() + super().__init__() self.name = "deploy-flasher" self.description = "deploy flasher" self.summary = "deploy custom flasher" @@ -40,7 +40,7 @@ class FlasherAction(DeployAction): self.path = None def validate(self): - super(FlasherAction, self).validate() + super().validate() method = self.job.device['actions']['deploy']['methods']['flasher'] self.commands = method.get("commands") if not isinstance(self.commands, list): @@ -60,7 +60,7 @@ class FlasherAction(DeployAction): self.internal_pipeline.add_action(OverlayAction()) def run(self, connection, max_end_time, args=None): - connection = super(FlasherAction, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) # Substitute in the device commands substitutions = {} for key in [key for key in self.parameters['images'].keys() if key != "yaml_line"]: @@ -98,7 +98,7 @@ class Flasher(Deployment): name = 'flasher' def __init__(self, parent, parameters): - super(Flasher, self).__init__(parent) + super().__init__(parent) self.action = FlasherAction() self.action.section = self.action_type self.action.job = self.job diff --git a/lava_dispatcher/actions/deploy/image.py b/lava_dispatcher/actions/deploy/image.py index a9d5a12bc..5e8747538 100644 --- a/lava_dispatcher/actions/deploy/image.py +++ b/lava_dispatcher/actions/deploy/image.py @@ -71,7 +71,7 @@ class DeployQemuNfs(Deployment): name = 'qemu-nfs' def __init__(self, parent, parameters): - super(DeployQemuNfs, self).__init__(parent) + super().__init__(parent) self.action = DeployQemuNfsAction() self.action.section = self.action_type self.action.job = self.job @@ -130,7 +130,7 @@ class ExtractNfsAction(Action): summary = "NFS deployment for QEMU" def __init__(self): - super(ExtractNfsAction, self).__init__() + super().__init__() self.param_key = 'nfsrootfs' self.file_key = "nfsroot" self.extra_compression = ['xz'] @@ -138,7 +138,7 @@ class ExtractNfsAction(Action): self.use_lzma = False def validate(self): - super(ExtractNfsAction, self).validate() + super().validate() if not self.valid: return if not self.parameters['images'].get(self.param_key, None): # idempotency @@ -158,7 +158,7 @@ class ExtractNfsAction(Action): def run(self, connection, max_end_time, args=None): if not self.parameters['images'].get(self.param_key, None): # idempotency return connection - connection = super(ExtractNfsAction, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) root = self.get_namespace_data(action='download-action', label=self.param_key, key='file') root_dir = self.mkdtemp() untar_file(root, root_dir) @@ -203,7 +203,7 @@ class DeployImages(Deployment): name = 'images' def __init__(self, parent, parameters): - super(DeployImages, self).__init__(parent) + super().__init__(parent) self.action = DeployImagesAction() self.action.section = self.action_type self.action.job = self.job diff --git a/lava_dispatcher/actions/deploy/iso.py b/lava_dispatcher/actions/deploy/iso.py index 52dfb0b4d..db9d43682 100644 --- a/lava_dispatcher/actions/deploy/iso.py +++ b/lava_dispatcher/actions/deploy/iso.py @@ -53,11 +53,11 @@ class DeployIsoAction(DeployAction): # pylint: disable=too-many-instance-attrib Uses the tftp directory for easier cleanup and for parity with the non-QEMU Debian Installer support. """ - super(DeployIsoAction, self).__init__() + super().__init__() self.preseed_path = None def validate(self): - super(DeployIsoAction, self).validate() + super().validate() suffix = os.path.join(*self.preseed_path.split('/')[-2:]) self.set_namespace_data(action=self.name, label='iso', key='suffix', value=suffix) which('in.tftpd') @@ -83,7 +83,7 @@ class DeployIso(Deployment): name = 'iso' def __init__(self, parent, parameters): - super(DeployIso, self).__init__(parent) + super().__init__(parent) self.action = DeployIsoAction() self.action.section = self.action_type self.action.job = self.job @@ -111,11 +111,11 @@ class IsoEmptyImage(Action): summary = 'create destination image' def __init__(self): - super(IsoEmptyImage, self).__init__() + super().__init__() self.size = 0 def validate(self): - super(IsoEmptyImage, self).validate() + super().validate() size_str = self.parameters['iso']['installation_size'] if not isinstance(size_str, str): self.errors = "installation size needs to be a string, e.g. 2G or 800M" @@ -158,11 +158,11 @@ class IsoPullInstaller(Action): FILE_KEYS = ['kernel', 'initrd'] def __init__(self): - super(IsoPullInstaller, self).__init__() + super().__init__() self.files = {} def validate(self): - super(IsoPullInstaller, self).validate() + super().validate() for key in self.FILE_KEYS: if key in self.parameters['iso']: filename = self.parameters['iso'][key] @@ -208,7 +208,7 @@ class QemuCommandLine(Action): # pylint: disable=too-many-instance-attributes summary = 'build qemu command line with kernel command string' def __init__(self): - super(QemuCommandLine, self).__init__() + super().__init__() self.sub_command = [] self.command_line = '' self.console = None @@ -217,7 +217,7 @@ class QemuCommandLine(Action): # pylint: disable=too-many-instance-attributes self.preseed_url = None def validate(self): - super(QemuCommandLine, self).validate() + super().validate() boot = self.job.device['actions']['boot']['methods']['qemu'] qemu_binary = which(boot['parameters']['command']) self.sub_command = [qemu_binary] diff --git a/lava_dispatcher/actions/deploy/lxc.py b/lava_dispatcher/actions/deploy/lxc.py index 50191f5c3..f35e38f5e 100644 --- a/lava_dispatcher/actions/deploy/lxc.py +++ b/lava_dispatcher/actions/deploy/lxc.py @@ -61,7 +61,7 @@ class Lxc(Deployment): name = 'lxc' def __init__(self, parent, parameters): - super(Lxc, self).__init__(parent) + super().__init__(parent) self.action = LxcAction() self.action.section = self.action_type self.action.job = self.job @@ -87,11 +87,11 @@ class LxcAction(DeployAction): # pylint:disable=too-many-instance-attributes summary = "lxc deployment" def __init__(self): - super(LxcAction, self).__init__() + super().__init__() self.lxc_data = {} def validate(self): - super(LxcAction, self).validate() + super().validate() self.logger.info("lxc, installed at version: %s", debian_package_version(pkg='lxc', split=False)) protocols = [protocol.name for protocol in self.job.protocols] @@ -128,7 +128,7 @@ class LxcCreateAction(DeployAction): summary = "create lxc" def __init__(self): - super(LxcCreateAction, self).__init__() + super().__init__() self.retries = 10 self.sleep = 10 self.lxc_data = {} @@ -151,12 +151,12 @@ class LxcCreateAction(DeployAction): self.lxc_data['custom_lxc_path'] = protocol.custom_lxc_path def validate(self): - super(LxcCreateAction, self).validate() + super().validate() # set lxc_data self._set_lxc_data() def run(self, connection, max_end_time, args=None): - connection = super(LxcCreateAction, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) verbose = '' if self.lxc_data['verbose'] else '-q' lxc_default_path = lxc_path(self.job.parameters['dispatcher']) if self.lxc_data['custom_lxc_path']: @@ -215,12 +215,12 @@ class LxcCreateUdevRuleAction(DeployAction): summary = "create lxc udev rule" def __init__(self): - super(LxcCreateUdevRuleAction, self).__init__() + super().__init__() self.retries = 10 self.sleep = 10 def validate(self): - super(LxcCreateUdevRuleAction, self).validate() + super().validate() which('udevadm') if 'device_info' in self.job.device \ and not isinstance(self.job.device.get('device_info'), list): @@ -242,9 +242,7 @@ class LxcCreateUdevRuleAction(DeployAction): self.errors = "Invalid parameters for %s" % self.name def run(self, connection, max_end_time, args=None): - connection = super(LxcCreateUdevRuleAction, self).run(connection, - max_end_time, - args) + connection = super().run(connection, max_end_time, args) # this may be the device namespace - the lxc namespace may not be # accessible lxc_name = None @@ -326,13 +324,12 @@ class LxcAptUpdateAction(DeployAction): summary = "lxc apt update" def __init__(self): - super(LxcAptUpdateAction, self).__init__() + super().__init__() self.retries = 10 self.sleep = 10 def run(self, connection, max_end_time, args=None): - connection = super(LxcAptUpdateAction, self).run(connection, - max_end_time, args) + connection = super().run(connection, max_end_time, args) lxc_name = self.get_namespace_data(action='lxc-create-action', label='lxc', key='name') cmd = ['lxc-attach', '-n', lxc_name, '--', 'apt-get', '-y', 'update'] @@ -351,18 +348,17 @@ class LxcAptInstallAction(DeployAction): summary = "lxc apt install" def __init__(self): - super(LxcAptInstallAction, self).__init__() + super().__init__() self.retries = 10 self.sleep = 10 def validate(self): - super(LxcAptInstallAction, self).validate() + super().validate() if 'packages' not in self.parameters: raise LAVABug("%s package list unavailable" % self.name) def run(self, connection, max_end_time, args=None): - connection = super(LxcAptInstallAction, self).run(connection, - max_end_time, args) + connection = super().run(connection, max_end_time, args) lxc_name = self.get_namespace_data(action='lxc-create-action', label='lxc', key='name') packages = self.parameters['packages'] diff --git a/lava_dispatcher/actions/deploy/mount.py b/lava_dispatcher/actions/deploy/mount.py index b139b45ed..3a05f6b32 100644 --- a/lava_dispatcher/actions/deploy/mount.py +++ b/lava_dispatcher/actions/deploy/mount.py @@ -47,11 +47,11 @@ class OffsetAction(DeployAction): summary = "offset calculation" def __init__(self, key): - super(OffsetAction, self).__init__() + super().__init__() self.key = key def validate(self): - super(OffsetAction, self).validate() + super().validate() if not self.get_namespace_data(action='download-action', label=self.key, key='file'): self.errors = "no file specified to calculate offset" @@ -59,7 +59,7 @@ class OffsetAction(DeployAction): if self.get_namespace_data(action='download-action', label=self.key, key='offset'): # idempotency return connection - connection = super(OffsetAction, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) image = self.get_namespace_data(action='download-action', label=self.key, key='file') if not os.path.exists(image): raise JobError("Not able to mount %s: file does not exist" % image) @@ -96,11 +96,11 @@ class LoopCheckAction(DeployAction): summary = "check available loop back support" def __init__(self, key): - super(LoopCheckAction, self).__init__() + super().__init__() self.key = key def validate(self): - super(LoopCheckAction, self).validate() + super().validate() if len(glob.glob('/sys/block/loop*')) <= 0: raise InfrastructureError("Could not mount the image without loopback devices. " "Is the 'loop' kernel module activated?") @@ -108,7 +108,7 @@ class LoopCheckAction(DeployAction): self.set_namespace_data(action=self.name, label=self.key, key='available_loops', value=available_loops) def run(self, connection, max_end_time, args=None): - connection = super(LoopCheckAction, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) if not self.get_namespace_data(action=self.name, label=self.key, key='available_loops'): raise LAVABug("Unable to check available loop devices") args = ['/sbin/losetup', '-a'] @@ -137,14 +137,14 @@ class LoopMountAction(RetryAction): summary = "loopback mount" def __init__(self, key): - super(LoopMountAction, self).__init__() + super().__init__() self.retries = 10 self.sleep = 10 self.mntdir = None self.key = key def validate(self): - super(LoopMountAction, self).validate() + super().validate() lava_test_results_base = self.parameters['deployment_data']['lava_test_results_dir'] lava_test_results_dir = lava_test_results_base % self.job.job_id self.set_namespace_data(action='test', label='results', key='lava_test_results_dir', value=lava_test_results_dir) @@ -152,7 +152,7 @@ class LoopMountAction(RetryAction): self.errors = "no file specified to mount" def run(self, connection, max_end_time, args=None): - connection = super(LoopMountAction, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) self.mntdir = mkdtemp(autoremove=False) lava_test_results_dir = self.get_namespace_data(action='test', label='results', key='lava_test_results_dir') test_mntdir = os.path.abspath("%s/%s" % (self.mntdir, lava_test_results_dir)) @@ -172,7 +172,7 @@ class LoopMountAction(RetryAction): return connection def cleanup(self, connection): - super(LoopMountAction, self).cleanup(connection) + super().cleanup(connection) self.logger.debug("%s cleanup", self.name) if self.mntdir: if os.path.ismount(self.mntdir): @@ -193,7 +193,7 @@ class MountAction(DeployAction): summary = "mount loop" def __init__(self, key): - super(MountAction, self).__init__() + super().__init__() self.key = key def populate(self, parameters): @@ -233,6 +233,6 @@ class Unmount(Action): """ rmtree is not a cleanup action - it needs to be umounted first. """ - connection = super(Unmount, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) # mntdir was never being set correctly return connection diff --git a/lava_dispatcher/actions/deploy/nbd.py b/lava_dispatcher/actions/deploy/nbd.py index 3a066f9a4..e20d69313 100644 --- a/lava_dispatcher/actions/deploy/nbd.py +++ b/lava_dispatcher/actions/deploy/nbd.py @@ -47,7 +47,7 @@ class Nbd(Deployment): name = 'nbd' def __init__(self, parent, parameters): - super(Nbd, self).__init__(parent) + super().__init__(parent) self.action = NbdAction() self.action.section = self.action_type self.action.job = self.job @@ -71,13 +71,13 @@ class NbdAction(DeployAction): # pylint:disable=too-many-instance-attributes summary = "nbd deployment" def __init__(self): - super(NbdAction, self).__init__() + super().__init__() self.tftp_dir = None self.nbd_ip = None self.nbd_port = None def validate(self): - super(NbdAction, self).validate() + super().validate() if 'kernel' not in self.parameters: self.errors = "%s needs a kernel to deploy" % self.name if not self.valid: @@ -141,13 +141,13 @@ class XnbdAction(DeployAction): summary = "xnbd daemon" def __init__(self): - super(XnbdAction, self).__init__() + super().__init__() self.protocol = XnbdProtocol.name self.nbd_server_port = None self.nbd_server_ip = None def run(self, connection, max_end_time, args=None): - connection = super(XnbdAction, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) self.logger.debug("%s: starting xnbd-server", self.name) # pull from parameters - as previously set self.nbd_root = self.parameters['lava-xnbd']['nbdroot'] diff --git a/lava_dispatcher/actions/deploy/nfs.py b/lava_dispatcher/actions/deploy/nfs.py index fa6203bfe..32c56035f 100644 --- a/lava_dispatcher/actions/deploy/nfs.py +++ b/lava_dispatcher/actions/deploy/nfs.py @@ -44,7 +44,7 @@ class Nfs(Deployment): name = 'nfs' def __init__(self, parent, parameters): - super(Nfs, self).__init__(parent) + super().__init__(parent) self.action = NfsAction() self.action.section = self.action_type self.action.job = self.job @@ -70,7 +70,7 @@ class NfsAction(DeployAction): # pylint:disable=too-many-instance-attributes summary = "NFS deployment" def validate(self): - super(NfsAction, self).validate() + super().validate() if not self.valid: return if 'nfsrootfs' in self.parameters and 'persistent_nfs' in self.parameters: diff --git a/lava_dispatcher/actions/deploy/overlay.py b/lava_dispatcher/actions/deploy/overlay.py index 7bb5a86b5..f79d0ffc5 100644 --- a/lava_dispatcher/actions/deploy/overlay.py +++ b/lava_dispatcher/actions/deploy/overlay.py @@ -48,7 +48,7 @@ class Overlay(Deployment): name = "overlay" def __init__(self, parent, parameters): - super(Overlay, self).__init__(parent) + super().__init__(parent) self.action = OverlayAction() self.action.section = self.action_type self.action.job = self.job @@ -90,7 +90,7 @@ class OverlayAction(DeployAction): summary = "overlay the lava support scripts" def __init__(self): - super(OverlayAction, self).__init__() + super().__init__() self.lava_test_dir = os.path.realpath( '%s/../../lava_test_shell' % os.path.dirname(__file__)) self.scripts_to_copy = [] @@ -102,7 +102,7 @@ class OverlayAction(DeployAction): self.probe_channel = '' def validate(self): - super(OverlayAction, self).validate() + super().validate() self.scripts_to_copy = sorted(glob.glob(os.path.join(self.lava_test_dir, 'lava-*'))) # Distro-specific scripts override the generic ones if not self.test_needs_overlay(self.parameters): @@ -211,7 +211,7 @@ class OverlayAction(DeployAction): continue fout.write("%s=%s\n" % (key, value)) - connection = super(OverlayAction, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) return connection @@ -222,7 +222,7 @@ class MultinodeOverlayAction(OverlayAction): summary = "overlay the lava multinode scripts" def __init__(self): - super(MultinodeOverlayAction, self).__init__() + super().__init__() # Multinode-only self.lava_multi_node_test_dir = os.path.realpath( '%s/../../lava_test_shell/multi_node' % os.path.dirname(__file__)) @@ -236,7 +236,7 @@ class MultinodeOverlayAction(OverlayAction): pass def validate(self): - super(MultinodeOverlayAction, self).validate() + super().validate() # idempotency if 'actions' not in self.job.parameters: return @@ -315,7 +315,7 @@ class VlandOverlayAction(OverlayAction): summary = "Add files detailing vlan configuration." def __init__(self): - super(VlandOverlayAction, self).__init__() + super().__init__() # vland-only self.lava_vland_test_dir = os.path.realpath( '%s/../../lava_test_shell/vland' % os.path.dirname(__file__)) @@ -332,7 +332,7 @@ class VlandOverlayAction(OverlayAction): pass def validate(self): - super(VlandOverlayAction, self).validate() + super().validate() # idempotency if 'actions' not in self.job.parameters: return @@ -447,7 +447,7 @@ class CompressOverlay(Action): if not self.valid: self.logger.error(self.errors) return connection - connection = super(CompressOverlay, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) with chdir(location): try: with tarfile.open(output, "w:gz") as tar: @@ -481,12 +481,12 @@ class SshAuthorize(Action): summary = 'add public key to authorized_keys' def __init__(self): - super(SshAuthorize, self).__init__() + super().__init__() self.active = False self.identity_file = None def validate(self): - super(SshAuthorize, self).validate() + super().validate() if 'to' in self.parameters: if self.parameters['to'] == 'ssh': return @@ -509,7 +509,7 @@ class SshAuthorize(Action): self.active = True def run(self, connection, max_end_time, args=None): - connection = super(SshAuthorize, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) if not self.identity_file: self.logger.debug("No authorisation required.") # idempotency return connection @@ -553,7 +553,7 @@ class PersistentNFSOverlay(Action): summary = "add test overlay to NFS" def validate(self): - super(PersistentNFSOverlay, self).validate() + super().validate() persist = self.parameters.get('persistent_nfs', None) if not persist: return diff --git a/lava_dispatcher/actions/deploy/prepare.py b/lava_dispatcher/actions/deploy/prepare.py index 74b915c94..ed4ed9a15 100644 --- a/lava_dispatcher/actions/deploy/prepare.py +++ b/lava_dispatcher/actions/deploy/prepare.py @@ -58,7 +58,7 @@ class UBootPrepareKernelAction(Action): summary = "prepare/convert kernel" def __init__(self): - super(UBootPrepareKernelAction, self).__init__() + super().__init__() self.bootcommand = None self.params = None self.kernel_type = None @@ -92,7 +92,7 @@ class UBootPrepareKernelAction(Action): raise InfrastructureError("uImage creation failed") def validate(self): - super(UBootPrepareKernelAction, self).validate() + super().validate() if 'parameters' not in self.job.device['actions']['deploy']: return self.params = self.job.device['actions']['deploy']['parameters'] @@ -123,7 +123,7 @@ class UBootPrepareKernelAction(Action): key='bootcommand', value=self.bootcommand) def run(self, connection, max_end_time, args=None): - connection = super(UBootPrepareKernelAction, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) if not self.kernel_type: return connection # idempotency old_kernel = self.get_namespace_data( @@ -172,12 +172,12 @@ class PrepareFITAction(Action): summary = "generate depthcharge FIT image" def __init__(self): - super(PrepareFITAction, self).__init__() + super().__init__() self.deploy_params = None self.device_params = None def validate(self): - super(PrepareFITAction, self).validate() + super().validate() which('mkimage') deploy_params = self.job.device['actions']['deploy'].get('parameters') @@ -218,8 +218,7 @@ class PrepareFITAction(Action): return cmd def run(self, connection, max_end_time, args=None): - connection = super(PrepareFITAction, self).run( - connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) params = { label: self.get_namespace_data( action='download-action', label=label, key='file') diff --git a/lava_dispatcher/actions/deploy/removable.py b/lava_dispatcher/actions/deploy/removable.py index c82e6f863..36e802f43 100644 --- a/lava_dispatcher/actions/deploy/removable.py +++ b/lava_dispatcher/actions/deploy/removable.py @@ -60,7 +60,7 @@ class Removable(Deployment): name = 'removeable' def __init__(self, parent, parameters): - super(Removable, self).__init__(parent) + super().__init__(parent) self.action = MassStorage() self.action.job = self.job self.action.section = self.action_type @@ -99,14 +99,14 @@ class DDAction(Action): summary = "write image to drive" def __init__(self): - super(DDAction, self).__init__() + super().__init__() self.timeout = Timeout(self.name, 600) self.boot_params = None self.tool_prompts = None self.tool_flags = None def validate(self): - super(DDAction, self).validate() + super().validate() if 'device' not in self.parameters: self.errors = "missing device for deployment" @@ -189,7 +189,7 @@ class DDAction(Action): by the test writer, from within the test image of the first deployment, using the device to write directly to the secondary media, without needing to cache on the device. """ - connection = super(DDAction, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) d_file = self.get_namespace_data(action='download-action', label='image', key='file') if not d_file: self.logger.debug("Skipping %s - nothing downloaded") @@ -268,12 +268,12 @@ class MassStorage(DeployAction): # pylint: disable=too-many-instance-attributes summary = "write image to storage" def __init__(self): - super(MassStorage, self).__init__() + super().__init__() self.suffix = None self.image_path = None def validate(self): - super(MassStorage, self).validate() + super().validate() # if 'image' not in self.parameters.keys(): # self.errors = "%s needs an image to deploy" % self.name if 'device' not in self.parameters: diff --git a/lava_dispatcher/actions/deploy/ssh.py b/lava_dispatcher/actions/deploy/ssh.py index b9291b33f..001a8a664 100644 --- a/lava_dispatcher/actions/deploy/ssh.py +++ b/lava_dispatcher/actions/deploy/ssh.py @@ -49,7 +49,7 @@ class Ssh(Deployment): name = 'ssh' def __init__(self, parent, parameters): - super(Ssh, self).__init__(parent) + super().__init__(parent) self.action = ScpOverlay() self.action.job = self.job parent.add_action(self.action, parameters) @@ -74,11 +74,11 @@ class ScpOverlay(DeployAction): summary = "copy overlay to device" def __init__(self): - super(ScpOverlay, self).__init__() + super().__init__() self.items = [] def validate(self): - super(ScpOverlay, self).validate() + super().validate() self.items = [ 'firmware', 'kernel', 'dtb', 'rootfs', 'modules' ] @@ -113,11 +113,11 @@ class PrepareOverlayScp(Action): summary = "scp the overlay to the remote device" def __init__(self): - super(PrepareOverlayScp, self).__init__() + super().__init__() self.host_keys = [] def validate(self): - super(PrepareOverlayScp, self).validate() + super().validate() environment = self.get_namespace_data( action='deploy-device-env', label='environment', @@ -150,7 +150,7 @@ class PrepareOverlayScp(Action): self.internal_pipeline.add_action(ExtractModules()) # idempotent, checks for a modules parameter def run(self, connection, max_end_time, args=None): - connection = super(PrepareOverlayScp, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) overlay_file = self.get_namespace_data(action='compress-overlay', label='output', key='file') self.logger.info("Preparing to copy: %s", os.path.basename(overlay_file)) self.set_namespace_data(action=self.name, label='scp-deploy', key='overlay', value=overlay_file) diff --git a/lava_dispatcher/actions/deploy/testdef.py b/lava_dispatcher/actions/deploy/testdef.py index c1d315283..49bd6d35d 100644 --- a/lava_dispatcher/actions/deploy/testdef.py +++ b/lava_dispatcher/actions/deploy/testdef.py @@ -141,7 +141,7 @@ class RepoAction(Action): summary = "repo base class" def __init__(self): - super(RepoAction, self).__init__() + super().__init__() self.vcs = None self.runner = None self.default_pattern = DEFAULT_V1_PATTERN @@ -171,7 +171,7 @@ class RepoAction(Action): raise LAVABug("RepoAction validate called super without setting the vcs") if not os.path.exists(self.vcs.binary): self.errors = "%s is not installed on the dispatcher." % self.vcs.binary - super(RepoAction, self).validate() + super().validate() # FIXME: unused # list of levels involved in the repo actions for this overlay @@ -194,7 +194,7 @@ class RepoAction(Action): Better approach will be to create the entire overlay without mounting and then unpack an overlay.tgz after mounting. """ - connection = super(RepoAction, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) if args is None or 'test_name' not in args: raise LAVABug("RepoAction run called via super without parameters as arguments") @@ -286,7 +286,7 @@ class GitRepoAction(RepoAction): # pylint: disable=too-many-public-methods if not self.valid: return self.vcs = GitHelper(self.parameters['repository']) - super(GitRepoAction, self).validate() + super().validate() @classmethod def accepts(cls, repo_type): @@ -300,7 +300,7 @@ class GitRepoAction(RepoAction): # pylint: disable=too-many-public-methods Also updates some basic metadata about the test definition. """ # use the base class to populate the runner_path and overlay_path data into the context - connection = super(GitRepoAction, self).run(connection, max_end_time, self.parameters) + connection = super().run(connection, max_end_time, self.parameters) # NOTE: the runner_path dir must remain empty until after the VCS clone, so let the VCS clone create the final dir runner_path = self.get_namespace_data(action='uuid', label='overlay_path', key=self.parameters['test_name']) @@ -367,7 +367,7 @@ class BzrRepoAction(RepoAction): # pylint: disable=too-many-public-methods summary = "branch a bzr test repo" def __init__(self): - super(BzrRepoAction, self).__init__() + super().__init__() self.testdef = None def validate(self): @@ -378,7 +378,7 @@ class BzrRepoAction(RepoAction): # pylint: disable=too-many-public-methods if not self.valid: return self.vcs = BzrHelper(self.parameters['repository']) - super(BzrRepoAction, self).validate() + super().validate() @classmethod def accepts(cls, repo_type): @@ -388,7 +388,7 @@ class BzrRepoAction(RepoAction): # pylint: disable=too-many-public-methods """ Clone the bazar repository into a directory """ - connection = super(BzrRepoAction, self).run(connection, max_end_time, self.parameters) + connection = super().run(connection, max_end_time, self.parameters) # NOTE: the runner_path dir must remain empty until after the VCS clone, so let the VCS clone create the final dir runner_path = self.get_namespace_data(action='uuid', label='overlay_path', key=args['test_name']) @@ -433,7 +433,7 @@ class InlineRepoAction(RepoAction): # pylint: disable=too-many-public-methods self.errors = "Invalid inline definition in job definition" if not self.valid: return - super(InlineRepoAction, self).validate() + super().validate() @classmethod def accepts(cls, repo_type): @@ -444,7 +444,7 @@ class InlineRepoAction(RepoAction): # pylint: disable=too-many-public-methods Extract the inlined test definition and dump it onto the target image """ # use the base class to populate the runner_path and overlay_path data into the context - connection = super(InlineRepoAction, self).run(connection, max_end_time, self.parameters) + connection = super().run(connection, max_end_time, self.parameters) # NOTE: the runner_path dir must remain empty until after the VCS clone, so let the VCS clone create the final dir runner_path = self.get_namespace_data(action='uuid', label='overlay_path', key=self.parameters['test_name']) @@ -476,7 +476,7 @@ class TarRepoAction(RepoAction): # pylint: disable=too-many-public-methods summary = "unpack tar test repo" def __init__(self): - super(TarRepoAction, self).__init__() + super().__init__() self.vcs_binary = "/bin/tar" @classmethod @@ -487,7 +487,7 @@ class TarRepoAction(RepoAction): # pylint: disable=too-many-public-methods """ Extracts the provided encoded tar archive into tmpdir. """ - connection = super(TarRepoAction, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) runner_path = self.get_namespace_data(action='uuid', label='overlay_dir', key=self.parameters['test_name']) temp_tar = os.path.join(runner_path, '..', '..', "tar-repo.tar") @@ -527,7 +527,7 @@ class UrlRepoAction(RepoAction): # pylint: disable=too-many-public-methods summary = "download file test" def __init__(self): - super(UrlRepoAction, self).__init__() + super().__init__() self.tmpdir = None # FIXME: needs to be a /mntpoint/lava-%hostname/ directory. self.testdef = None @@ -537,7 +537,7 @@ class UrlRepoAction(RepoAction): # pylint: disable=too-many-public-methods def run(self, connection, max_end_time, args=None): """Download the provided test definition file into tmpdir.""" - super(UrlRepoAction, self).run(connection, max_end_time, args) + super().run(connection, max_end_time, args) runner_path = self.get_namespace_data(action='uuid', label='overlay_dir', key=self.parameters['test_name']) try: @@ -585,7 +585,7 @@ class TestDefinitionAction(TestAction): In addition, a TestOverlayAction is added to the pipeline to handle parts of the overlay which are test definition dependent. """ - super(TestDefinitionAction, self).__init__() + super().__init__() self.test_list = None self.stages = 0 self.run_levels = {} @@ -681,7 +681,7 @@ class TestDefinitionAction(TestAction): res = exp.match(testdef['name']) if not res: self.errors = "Invalid characters found in test definition name: %s" % testdef['name'] - super(TestDefinitionAction, self).validate() + super().validate() for testdefs in self.test_list: for testdef in testdefs: try: @@ -714,7 +714,7 @@ class TestDefinitionAction(TestAction): value=overlay_base ) - connection = super(TestDefinitionAction, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) self.logger.info("Creating lava-test-runner.conf files") for stage in range(self.stages): @@ -746,11 +746,11 @@ class TestOverlayAction(TestAction): # pylint: disable=too-many-instance-attrib so the overlay has access to the same parameters as the handler and is always executed immediately after the relevant handler. """ - super(TestOverlayAction, self).__init__() + super().__init__() self.test_uuid = None # Match the overlay to the handler def validate(self): - super(TestOverlayAction, self).validate() + super().validate() if 'path' not in self.parameters: self.errors = "Missing path in parameters" @@ -803,7 +803,7 @@ class TestOverlayAction(TestAction): # pylint: disable=too-many-instance-attrib return ret_val def run(self, connection, max_end_time, args=None): - connection = super(TestOverlayAction, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) runner_path = self.get_namespace_data(action='uuid', label='overlay_path', key=self.parameters['test_name']) # now read the YAML to create a testdef dict to retrieve metadata @@ -861,7 +861,7 @@ class TestInstallAction(TestOverlayAction): run the internal_pipeline at the start of the TestOverlayAction run step. """ - super(TestInstallAction, self).__init__() + super().__init__() self.test_uuid = None # Match the overlay to the handler self.skip_list = ['keys', 'sources', 'deps', 'steps', 'git-repos', 'all'] # keep 'all' as the last item @@ -876,7 +876,7 @@ class TestInstallAction(TestOverlayAction): self.skip_options = self.skip_list[:-1] # without last item else: self.skip_options = self.parameters['skip_install'] - super(TestInstallAction, self).validate() + super().validate() def _lookup_params(self, lookup_key, variable, testdef): # lookup_key 'branch' @@ -938,7 +938,7 @@ class TestInstallAction(TestOverlayAction): raise JobError("Unable to clone %s" % str((repo))) def run(self, connection, max_end_time, args=None): # pylint: disable=too-many-statements - connection = super(TestInstallAction, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) runner_path = self.get_namespace_data(action='uuid', label='overlay_path', key=self.parameters['test_name']) # now read the YAML to create a testdef dict to retrieve metadata @@ -1018,11 +1018,11 @@ class TestRunnerAction(TestOverlayAction): summary = "applying LAVA test run script" def __init__(self): - super(TestRunnerAction, self).__init__() + super().__init__() self.testdef_levels = {} # allow looking up the testname from the level of this action def validate(self): - super(TestRunnerAction, self).validate() + super().validate() testdef_index = self.get_namespace_data( action='test-definition', label='test-definition', @@ -1048,7 +1048,7 @@ class TestRunnerAction(TestOverlayAction): self.set_namespace_data(action=self.name, label=self.name, key='testdef_levels', value=current) def run(self, connection, max_end_time, args=None): - connection = super(TestRunnerAction, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) runner_path = self.get_namespace_data(action='uuid', label='overlay_path', key=self.parameters['test_name']) # now read the YAML to create a testdef dict to retrieve metadata diff --git a/lava_dispatcher/actions/deploy/tftp.py b/lava_dispatcher/actions/deploy/tftp.py index 5a4c15142..aa0a890ff 100644 --- a/lava_dispatcher/actions/deploy/tftp.py +++ b/lava_dispatcher/actions/deploy/tftp.py @@ -51,7 +51,7 @@ class Tftp(Deployment): name = 'tftp' def __init__(self, parent, parameters): - super(Tftp, self).__init__(parent) + super().__init__(parent) self.action = TftpAction() self.action.section = self.action_type self.action.job = self.job @@ -75,11 +75,11 @@ class TftpAction(DeployAction): # pylint:disable=too-many-instance-attributes summary = "tftp deployment" def __init__(self): - super(TftpAction, self).__init__() + super().__init__() self.tftp_dir = None def validate(self): - super(TftpAction, self).validate() + super().validate() if 'kernel' not in self.parameters: self.errors = "%s needs a kernel to deploy" % self.name if not self.valid: @@ -120,7 +120,7 @@ class TftpAction(DeployAction): # pylint:disable=too-many-instance-attributes self.internal_pipeline.add_action(DeployDeviceEnvironment()) def run(self, connection, max_end_time, args=None): - super(TftpAction, self).run(connection, max_end_time, args) + super().run(connection, max_end_time, args) tftp_size_limit = self.job.parameters['dispatcher'].get('tftp_size_limit', TFTP_SIZE_LIMIT) self.logger.debug("Checking files for TFTP limit of %s bytes.", tftp_size_limit) diff --git a/lava_dispatcher/actions/deploy/uboot_ums.py b/lava_dispatcher/actions/deploy/uboot_ums.py index 689497350..73bf363e8 100644 --- a/lava_dispatcher/actions/deploy/uboot_ums.py +++ b/lava_dispatcher/actions/deploy/uboot_ums.py @@ -39,7 +39,7 @@ class UBootUMS(Deployment): name = 'uboot-ums' def __init__(self, parent, parameters): - super(UBootUMS, self).__init__(parent) + super().__init__(parent) self.action = UBootUMSAction() self.action.section = self.action_type self.action.job = self.job diff --git a/lava_dispatcher/actions/deploy/vemsd.py b/lava_dispatcher/actions/deploy/vemsd.py index c38734371..391426e47 100644 --- a/lava_dispatcher/actions/deploy/vemsd.py +++ b/lava_dispatcher/actions/deploy/vemsd.py @@ -60,7 +60,7 @@ class VExpressMsd(Deployment): name = 'vemsd' def __init__(self, parent, parameters): - super(VExpressMsd, self).__init__(parent) + super().__init__(parent) self.action = VExpressMsdAction() self.action.section = self.action_type self.action.job = self.job @@ -93,7 +93,7 @@ class VExpressMsdAction(DeployAction): summary = "VExpress FW deployment" def validate(self): - super(VExpressMsdAction, self).validate() + super().validate() if not self.valid: return if not self.parameters.get('recovery_image', None): # idempotency @@ -128,13 +128,13 @@ class ExtractVExpressRecoveryImage(Action): summary = "unpack versatile express recovery image ready for deployment" def __init__(self): - super(ExtractVExpressRecoveryImage, self).__init__() + super().__init__() self.param_key = 'recovery_image' self.file_key = "recovery_image" self.compression = None def validate(self): - super(ExtractVExpressRecoveryImage, self).validate() + super().validate() if not self.get_namespace_data( action='download-action', label=self.param_key, key='file'): self.errors = "no file specified extract as %s" % self.param_key @@ -144,7 +144,7 @@ class ExtractVExpressRecoveryImage(Action): self.errors = "no compression set for recovery image" def run(self, connection, max_end_time, args=None): - connection = super(ExtractVExpressRecoveryImage, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) # copy recovery image to a temporary directory and unpack recovery_image = self.get_namespace_data(action='download-action', label=self.param_key, key='file') @@ -178,14 +178,14 @@ class EnterVExpressMCC(Action): summary = "enter Versatile Express MCC, interrupting autorun if needed" def __init__(self): - super(EnterVExpressMCC, self).__init__() + super().__init__() self.device_params = None self.interrupt_char = None self.mcc_prompt = None self.autorun_prompt = None def validate(self): - super(EnterVExpressMCC, self).validate() + super().validate() if not self.valid: return self.device_params = self.job.device['actions']['deploy']['methods']['vemsd']['parameters'] @@ -200,7 +200,7 @@ class EnterVExpressMCC(Action): def run(self, connection, max_end_time, args=None): if not connection: raise LAVABug("%s started without a connection already in use" % self.name) - connection = super(EnterVExpressMCC, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) # Get possible prompts from device config connection.prompt_str = [self.autorun_prompt, self.mcc_prompt] @@ -227,12 +227,12 @@ class EnableVExpressMassStorage(Action): summary = "enable vexpress usb mass storage device" def __init__(self): - super(EnableVExpressMassStorage, self).__init__() + super().__init__() self.mcc_prompt = None self.mcc_cmd = None def validate(self): - super(EnableVExpressMassStorage, self).validate() + super().validate() device_params = self.job.device['actions']['deploy']['methods']['vemsd']['parameters'] self.mcc_prompt = device_params.get('mcc_prompt') self.mcc_cmd = device_params.get('msd_mount_cmd') @@ -244,7 +244,7 @@ class EnableVExpressMassStorage(Action): def run(self, connection, max_end_time, args=None): if not connection: raise LAVABug("%s started without a connection already in use" % self.name) - connection = super(EnableVExpressMassStorage, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) # Issue command and check that you are returned to the prompt again connection.sendline('%s\n' % self.mcc_cmd) @@ -266,17 +266,17 @@ class MountVExpressMassStorageDevice(Action): summary = "mount vexpress usb mass storage device on the dispatcher" def __init__(self): - super(MountVExpressMassStorageDevice, self).__init__() + super().__init__() self.microsd_fs_label = None def validate(self): - super(MountVExpressMassStorageDevice, self).validate() + super().validate() self.microsd_fs_label = self.job.device.get('usb_filesystem_label') if not isinstance(self.microsd_fs_label, str): self.errors = 'Filesystem label unset for Versatile Express' def run(self, connection, max_end_time, args=None): - connection = super(MountVExpressMassStorageDevice, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) device_path = "/dev/disk/by-label/%s" % self.microsd_fs_label try: @@ -310,12 +310,12 @@ class DeployVExpressRecoveryImage(Action): summary = "copy recovery image contents to vexpress usb mass storage device" def validate(self): - super(DeployVExpressRecoveryImage, self).validate() + super().validate() if not self.valid: return def run(self, connection, max_end_time, args=None): - connection = super(DeployVExpressRecoveryImage, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) mount_point = self.get_namespace_data(action='mount-vexpress-usbmsd', label='vexpress-fw', key='mount-point') try: os.path.realpath(mount_point) @@ -352,7 +352,7 @@ class UnmountVExpressMassStorageDevice(Action): summary = "unmount vexpress usb mass storage device" def run(self, connection, max_end_time, args=None): - connection = super(UnmountVExpressMassStorageDevice, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) mount_point = self.get_namespace_data(action='mount-vexpress-usbmsd', label='vexpress-fw', key='mount-point') if not self.run_command(["umount", mount_point], allow_silent=True): @@ -371,7 +371,7 @@ class VExpressFlashErase(Action): # pylint: disable=too-many-instance-attribute summary = "erase vexpress flash using the commands set by the user" def __init__(self): - super(VExpressFlashErase, self).__init__() + super().__init__() self.mcc_prompt = None self.flash_prompt = None self.flash_enter_cmd = None @@ -380,7 +380,7 @@ class VExpressFlashErase(Action): # pylint: disable=too-many-instance-attribute self.flash_exit_cmd = None def validate(self): - super(VExpressFlashErase, self).validate() + super().validate() device_methods = self.job.device['actions']['deploy']['methods'] self.mcc_prompt = device_methods['vemsd']['parameters'].get('mcc_prompt') self.flash_prompt = device_methods['vemsd']['parameters'].get('flash_prompt') @@ -404,7 +404,7 @@ class VExpressFlashErase(Action): # pylint: disable=too-many-instance-attribute def run(self, connection, max_end_time, args=None): if not connection: raise RuntimeError("%s started without a connection already in use" % self.name) - connection = super(VExpressFlashErase, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) # From Versatile Express MCC, enter flash menu connection.sendline('%s\n' % self.flash_enter_cmd) diff --git a/lava_dispatcher/actions/test/monitor.py b/lava_dispatcher/actions/test/monitor.py index d04f58304..048afd456 100644 --- a/lava_dispatcher/actions/test/monitor.py +++ b/lava_dispatcher/actions/test/monitor.py @@ -41,7 +41,7 @@ class TestMonitor(LavaTest): LavaTestMonitor Strategy object """ def __init__(self, parent, parameters): - super(TestMonitor, self).__init__(parent) + super().__init__(parent) self.action = TestMonitorRetry() self.action.job = self.job self.action.section = self.action_type @@ -96,14 +96,14 @@ class TestMonitorAction(TestAction): # pylint: disable=too-many-instance-attrib summary = "Lava Test Monitor" def __init__(self): - super(TestMonitorAction, self).__init__() + super().__init__() self.test_suite_name = None self.report = {} self.fixupdict = {} self.patterns = {} def run(self, connection, max_end_time, args=None): - connection = super(TestMonitorAction, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) if not connection: raise InfrastructureError("Connection closed") diff --git a/lava_dispatcher/actions/test/multinode.py b/lava_dispatcher/actions/test/multinode.py index 4efae9bb8..df1a6feb7 100644 --- a/lava_dispatcher/actions/test/multinode.py +++ b/lava_dispatcher/actions/test/multinode.py @@ -37,7 +37,7 @@ class MultinodeTestShell(LavaTest): priority = 2 def __init__(self, parent, parameters): - super(MultinodeTestShell, self).__init__(parent) + super().__init__(parent) self.action = MultinodeTestAction() self.action.job = self.job self.action.section = self.action_type @@ -75,13 +75,13 @@ class MultinodeTestAction(TestShellAction): summary = "Multinode Lava Test Shell" def __init__(self): - super(MultinodeTestAction, self).__init__() + super().__init__() self.multinode_dict = { 'multinode': r'<LAVA_MULTI_NODE> <LAVA_(\S+) ([^>]+)>', } def validate(self): - super(MultinodeTestAction, self).validate() + super().validate() # MultinodeProtocol is required, others can be optional if MultinodeProtocol.name not in [protocol.name for protocol in self.job.protocols]: self.errors = "Invalid job - missing protocol" @@ -94,7 +94,7 @@ class MultinodeTestAction(TestShellAction): self.signal_director.setup(self.parameters) def _reset_patterns(self): - super(MultinodeTestAction, self)._reset_patterns() + super()._reset_patterns() self.patterns.update(self.multinode_dict) def populate(self, parameters): @@ -108,7 +108,7 @@ class MultinodeTestAction(TestShellAction): """ Calls the parent check_patterns first, then checks for subclass pattern. """ - ret = super(MultinodeTestAction, self).check_patterns(event, test_connection, check_char) + ret = super().check_patterns(event, test_connection, check_char) if event == 'multinode': name, params = test_connection.match.groups() self.logger.debug("Received Multi_Node API <LAVA_%s>" % name) @@ -135,7 +135,7 @@ class MultinodeTestAction(TestShellAction): class SignalDirector(TestShellAction.SignalDirector): def __init__(self, protocol): - super(MultinodeTestAction.SignalDirector, self).__init__(protocol) + super().__init__(protocol) self.base_message = {} def setup(self, parameters): diff --git a/lava_dispatcher/actions/test/shell.py b/lava_dispatcher/actions/test/shell.py index 050cce5d1..7fb6795f4 100644 --- a/lava_dispatcher/actions/test/shell.py +++ b/lava_dispatcher/actions/test/shell.py @@ -59,7 +59,7 @@ class TestShell(LavaTest): LavaTestShell Strategy object """ def __init__(self, parent, parameters): - super(TestShell, self).__init__(parent) + super().__init__(parent) self.action = TestShellRetry() self.action.job = self.job self.action.section = self.action_type @@ -104,7 +104,7 @@ class PatternFixup(object): Avoid calling from validate() or populate() - this needs the RepoAction to be running. """ - super(PatternFixup, self).__init__() + super().__init__() self.pat = DEFAULT_V1_PATTERN self.fixup = DEFAULT_V1_FIXUP if isinstance(testdef, dict) and 'metadata' in testdef: @@ -155,7 +155,7 @@ class TestShellAction(TestAction): summary = "Lava Test Shell" def __init__(self): - super(TestShellAction, self).__init__() + super().__init__() self.signal_director = self.SignalDirector(None) # no default protocol self.patterns = {} self.signal_match = SignalMatch() @@ -186,13 +186,13 @@ class TestShellAction(TestAction): if "repository" not in testdef: self.errors = "Repository missing from test definition" self._reset_patterns() - super(TestShellAction, self).validate() + super().validate() def run(self, connection, max_end_time, args=None): # pylint: disable=too-many-locals """ Common run function for subclasses which define custom patterns """ - super(TestShellAction, self).run(connection, max_end_time, args) + super().run(connection, max_end_time, args) # Get the connection, specific to this namespace connection_namespace = self.parameters.get('connection-namespace', None) diff --git a/lava_dispatcher/connections/lxc.py b/lava_dispatcher/connections/lxc.py index f82b52ce6..c875ade72 100644 --- a/lava_dispatcher/connections/lxc.py +++ b/lava_dispatcher/connections/lxc.py @@ -37,7 +37,7 @@ class LxcSession(ShellSession): def finalise(self): self.disconnect("closing") - super(LxcSession, self).finalise() + super().finalise() def disconnect(self, reason=''): self.sendline('exit', disconnecting=True) @@ -54,14 +54,14 @@ class ConnectLxc(Action): summary = "run connection command" def __init__(self): - super(ConnectLxc, self).__init__() + super().__init__() self.session_class = LxcSession self.shell_class = ShellCommand def validate(self): if 'lxc' not in self.job.device['actions']['boot']['methods']: return - super(ConnectLxc, self).validate() + super().validate() which('lxc-attach') def run(self, connection, max_end_time, args=None): @@ -90,7 +90,7 @@ class ConnectLxc(Action): # LxcSession monitors the pexpect connection = self.session_class(self.job, shell) connection.connected = True - connection = super(ConnectLxc, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) connection.prompt_str = self.parameters['prompts'] self.set_namespace_data(action='shared', label='shared', key='connection', value=connection) return connection diff --git a/lava_dispatcher/connections/serial.py b/lava_dispatcher/connections/serial.py index 5ce8ee681..bab3f4f3d 100644 --- a/lava_dispatcher/connections/serial.py +++ b/lava_dispatcher/connections/serial.py @@ -46,7 +46,7 @@ class ConnectDevice(Action): timeout_exception = InfrastructureError def __init__(self): - super(ConnectDevice, self).__init__() + super().__init__() self.session_class = ShellSession # wraps the pexpect and provides prompt_str access self.shell_class = ShellCommand # runs the command to initiate the connection self.command = '' @@ -64,7 +64,7 @@ class ConnectDevice(Action): which(exe) def validate(self): - super(ConnectDevice, self).validate() + super().validate() matched = False if 'connect' in self.job.device['commands']: # deprecated but allowed for primary @@ -135,7 +135,7 @@ class ConnectDevice(Action): connection.connected = True if self.hardware: connection.tags = self.tag_dict[self.hardware] - connection = super(ConnectDevice, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) if not connection.prompt_str: connection.prompt_str = [self.job.device.get_constant( 'default-shell-prompt')] @@ -150,7 +150,7 @@ class ConnectShell(ConnectDevice): """ def __init__(self, name=None): - super(ConnectShell, self).__init__() + super().__init__() self.name = "connect-shell" self.primary = False self.hardware = name @@ -161,7 +161,7 @@ class ConnectShell(ConnectDevice): self.shell_class = ShellCommand # runs the command to initiate the connection def validate(self): - super(ConnectShell, self).validate() + super().validate() if 'connections' not in self.job.device['commands']: self.errors = "Unable to connect to shell - missing connections block." return @@ -169,7 +169,7 @@ class ConnectShell(ConnectDevice): def run(self, connection, max_end_time, args=None): # explicitly call the base class run() - connection = super(ConnectShell, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) self.logger.debug("Forcing a prompt") # force a prompt to appear without using a character that could be interpreted as a username connection.sendline('') diff --git a/lava_dispatcher/connections/ssh.py b/lava_dispatcher/connections/ssh.py index fc6a19809..3fe049942 100644 --- a/lava_dispatcher/connections/ssh.py +++ b/lava_dispatcher/connections/ssh.py @@ -38,7 +38,7 @@ class SShSession(ShellSession): def finalise(self): self.disconnect("closing") - super(SShSession, self).finalise() + super().finalise() def disconnect(self, reason=''): # FIXME: handle super if tags are present. @@ -68,7 +68,7 @@ class ConnectSsh(Action): timeout_exception = InfrastructureError def __init__(self): - super(ConnectSsh, self).__init__() + super().__init__() self.command = None self.host = None self.ssh_port = ["-p", "22"] @@ -110,7 +110,7 @@ class ConnectSsh(Action): return params['ssh'] def validate(self): - super(ConnectSsh, self).validate() + super().validate() params = self._check_params() which('ssh') if 'host' in self.job.device['actions']['deploy']['methods']['ssh']: @@ -161,7 +161,7 @@ class ConnectSsh(Action): self.command, shell.exitstatus, shell.readlines())) # SshSession monitors the pexpect connection = SShSession(self.job, shell) - connection = super(ConnectSsh, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) connection.sendline('export PS1="%s"' % self.job.device.get_constant( 'default-shell-prompt')) connection.prompt_str = [self.job.device.get_constant( diff --git a/lava_dispatcher/device.py b/lava_dispatcher/device.py index 4ca8d916f..e4e175074 100644 --- a/lava_dispatcher/device.py +++ b/lava_dispatcher/device.py @@ -32,7 +32,7 @@ class PipelineDevice(dict): """ def __init__(self, config): - super(PipelineDevice, self).__init__() + super().__init__() self.update(config) def check_config(self, job): @@ -99,7 +99,7 @@ class NewDevice(PipelineDevice): """ def __init__(self, target): - super(NewDevice, self).__init__({}) + super().__init__({}) # Parse the yaml configuration try: if isinstance(target, str): diff --git a/lava_dispatcher/diagnostics.py b/lava_dispatcher/diagnostics.py index bf430e794..f32da1281 100644 --- a/lava_dispatcher/diagnostics.py +++ b/lava_dispatcher/diagnostics.py @@ -36,7 +36,7 @@ class DiagnoseNetwork(DiagnosticAction): return "network" def run(self, connection, max_end_time, args=None): - connection = super(DiagnoseNetwork, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) return connection @@ -54,7 +54,7 @@ class DiagnoseTargetNetwork(DiagnosticAction): return "target-network" def run(self, connection, max_end_time, args=None): - connection = super(DiagnoseTargetNetwork, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) return connection @@ -71,6 +71,6 @@ class DiagnoseUBoot(DiagnosticAction): return "uboot-printenv" def run(self, connection, max_end_time, args=None): - connection = super(DiagnoseUBoot, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) # FIXME: write the support for reset, including running PDU command return connection diff --git a/lava_dispatcher/log.py b/lava_dispatcher/log.py index 60652a063..7e900d517 100644 --- a/lava_dispatcher/log.py +++ b/lava_dispatcher/log.py @@ -29,7 +29,7 @@ from zmq.utils.strtypes import b class ZMQPushHandler(logging.Handler): def __init__(self, logging_url, master_cert, slave_cert, job_id, ipv6): - super(ZMQPushHandler, self).__init__() + super().__init__() # Keep track of the parameters self.logging_url = logging_url @@ -67,13 +67,13 @@ class ZMQPushHandler(logging.Handler): # If the process crashes really early, the handler will be closed # directly by the logging module. In this case, close is called without # any arguments. - super(ZMQPushHandler, self).close() + super().close() self.context.destroy(linger=linger) class YAMLLogger(logging.Logger): def __init__(self, name): - super(YAMLLogger, self).__init__(name) + super().__init__(name) self.handler = None def addZMQHandler(self, logging_url, master_cert, slave_cert, job_id, ipv6): diff --git a/lava_dispatcher/logical.py b/lava_dispatcher/logical.py index 5f68e39dc..deed0fc94 100644 --- a/lava_dispatcher/logical.py +++ b/lava_dispatcher/logical.py @@ -38,7 +38,7 @@ class RetryAction(Action): """ def __init__(self): - super(RetryAction, self).__init__() + super().__init__() self.sleep = 1 def validate(self): @@ -47,7 +47,7 @@ class RetryAction(Action): so that the retry logic only occurs once and applies equally to the entire pipeline of the retry. """ - super(RetryAction, self).validate() + super().validate() if not self.internal_pipeline: raise LAVABug("Retry action %s needs to implement an internal pipeline" % self.name) diff --git a/lava_dispatcher/menus/menus.py b/lava_dispatcher/menus/menus.py index 1d1b8d0a0..82a6745cb 100644 --- a/lava_dispatcher/menus/menus.py +++ b/lava_dispatcher/menus/menus.py @@ -42,7 +42,7 @@ class MenuInterrupt(Action): summary = "base menu interrupt action" def __init__(self): - super(MenuInterrupt, self).__init__() + super().__init__() self.interrupt_prompt = None self.interrupt_string = None @@ -112,7 +112,7 @@ class MenuConnect(ConnectDevice): summary = "Customise connection for menu operations" def __init__(self): - super(MenuConnect, self).__init__() + super().__init__() self.session_class = MenuSession def validate(self): @@ -120,7 +120,7 @@ class MenuConnect(ConnectDevice): self.errors = "Unable to connect to device" def run(self, connection, max_end_time, args=None): - connection = super(MenuConnect, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) if not connection: raise LAVABug("%s needs a Connection") connection.check_char = '\n' @@ -138,11 +138,11 @@ class MenuReset(ConnectDevice): summary = "reset to shell connection" def __init__(self): - super(MenuReset, self).__init__() + super().__init__() self.session_class = ShellSession def run(self, connection, max_end_time, args=None): - connection = super(MenuReset, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) if not connection: raise LAVABug("%s needs a Connection") @@ -158,13 +158,13 @@ class SelectorMenuAction(Action): summary = 'select options in a menu' def __init__(self): - super(SelectorMenuAction, self).__init__() + super().__init__() self.selector = SelectorMenu() self.items = [] self.line_sep = None def validate(self): - super(SelectorMenuAction, self).validate() + super().validate() # check for allowed items, error if any are unrecognised item_keys = {} if not isinstance(self.items, list): @@ -195,7 +195,7 @@ class SelectorMenuAction(Action): :param logger: Action logger :return: connection """ - connection = super(SelectorMenuAction, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) if not connection: self.logger.error("%s called without a Connection", self.name) return connection @@ -235,5 +235,5 @@ class SelectorMenuAction(Action): class DebianInstallerMenu(MovementMenu): def __init__(self): - super(DebianInstallerMenu, self).__init__() + super().__init__() self.down_command = '[1B' diff --git a/lava_dispatcher/power.py b/lava_dispatcher/power.py index 47e949447..88b495e34 100644 --- a/lava_dispatcher/power.py +++ b/lava_dispatcher/power.py @@ -62,7 +62,7 @@ class SendRebootCommands(Action): summary = 'Issue a reboot command on the device' def run(self, connection, max_end_time, args=None): - connection = super(SendRebootCommands, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) reboot_commands = self.parameters.get('soft_reboot', []) # list if not self.parameters.get('soft_reboot', None): # unit test self.logger.warning('No soft reboot command defined in the test job. Using defaults.') @@ -96,11 +96,11 @@ class PDUReboot(Action): timeout_exception = InfrastructureError def __init__(self): - super(PDUReboot, self).__init__() + super().__init__() self.command = None def run(self, connection, max_end_time, args=None): - connection = super(PDUReboot, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) if not self.job.device.hard_reset_command: raise InfrastructureError("Hard reset required but not defined.") command = self.job.device.hard_reset_command @@ -128,7 +128,7 @@ class PowerOn(Action): if self.job.device.power_command == '': self.logger.warning("Unable to power on the device") return connection - connection = super(PowerOn, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) if self.job.device.pre_power_command: command = self.job.device.pre_power_command self.logger.info("Running pre power command") @@ -160,7 +160,7 @@ class PowerOff(Action): timeout_exception = InfrastructureError def run(self, connection, max_end_time, args=None): - connection = super(PowerOff, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) if not self.job.device.get('commands', None): return connection command = self.job.device['commands'].get('power_off', []) @@ -184,7 +184,7 @@ class ReadFeedback(Action): summary = 'Read from other namespaces' def __init__(self, finalize=False, repeat=False): - super(ReadFeedback, self).__init__() + super().__init__() self.finalize = finalize self.parameters['namespace'] = 'common' self.duration = 1 # FIXME: needs to be a constant set in the base template. @@ -213,7 +213,7 @@ class ReadFeedback(Action): self.logger.info("Finalising connection for namespace '%s'", feedback[0]) # Finalize all connections associated with each namespace. feedback[1].finalise() - super(ReadFeedback, self).run(connection, max_end_time, args) + super().run(connection, max_end_time, args) return connection @@ -230,7 +230,7 @@ class FinalizeAction(Action): The tasks include finalising the connection (whatever is the last connection in the pipeline) and writing out the final pipeline structure containing the results as a logfile. """ - super(FinalizeAction, self).__init__() + super().__init__() self.ran = False def populate(self, parameters): @@ -246,7 +246,7 @@ class FinalizeAction(Action): """ self.ran = True try: - connection = super(FinalizeAction, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) if connection: connection.finalise() diff --git a/lava_dispatcher/protocols/lxc.py b/lava_dispatcher/protocols/lxc.py index 400904c4a..263b5120f 100644 --- a/lava_dispatcher/protocols/lxc.py +++ b/lava_dispatcher/protocols/lxc.py @@ -48,7 +48,7 @@ class LxcProtocol(Protocol): # pylint: disable=too-many-instance-attributes name = "lava-lxc" def __init__(self, parameters, job_id): - super(LxcProtocol, self).__init__(parameters, job_id) + super().__init__(parameters, job_id) self.system_timeout = Timeout('system', LAVA_LXC_TIMEOUT) self.persistence = parameters['protocols'][self.name].get('persist', False) diff --git a/lava_dispatcher/protocols/multinode.py b/lava_dispatcher/protocols/multinode.py index 2a6a083e4..b32a10ab2 100644 --- a/lava_dispatcher/protocols/multinode.py +++ b/lava_dispatcher/protocols/multinode.py @@ -50,7 +50,7 @@ class MultinodeProtocol(Protocol): # pylint: disable=too-many-instance-attribut # FIXME: use errors and valid where old code just logged complaints def __init__(self, parameters, job_id): - super(MultinodeProtocol, self).__init__(parameters, job_id) + super().__init__(parameters, job_id) self.blocks = 4 * 1024 # how long between polls (in seconds) self.system_timeout = Timeout('system', LAVA_MULTINODE_SYSTEM_TIMEOUT) diff --git a/lava_dispatcher/protocols/vland.py b/lava_dispatcher/protocols/vland.py index 505a85956..167f3d29e 100644 --- a/lava_dispatcher/protocols/vland.py +++ b/lava_dispatcher/protocols/vland.py @@ -48,7 +48,7 @@ class VlandProtocol(Protocol): level = 5 def __init__(self, parameters, job_id): - super(VlandProtocol, self).__init__(parameters, job_id) + super().__init__(parameters, job_id) self.logger = logging.getLogger('dispatcher') self.vlans = {} self.ports = [] @@ -411,7 +411,7 @@ class VlandProtocol(Protocol): else: self.logger.info("[%s] Job will wait for VLANs to be deployed.", self.name) self.logger.debug("[%s] parameters: %s", self.name, self.params) - super(VlandProtocol, self).configure(device, job) + super().configure(device, job) return True def deploy_vlans(self): diff --git a/lava_dispatcher/protocols/xnbd.py b/lava_dispatcher/protocols/xnbd.py index 5bde46b71..a1e3271db 100644 --- a/lava_dispatcher/protocols/xnbd.py +++ b/lava_dispatcher/protocols/xnbd.py @@ -40,7 +40,7 @@ class XnbdProtocol(Protocol): name = "lava-xnbd" def __init__(self, parameters, job_id): - super(XnbdProtocol, self).__init__(parameters, job_id) + super().__init__(parameters, job_id) # timeout in utils.constants, default 10000 self.system_timeout = Timeout('system', XNBD_SYSTEM_TIMEOUT) self.logger = logging.getLogger('dispatcher') diff --git a/lava_dispatcher/shell.py b/lava_dispatcher/shell.py index 1dac3ef50..da06d0b74 100644 --- a/lava_dispatcher/shell.py +++ b/lava_dispatcher/shell.py @@ -124,7 +124,7 @@ class ShellCommand(pexpect.spawn): # pylint: disable=too-many-public-methods def sendcontrol(self, char): self.logger.input(char) - return super(ShellCommand, self).sendcontrol(char) + return super().sendcontrol(char) def send(self, string, delay=0, send_char=True): # pylint: disable=arguments-differ """ @@ -136,10 +136,10 @@ class ShellCommand(pexpect.spawn): # pylint: disable=too-many-public-methods delay = float(delay) / 1000 if send_char: for char in string: - sent += super(ShellCommand, self).send(char) + sent += super().send(char) time.sleep(delay) else: - sent = super(ShellCommand, self).send(string) + sent = super().send(string) return sent def expect(self, *args, **kw): @@ -148,7 +148,7 @@ class ShellCommand(pexpect.spawn): # pylint: disable=too-many-public-methods the TestShellAction make much more useful reports of what was matched """ try: - proc = super(ShellCommand, self).expect(*args, **kw) + proc = super().expect(*args, **kw) except pexpect.TIMEOUT: raise TestError("ShellCommand command timed out.") except ValueError as exc: @@ -173,7 +173,7 @@ class ShellSession(Connection): Optionally, a prompt can be forced after a percentage of the timeout. """ - super(ShellSession, self).__init__(job, shell_command) + super().__init__(job, shell_command) self.name = "ShellSession" # FIXME: rename __prompt_str__ to indicate it can be a list or str self.__prompt_str__ = None @@ -184,7 +184,7 @@ class ShellSession(Connection): def disconnect(self, reason=''): logger = logging.getLogger('dispatcher') logger.debug("Disconnecting %s", self.name) - super(ShellSession, self).disconnect(reason) + super().disconnect(reason) # FIXME: rename prompt_str to indicate it can be a list or str @property @@ -294,16 +294,16 @@ class ExpectShellSession(Action): summary = "Expect a shell prompt" def __init__(self): - super(ExpectShellSession, self).__init__() + super().__init__() self.force_prompt = True def validate(self): - super(ExpectShellSession, self).validate() + super().validate() if 'prompts' not in self.parameters: self.errors = "Unable to identify test image prompts from parameters." def run(self, connection, max_end_time, args=None): - connection = super(ExpectShellSession, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) if not connection: raise JobError("No connection available.") if not connection.prompt_str: diff --git a/lava_dispatcher/test/test_basic.py b/lava_dispatcher/test/test_basic.py index d0996abec..c92692c40 100644 --- a/lava_dispatcher/test/test_basic.py +++ b/lava_dispatcher/test/test_basic.py @@ -38,7 +38,7 @@ from lava_dispatcher.test.utils import DummyLogger class StdoutTestCase(unittest.TestCase): # pylint: disable=too-many-public-methods def setUp(self): - super(StdoutTestCase, self).setUp() + super().setUp() logger = logging.getLogger('dispatcher') logger.disabled = True logger.propagate = False @@ -73,7 +73,7 @@ class TestPipelineInit(StdoutTestCase): # pylint: disable=too-many-public-metho def __init__(self): self.ran = False - super(TestPipelineInit.FakeAction, self).__init__() + super().__init__() def run(self, connection, max_end_time, args=None): self.ran = True @@ -82,7 +82,7 @@ class TestPipelineInit(StdoutTestCase): # pylint: disable=too-many-public-metho raise NotImplementedError("invalid") def setUp(self): - super(TestPipelineInit, self).setUp() + super().setUp() self.sub0 = TestPipelineInit.FakeAction() self.sub1 = TestPipelineInit.FakeAction() @@ -96,7 +96,7 @@ class TestPipelineInit(StdoutTestCase): # pylint: disable=too-many-public-metho class TestJobParser(StdoutTestCase): # pylint: disable=too-many-public-methods def setUp(self): - super(TestJobParser, self).setUp() + super().setUp() factory = Factory() self.job = factory.create_kvm_job('sample_jobs/basics.yaml') @@ -187,7 +187,7 @@ class TestPipeline(StdoutTestCase): # pylint: disable=too-many-public-methods def __init__(self): self.ran = False - super(TestPipeline.FakeAction, self).__init__() + super().__init__() def run(self, connection, max_end_time, args=None): time.sleep(1) @@ -409,7 +409,7 @@ class TestFakeActions(StdoutTestCase): # pylint: disable=too-many-public-method return new_connection def setUp(self): - super(TestFakeActions, self).setUp() + super().setUp() self.sub0 = TestPipeline.FakeAction() self.sub1 = TestPipeline.FakeAction() diff --git a/lava_dispatcher/test/test_command.py b/lava_dispatcher/test/test_command.py index 0b388b4c8..f904751b5 100644 --- a/lava_dispatcher/test/test_command.py +++ b/lava_dispatcher/test/test_command.py @@ -24,7 +24,7 @@ from lava_dispatcher.test.test_basic import Factory, StdoutTestCase class TestCommand(StdoutTestCase): def setUp(self): - super(TestCommand, self).setUp() + super().setUp() factory = Factory() self.job = factory.create_kvm_job('sample_jobs/kvm-command.yaml') diff --git a/lava_dispatcher/test/test_connections.py b/lava_dispatcher/test/test_connections.py index 76eded9e0..57060cf01 100644 --- a/lava_dispatcher/test/test_connections.py +++ b/lava_dispatcher/test/test_connections.py @@ -63,7 +63,7 @@ class ConnectionFactory(Factory): # pylint: disable=too-few-public-methods class TestConnection(StdoutTestCase): # pylint: disable=too-many-public-methods def setUp(self): - super(TestConnection, self).setUp() + super().setUp() factory = ConnectionFactory() self.job = factory.create_ssh_job('sample_jobs/ssh-deploy.yaml') self.guest_job = factory.create_bbb_job('sample_jobs/bbb-ssh-guest.yaml') @@ -283,7 +283,7 @@ class TestConnection(StdoutTestCase): # pylint: disable=too-many-public-methods class TestConsoleConnections(StdoutTestCase): def setUp(self): - super(TestConsoleConnections, self).setUp() + super().setUp() factory = ConnectionFactory() self.job = factory.create_ssh_job('sample_jobs/ssh-deploy.yaml') self.guest_job = factory.create_bbb_job('sample_jobs/bbb-ssh-guest.yaml') diff --git a/lava_dispatcher/test/test_defs.py b/lava_dispatcher/test/test_defs.py index 8b4b271d8..ddcc9a06d 100644 --- a/lava_dispatcher/test/test_defs.py +++ b/lava_dispatcher/test/test_defs.py @@ -72,7 +72,7 @@ def check_missing_path(testcase, exception, path): class TestDefinitionHandlers(StdoutTestCase): # pylint: disable=too-many-public-methods def setUp(self): - super(TestDefinitionHandlers, self).setUp() + super().setUp() factory = Factory() self.job = factory.create_kvm_job('sample_jobs/kvm.yaml') with open(os.path.join(os.path.dirname(__file__), 'testdefs', 'params.yaml'), 'r') as params: @@ -203,7 +203,7 @@ class TestDefinitionHandlers(StdoutTestCase): # pylint: disable=too-many-public class TestDefinitionSimple(StdoutTestCase): # pylint: disable=too-many-public-methods def setUp(self): - super(TestDefinitionSimple, self).setUp() + super().setUp() factory = Factory() self.job = factory.create_kvm_job('sample_jobs/kvm-notest.yaml') @@ -227,7 +227,7 @@ class TestDefinitionSimple(StdoutTestCase): # pylint: disable=too-many-public-m class TestDefinitionParams(StdoutTestCase): # pylint: disable=too-many-public-methods def setUp(self): - super(TestDefinitionParams, self).setUp() + super().setUp() self.factory = Factory() self.job = self.factory.create_kvm_job('sample_jobs/kvm-params.yaml') @@ -310,7 +310,7 @@ class TestDefinitionParams(StdoutTestCase): # pylint: disable=too-many-public-m class TestDefinitionRepeat(StdoutTestCase): # pylint: disable=too-many-public-methods def setUp(self): - super(TestDefinitionRepeat, self).setUp() + super().setUp() factory = Factory() self.job = factory.create_kvm_job("sample_jobs/kvm-multi.yaml") @@ -339,7 +339,7 @@ class TestDefinitionRepeat(StdoutTestCase): # pylint: disable=too-many-public-m class TestSkipInstall(StdoutTestCase): # pylint: disable=too-many-public-methods def setUp(self): - super(TestSkipInstall, self).setUp() + super().setUp() factory = UBootFactory() self.job = factory.create_bbb_job("sample_jobs/bbb-skip-install.yaml") @@ -393,7 +393,7 @@ class TestDefinitions(StdoutTestCase): """ def setUp(self): - super(TestDefinitions, self).setUp() + super().setUp() self.testdef = os.path.join(os.path.dirname(__file__), 'testdefs', 'params.yaml') self.res_data = os.path.join(os.path.dirname(__file__), 'testdefs', 'result-data.txt') factory = UBootFactory() diff --git a/lava_dispatcher/test/test_depthcharge.py b/lava_dispatcher/test/test_depthcharge.py index b91f5e1ec..3214f43e5 100644 --- a/lava_dispatcher/test/test_depthcharge.py +++ b/lava_dispatcher/test/test_depthcharge.py @@ -55,7 +55,7 @@ class DepthchargeFactory(object): class TestDepthchargeAction(StdoutTestCase): def setUp(self): - super(TestDepthchargeAction, self).setUp() + super().setUp() self.factory = DepthchargeFactory() @unittest.skipIf(infrastructure_error('mkimage'), "mkimage not installed") diff --git a/lava_dispatcher/test/test_download.py b/lava_dispatcher/test/test_download.py index 0a2e44fa7..cbd9c48e9 100644 --- a/lava_dispatcher/test/test_download.py +++ b/lava_dispatcher/test/test_download.py @@ -47,7 +47,7 @@ class DownloadFactory(Factory): # pylint: disable=too-few-public-methods class TestDownloadDeploy(StdoutTestCase): # pylint: disable=too-many-public-methods def setUp(self): - super(TestDownloadDeploy, self).setUp() + super().setUp() self.factory = DownloadFactory() self.job = self.factory.create_download_job('sample_jobs/download.yaml') diff --git a/lava_dispatcher/test/test_fastboot.py b/lava_dispatcher/test/test_fastboot.py index 2760af177..86a198c5b 100644 --- a/lava_dispatcher/test/test_fastboot.py +++ b/lava_dispatcher/test/test_fastboot.py @@ -106,7 +106,7 @@ class FastBootFactory(Factory): # pylint: disable=too-few-public-methods class TestFastbootDeploy(StdoutTestCase): # pylint: disable=too-many-public-methods def setUp(self): - super(TestFastbootDeploy, self).setUp() + super().setUp() self.factory = FastBootFactory() self.job = self.factory.create_fastboot_job('sample_jobs/fastboot.yaml') diff --git a/lava_dispatcher/test/test_grub.py b/lava_dispatcher/test/test_grub.py index 3d6a49e4e..842a9376a 100644 --- a/lava_dispatcher/test/test_grub.py +++ b/lava_dispatcher/test/test_grub.py @@ -81,7 +81,7 @@ class GrubFactory(Factory): # pylint: disable=too-few-public-methods class TestGrubAction(StdoutTestCase): # pylint: disable=too-many-public-methods def setUp(self): - super(TestGrubAction, self).setUp() + super().setUp() self.factory = GrubFactory() @unittest.skipIf(infrastructure_error('mkimage'), "u-boot-tools not installed") diff --git a/lava_dispatcher/test/test_ipxe.py b/lava_dispatcher/test/test_ipxe.py index 7179c47a4..6ca23fd88 100644 --- a/lava_dispatcher/test/test_ipxe.py +++ b/lava_dispatcher/test/test_ipxe.py @@ -58,7 +58,7 @@ class X86Factory(Factory): # pylint: disable=too-few-public-methods class TestBootloaderAction(StdoutTestCase): # pylint: disable=too-many-public-methods def setUp(self): - super(TestBootloaderAction, self).setUp() + super().setUp() self.factory = X86Factory() def test_simulated_action(self): diff --git a/lava_dispatcher/test/test_iso.py b/lava_dispatcher/test/test_iso.py index 12f8c4204..12832b208 100644 --- a/lava_dispatcher/test/test_iso.py +++ b/lava_dispatcher/test/test_iso.py @@ -48,7 +48,7 @@ class InstallerFactory(Factory): # pylint: disable=too-few-public-methods class TestIsoJob(StdoutTestCase): def setUp(self): - super(TestIsoJob, self).setUp() + super().setUp() factory = InstallerFactory() self.job = factory.create_qemu_installer_job() self.assertIsNotNone(self.job) diff --git a/lava_dispatcher/test/test_kvm.py b/lava_dispatcher/test/test_kvm.py index c19d4a46b..44bb3800b 100644 --- a/lava_dispatcher/test/test_kvm.py +++ b/lava_dispatcher/test/test_kvm.py @@ -156,7 +156,7 @@ class TestKVMSimulation(StdoutTestCase): # pylint: disable=too-many-public-meth class TestKVMBasicDeploy(StdoutTestCase): # pylint: disable=too-many-public-methods def setUp(self): - super(TestKVMBasicDeploy, self).setUp() + super().setUp() factory = Factory() self.job = factory.create_kvm_job('sample_jobs/kvm.yaml') @@ -224,7 +224,7 @@ class TestKVMBasicDeploy(StdoutTestCase): # pylint: disable=too-many-public-met class TestKVMQcow2Deploy(StdoutTestCase): # pylint: disable=too-many-public-methods def setUp(self): - super(TestKVMQcow2Deploy, self).setUp() + super().setUp() factory = Factory() self.job = factory.create_kvm_job('sample_jobs/kvm-qcow2.yaml') @@ -250,7 +250,7 @@ class TestKVMQcow2Deploy(StdoutTestCase): # pylint: disable=too-many-public-met class TestKVMDownloadLocalDeploy(StdoutTestCase): # pylint: disable=too-many-public-methods def setUp(self): - super(TestKVMDownloadLocalDeploy, self).setUp() + super().setUp() factory = Factory() self.job = factory.create_kvm_job('sample_jobs/kvm-local.yaml') @@ -277,7 +277,7 @@ def prepare_test_connection(): class TestKVMInlineTestDeploy(StdoutTestCase): # pylint: disable=too-many-public-methods def setUp(self): - super(TestKVMInlineTestDeploy, self).setUp() + super().setUp() factory = Factory() self.job = factory.create_kvm_job('sample_jobs/kvm-inline.yaml') @@ -376,7 +376,7 @@ class TestKVMInlineTestDeploy(StdoutTestCase): # pylint: disable=too-many-publi class TestAutoLogin(StdoutTestCase): def setUp(self): - super(TestAutoLogin, self).setUp() + super().setUp() factory = Factory() self.job = factory.create_kvm_job('sample_jobs/kvm-inline.yaml') self.job.logger = DummyLogger() @@ -540,7 +540,7 @@ class TestAutoLogin(StdoutTestCase): class TestChecksum(StdoutTestCase): def setUp(self): - super(TestChecksum, self).setUp() + super().setUp() factory = Factory() self.job = factory.create_kvm_job('sample_jobs/kvm-inline.yaml') @@ -658,7 +658,7 @@ class TestChecksum(StdoutTestCase): class TestKvmGuest(StdoutTestCase): # pylint: disable=too-many-public-methods def setUp(self): - super(TestKvmGuest, self).setUp() + super().setUp() factory = Factory() self.job = factory.create_kvm_job('sample_jobs/kvm-local.yaml') @@ -670,7 +670,7 @@ class TestKvmGuest(StdoutTestCase): # pylint: disable=too-many-public-methods class TestKvmUefi(StdoutTestCase): # pylint: disable=too-many-public-methods def setUp(self): - super(TestKvmUefi, self).setUp() + super().setUp() factory = Factory() self.job = factory.create_kvm_job('sample_jobs/kvm-uefi.yaml') @@ -698,7 +698,7 @@ class TestKvmUefi(StdoutTestCase): # pylint: disable=too-many-public-methods class TestQemuNFS(StdoutTestCase): def setUp(self): - super(TestQemuNFS, self).setUp() + super().setUp() device = NewDevice(os.path.join(os.path.dirname(__file__), '../devices/kvm03.yaml')) kvm_yaml = os.path.join(os.path.dirname(__file__), 'sample_jobs/qemu-nfs.yaml') parser = JobParser() @@ -761,7 +761,7 @@ class TestQemuNFS(StdoutTestCase): class TestMonitor(StdoutTestCase): # pylint: disable=too-many-public-methods def setUp(self): - super(TestMonitor, self).setUp() + super().setUp() factory = Factory() self.job = factory.create_kvm_job('sample_jobs/qemu-monitor.yaml') diff --git a/lava_dispatcher/test/test_lavashell.py b/lava_dispatcher/test/test_lavashell.py index aa01fc73f..ec3ff8604 100644 --- a/lava_dispatcher/test/test_lavashell.py +++ b/lava_dispatcher/test/test_lavashell.py @@ -46,7 +46,7 @@ from lava_dispatcher.actions.test.shell import TestShellRetry, TestShellAction class TestDefinitionHandlers(StdoutTestCase): # pylint: disable=too-many-public-methods def setUp(self): - super(TestDefinitionHandlers, self).setUp() + super().setUp() factory = Factory() self.job = factory.create_kvm_job('sample_jobs/kvm.yaml') @@ -118,7 +118,7 @@ class X86Factory(Factory): class TestMultiNodeOverlay(StdoutTestCase): # pylint: disable=too-many-public-methods def setUp(self): - super(TestMultiNodeOverlay, self).setUp() + super().setUp() factory = X86Factory() lng1 = NewDevice(os.path.join(os.path.dirname(__file__), '../devices/lng-generator-01.yaml')) lng2 = NewDevice(os.path.join(os.path.dirname(__file__), '../devices/lng-generator-02.yaml')) @@ -155,7 +155,7 @@ class TestShellResults(StdoutTestCase): # pylint: disable=too-many-public-meth class FakeJob(Job): def __init__(self, parameters): - super(TestShellResults.FakeJob, self).__init__(parameters) + super().__init__(parameters) class FakeDeploy(object): """ @@ -171,7 +171,7 @@ class TestShellResults(StdoutTestCase): # pylint: disable=too-many-public-meth class FakePipeline(Pipeline): def __init__(self, parent=None, job=None): - super(TestShellResults.FakePipeline, self).__init__(parent, job) + super().__init__(parent, job) class FakeAction(Action): """ @@ -183,7 +183,7 @@ class TestShellResults(StdoutTestCase): # pylint: disable=too-many-public-meth summary = "fake action for unit tests" def __init__(self): - super(TestShellResults.FakeAction, self).__init__() + super().__init__() self.count = 1 def run(self, connection, max_end_time, args=None): diff --git a/lava_dispatcher/test/test_lxc.py b/lava_dispatcher/test/test_lxc.py index f91bbef91..60ad72d82 100644 --- a/lava_dispatcher/test/test_lxc.py +++ b/lava_dispatcher/test/test_lxc.py @@ -82,7 +82,7 @@ class LxcFactory(Factory): # pylint: disable=too-few-public-methods class TestLxcDeploy(StdoutTestCase): # pylint: disable=too-many-public-methods def setUp(self): - super(TestLxcDeploy, self).setUp() + super().setUp() factory = LxcFactory() self.job = factory.create_lxc_job('sample_jobs/lxc.yaml') @@ -141,7 +141,7 @@ class TestLxcDeploy(StdoutTestCase): # pylint: disable=too-many-public-methods class TestLxcWithDevices(StdoutTestCase): def setUp(self): - super(TestLxcWithDevices, self).setUp() + super().setUp() self.factory = LxcFactory() self.job = self.factory.create_bbb_lxc_job('sample_jobs/bbb-lxc.yaml') diff --git a/lava_dispatcher/test/test_menus.py b/lava_dispatcher/test/test_menus.py index 352444c75..5f1fbbc20 100644 --- a/lava_dispatcher/test/test_menus.py +++ b/lava_dispatcher/test/test_menus.py @@ -37,7 +37,7 @@ from lava_dispatcher.menus.menus import SelectorMenu class TestSelectorMenu(StdoutTestCase): def setUp(self): - super(TestSelectorMenu, self).setUp() + super().setUp() self.menu = SelectorMenu() self.menu.item_markup = (r'\[', r'\]') self.menu.item_class = '0-9' @@ -93,7 +93,7 @@ class MenuFactory(Factory): # pylint: disable=too-few-public-methods class TestUefi(StdoutTestCase): # pylint: disable=too-many-public-methods def setUp(self): - super(TestUefi, self).setUp() + super().setUp() factory = MenuFactory() self.job = factory.create_uefi_job('sample_jobs/mustang-menu-ramdisk.yaml') diff --git a/lava_dispatcher/test/test_messages.py b/lava_dispatcher/test/test_messages.py index 44760aa8c..6108eb358 100644 --- a/lava_dispatcher/test/test_messages.py +++ b/lava_dispatcher/test/test_messages.py @@ -33,7 +33,7 @@ from lava_dispatcher.test.test_basic import StdoutTestCase class Kernel(object): # pylint: disable=too-few-public-methods def __init__(self): - super(Kernel, self).__init__() + super().__init__() self.existing_prompt = None def run(self, prompt_list): @@ -58,14 +58,14 @@ class Child(Kernel): # pylint: disable=too-few-public-methods else: self.existing_prompt = prompt_list[:] prompt_list = LinuxKernelMessages.get_init_prompts() - super(Child, self).run(prompt_list) + super().run(prompt_list) return prompt_list class FakeConnection(object): # pylint: disable=too-few-public-methods def __init__(self, child, prompt_str): - super(FakeConnection, self).__init__() + super().__init__() self.raw_connection = child self.prompt_str = prompt_str self.check_char = '#' @@ -91,7 +91,7 @@ class FakeConnection(object): # pylint: disable=too-few-public-methods class TestBootMessages(StdoutTestCase): # pylint: disable=too-many-public-methods def setUp(self): - super(TestBootMessages, self).setUp() + super().setUp() self.max_end_time = time.time() + 30 def test_existing_prompt(self): diff --git a/lava_dispatcher/test/test_multi.py b/lava_dispatcher/test/test_multi.py index ad4da29c4..6cb393325 100644 --- a/lava_dispatcher/test/test_multi.py +++ b/lava_dispatcher/test/test_multi.py @@ -36,7 +36,7 @@ from lava_dispatcher.test.utils import DummyLogger class TestMultiDeploy(StdoutTestCase): def setUp(self): - super(TestMultiDeploy, self).setUp() + super().setUp() self.parameters = {} self.parsed_data = { # fake parsed YAML 'device_type': 'fake', @@ -79,11 +79,11 @@ class TestMultiDeploy(StdoutTestCase): def __init__(self): filename = os.path.join(os.path.dirname(__file__), '../devices/bbb-01.yaml') - super(TestMultiDeploy.FakeDevice, self).__init__(filename) + super().__init__(filename) class TestDeploy(object): # cannot be a subclass of Deployment without a full select function. def __init__(self, parent, parameters, job): - super(TestMultiDeploy.TestDeploy, self).__init__() + super().__init__() self.action = TestMultiDeploy.TestDeployAction() self.action.job = job self.action.section = 'internal' @@ -96,7 +96,7 @@ class TestMultiDeploy(StdoutTestCase): summary = "fake deployment" def validate(self): - super(TestMultiDeploy.TestDeployAction, self).validate() + super().validate() def run(self, connection, max_end_time, args=None): self.data[self.name] = self.parameters @@ -104,7 +104,7 @@ class TestMultiDeploy(StdoutTestCase): class TestJob(Job): def __init__(self): - super(TestMultiDeploy.TestJob, self).__init__(4122, 0, self.parameters) + super().__init__(4122, 0, self.parameters) def test_multi_deploy(self): self.assertIsNotNone(self.parsed_data) @@ -151,7 +151,7 @@ class TestMultiDeploy(StdoutTestCase): class TestMultiDefinition(StdoutTestCase): # pylint: disable=too-many-public-methods def setUp(self): - super(TestMultiDefinition, self).setUp() + super().setUp() self.device = NewDevice(os.path.join(os.path.dirname(__file__), '../devices/bbb-01.yaml')) bbb_yaml = os.path.join(os.path.dirname(__file__), 'sample_jobs/uboot-nfs.yaml') with open(bbb_yaml) as sample_job_data: @@ -181,7 +181,7 @@ class TestMultiDefinition(StdoutTestCase): # pylint: disable=too-many-public-me class TestMultiUBoot(StdoutTestCase): # pylint: disable=too-many-public-methods def setUp(self): - super(TestMultiUBoot, self).setUp() + super().setUp() factory = UBootFactory() self.job = factory.create_bbb_job('sample_jobs/uboot-multiple.yaml') self.assertIsNotNone(self.job) diff --git a/lava_dispatcher/test/test_multinode.py b/lava_dispatcher/test/test_multinode.py index 33be7b29d..fd9df29fa 100644 --- a/lava_dispatcher/test/test_multinode.py +++ b/lava_dispatcher/test/test_multinode.py @@ -55,7 +55,7 @@ class TestMultinode(StdoutTestCase): # pylint: disable=too-many-public-methods """ Attempt to setup a valid group with clients and test the protocol """ - super(TestMultinode, self).setUp() + super().setUp() factory = Factory() self.client_job = factory.create_kvm_job('sample_jobs/kvm-multinode-client.yaml') self.server_job = factory.create_kvm_job('sample_jobs/kvm-multinode-server.yaml') @@ -78,7 +78,7 @@ class TestMultinode(StdoutTestCase): # pylint: disable=too-many-public-methods Override the socket calls to simply pass messages directly to the TestCoordinator """ def __init__(self, coord, parameters, job_id): - super(TestMultinode.TestClient, self).__init__(parameters, job_id) + super().__init__(parameters, job_id) self.coord = coord self.debug_setup() self.client_name = "fake" @@ -531,7 +531,7 @@ class TestProtocol(StdoutTestCase): # pylint: disable=too-many-public-methods """ Unable to test actually sending messages - need a genuine group with clients and roles """ - super(TestProtocol, self).setUp() + super().setUp() self.job_id = "100" parameters = { 'target': 'kvm01', @@ -617,7 +617,7 @@ class TestProtocol(StdoutTestCase): # pylint: disable=too-many-public-methods def __init__(self, fake_coordinator, parameters, job_id): # set the name before passing in the parameters based on that name self.name = "fake-multinode" - super(TestProtocol.FakeProtocol, self).__init__(parameters, job_id) + super().__init__(parameters, job_id) self.sock = TestProtocol.FakeClient(fake_coordinator) self.debug_setup() @@ -631,7 +631,7 @@ class TestProtocol(StdoutTestCase): # pylint: disable=too-many-public-methods pass def __call__(self, *args, **kwargs): - super(TestProtocol.FakeProtocol, self).__call__(*args, **kwargs) + super().__call__(*args, **kwargs) def test_fake_protocol(self): self.protocol._connect(1) @@ -698,7 +698,7 @@ class TestDelayedStart(StdoutTestCase): # pylint: disable=too-many-public-metho """ Unable to test actually sending messages - need a genuine group with clients and roles """ - super(TestDelayedStart, self).setUp() + super().setUp() job_id = "100" client_parameters = { 'target': 'kvm01', diff --git a/lava_dispatcher/test/test_power.py b/lava_dispatcher/test/test_power.py index 029f78044..f21a8d84b 100644 --- a/lava_dispatcher/test/test_power.py +++ b/lava_dispatcher/test/test_power.py @@ -54,7 +54,7 @@ class PowerFactory(Factory): # pylint: disable=too-few-public-methods class TestPowerAction(StdoutTestCase): # pylint: disable=too-many-public-methods def setUp(self): - super(TestPowerAction, self).setUp() + super().setUp() self.factory = PowerFactory() def test_reset_nopower(self): diff --git a/lava_dispatcher/test/test_repeat.py b/lava_dispatcher/test/test_repeat.py index 812592a3b..d3ade051f 100644 --- a/lava_dispatcher/test/test_repeat.py +++ b/lava_dispatcher/test/test_repeat.py @@ -31,7 +31,7 @@ class TestRepeatBootTest(StdoutTestCase): # pylint: disable=too-many-public-met Test repeat counts with nested test stanzas """ def setUp(self): - super(TestRepeatBootTest, self).setUp() + super().setUp() factory = Factory() self.job = factory.create_kvm_job('sample_jobs/kvm-repeat.yaml') diff --git a/lava_dispatcher/test/test_retries.py b/lava_dispatcher/test/test_retries.py index a1d162737..2f552f6fc 100644 --- a/lava_dispatcher/test/test_retries.py +++ b/lava_dispatcher/test/test_retries.py @@ -44,7 +44,7 @@ class TestAction(StdoutTestCase): # pylint: disable=too-many-public-methods class FakeJob(Job): def __init__(self, parameters): - super(TestAction.FakeJob, self).__init__(4212, parameters, None) + super().__init__(4212, parameters, None) class FakeDeploy(object): """ @@ -70,7 +70,7 @@ class TestAction(StdoutTestCase): # pylint: disable=too-many-public-methods class FakePipeline(Pipeline): def __init__(self, parent=None, job=None): - super(TestAction.FakePipeline, self).__init__(parent, job) + super().__init__(parent, job) job.pipeline = self class FakeAction(Action): @@ -83,7 +83,7 @@ class TestAction(StdoutTestCase): # pylint: disable=too-many-public-methods summary = "fake action for unit tests" def __init__(self): - super(TestAction.FakeAction, self).__init__() + super().__init__() self.count = 1 def run(self, connection, max_end_time, args=None): @@ -101,7 +101,7 @@ class TestAction(StdoutTestCase): # pylint: disable=too-many-public-methods summary = "fake trigger action for unit tests" def __init__(self): - super(TestAction.FakeTriggerAction, self).__init__() + super().__init__() self.count = 1 self.parameters['namespace'] = 'common' @@ -144,14 +144,14 @@ class TestAction(StdoutTestCase): # pylint: disable=too-many-public-methods class DiagnoseCheck(DiagnosticAction): def __init__(self): - super(TestAction.DiagnoseCheck, self).__init__() + super().__init__() @classmethod def trigger(cls): return 'fake-check' def setUp(self): - super(TestAction, self).setUp() + super().setUp() self.parameters = { "job_name": "fakejob", "actions": [ @@ -288,7 +288,7 @@ class TestTimeout(StdoutTestCase): # pylint: disable=too-many-public-methods class FakeJob(Job): def __init__(self, parameters): - super(TestTimeout.FakeJob, self).__init__(4212, parameters, None) + super().__init__(4212, parameters, None) self.logger = DummyLogger() def validate(self, simulate=False): @@ -304,7 +304,7 @@ class TestTimeout(StdoutTestCase): # pylint: disable=too-many-public-methods class FakePipeline(Pipeline): def __init__(self, parent=None, job=None): - super(TestTimeout.FakePipeline, self).__init__(parent, job) + super().__init__(parent, job) class FakeAction(Action): """ @@ -336,7 +336,7 @@ class TestTimeout(StdoutTestCase): # pylint: disable=too-many-public-methods summary = "fake action without adjuvant" def __init__(self): - super(TestTimeout.SafeAction, self).__init__() + super().__init__() self.parameters['namespace'] = 'common' def run(self, connection, max_end_time, args=None): @@ -355,7 +355,7 @@ class TestTimeout(StdoutTestCase): # pylint: disable=too-many-public-methods summary = "fake action with overly long sleep" def __init__(self): - super(TestTimeout.LongAction, self).__init__() + super().__init__() self.parameters['namespace'] = 'common' def run(self, connection, max_end_time, args=None): @@ -387,7 +387,7 @@ class TestTimeout(StdoutTestCase): # pylint: disable=too-many-public-methods summary = "fake action for unit tests" def __init__(self): - super(TestTimeout.FakeSafeAction, self).__init__() + super().__init__() self.timeout.duration = 4 def populate(self, parameters): @@ -402,7 +402,7 @@ class TestTimeout(StdoutTestCase): # pylint: disable=too-many-public-methods return connection def setUp(self): - super(TestTimeout, self).setUp() + super().setUp() self.parameters = { "job_name": "fakejob", 'timeouts': { diff --git a/lava_dispatcher/test/test_test_shell.py b/lava_dispatcher/test/test_test_shell.py index f21de1065..b9b081dbc 100644 --- a/lava_dispatcher/test/test_test_shell.py +++ b/lava_dispatcher/test/test_test_shell.py @@ -36,7 +36,7 @@ class FakeConnection(object): # pylint: disable=too-few-public-methods class TestPatterns(StdoutTestCase): def setUp(self): - super(TestPatterns, self).setUp() + super().setUp() self.testdef = os.path.join(os.path.dirname(__file__), 'testdefs', 'params.yaml') self.res_data = os.path.join(os.path.dirname(__file__), 'testdefs', 'result-data.txt') factory = Factory() diff --git a/lava_dispatcher/test/test_uboot.py b/lava_dispatcher/test/test_uboot.py index 24d30ec41..cd2dec887 100644 --- a/lava_dispatcher/test/test_uboot.py +++ b/lava_dispatcher/test/test_uboot.py @@ -88,7 +88,7 @@ class UBootFactory(Factory): # pylint: disable=too-few-public-methods class TestUbootAction(StdoutTestCase): # pylint: disable=too-many-public-methods def setUp(self): - super(TestUbootAction, self).setUp() + super().setUp() self.factory = UBootFactory() @unittest.skipIf(infrastructure_error('mkimage'), "u-boot-tools not installed") diff --git a/lava_dispatcher/test/test_uboot_ums.py b/lava_dispatcher/test/test_uboot_ums.py index ee8bdfe73..a6e487ffb 100644 --- a/lava_dispatcher/test/test_uboot_ums.py +++ b/lava_dispatcher/test/test_uboot_ums.py @@ -45,7 +45,7 @@ class UBootUMSFactory(Factory): # pylint: disable=too-few-public-methods class TestUbootUMSAction(StdoutTestCase): # pylint: disable=too-many-public-methods def setUp(self): - super(TestUbootUMSAction, self).setUp() + super().setUp() self.factory = UBootUMSFactory() @unittest.skipIf(infrastructure_error('dd'), "dd not installed") diff --git a/lava_dispatcher/test/test_uefi_shell.py b/lava_dispatcher/test/test_uefi_shell.py index 48fc1367b..1a3412f14 100644 --- a/lava_dispatcher/test/test_uefi_shell.py +++ b/lava_dispatcher/test/test_uefi_shell.py @@ -42,7 +42,7 @@ class UefiFactory(Factory): # pylint: disable=too-few-public-methods class TestUefiShell(StdoutTestCase): def setUp(self): - super(TestUefiShell, self).setUp() + super().setUp() self.factory = UefiFactory() self.job = self.factory.create_job("sample_jobs/juno-uefi-nfs.yaml") diff --git a/lava_dispatcher/test/test_utils.py b/lava_dispatcher/test/test_utils.py index dad1594bb..0bb8668f0 100644 --- a/lava_dispatcher/test/test_utils.py +++ b/lava_dispatcher/test/test_utils.py @@ -36,7 +36,7 @@ from lava_dispatcher.utils import vcs, installers class TestGit(StdoutTestCase): # pylint: disable=too-many-public-methods def setUp(self): - super(TestGit, self).setUp() + super().setUp() self.cwd = os.getcwd() # Go into a temp dirctory @@ -134,7 +134,7 @@ class TestGit(StdoutTestCase): # pylint: disable=too-many-public-methods class TestBzr(StdoutTestCase): # pylint: disable=too-many-public-methods def setUp(self): - super(TestBzr, self).setUp() + super().setUp() self.cwd = os.getcwd() # Go into a temp dirctory @@ -202,7 +202,7 @@ class TestConstants(StdoutTestCase): # pylint: disable=too-many-public-methods in that stanza. """ def setUp(self): - super(TestConstants, self).setUp() + super().setUp() factory = UBootFactory() self.job = factory.create_bbb_job('sample_jobs/uboot-ramdisk.yaml') self.assertIsNotNone(self.job) @@ -245,7 +245,7 @@ class TestConstants(StdoutTestCase): # pylint: disable=too-many-public-methods class TestClasses(StdoutTestCase): def setUp(self): - super(TestClasses, self).setUp() + super().setUp() from lava_dispatcher.actions.deploy import strategies # pylint: disable=unused-variable from lava_dispatcher.actions.boot import strategies # pylint: disable=reimported from lava_dispatcher.actions.test import strategies # pylint: disable=reimported @@ -273,7 +273,7 @@ class TestClasses(StdoutTestCase): class TestInstallers(StdoutTestCase): def setUp(self): - super(TestInstallers, self).setUp() + super().setUp() self.cwd = os.getcwd() self.tmpdir = tempfile.mkdtemp() os.chdir(self.tmpdir) diff --git a/lava_dispatcher/test/test_vland.py b/lava_dispatcher/test/test_vland.py index bd97b7cb1..75ce39418 100644 --- a/lava_dispatcher/test/test_vland.py +++ b/lava_dispatcher/test/test_vland.py @@ -37,7 +37,7 @@ from lava_dispatcher.test.utils import DummyLogger class TestVland(StdoutTestCase): # pylint: disable=too-many-public-methods def setUp(self): - super(TestVland, self).setUp() + super().setUp() self.filename = os.path.join(os.path.dirname(__file__), 'sample_jobs/bbb-group-vland-alpha.yaml') self.beta_filename = os.path.join(os.path.dirname(__file__), 'sample_jobs/bbb-group-vland-beta.yaml') self.device = NewDevice(os.path.join(os.path.dirname(__file__), '../devices/bbb-01.yaml')) diff --git a/lava_dispatcher/utils/messages.py b/lava_dispatcher/utils/messages.py index ac68207dc..65e6c1cb3 100644 --- a/lava_dispatcher/utils/messages.py +++ b/lava_dispatcher/utils/messages.py @@ -69,7 +69,7 @@ class LinuxKernelMessages(Action): ) def __init__(self): - super(LinuxKernelMessages, self).__init__() + super().__init__() self.messages = self.get_kernel_prompts() self.existing_prompt = None for choice in self.MESSAGE_CHOICES: @@ -189,7 +189,7 @@ class LinuxKernelMessages(Action): return results def validate(self): - super(LinuxKernelMessages, self).validate() + super().validate() if not self.messages: self.errors = "Unable to build a list of kernel messages to monitor." diff --git a/lava_dispatcher/utils/storage.py b/lava_dispatcher/utils/storage.py index f89cba8cb..826fbbf22 100644 --- a/lava_dispatcher/utils/storage.py +++ b/lava_dispatcher/utils/storage.py @@ -36,12 +36,12 @@ class FlashUBootUMSAction(Action): summary = "USB Mass storage flash" def __init__(self, usb_mass_device): - super(FlashUBootUMSAction, self).__init__() + super().__init__() self.params = None self.usb_mass_device = usb_mass_device def validate(self): - super(FlashUBootUMSAction, self).validate() + super().validate() self.params = self.job.device['actions']['boot']['methods'][self.parameters['method']]['parameters'] if self.params.get('uboot_mass_storage_device', False): self.ums_device = self.params['uboot_mass_storage_device'] diff --git a/lava_dispatcher/utils/udev.py b/lava_dispatcher/utils/udev.py index 54930a715..880a93c60 100644 --- a/lava_dispatcher/utils/udev.py +++ b/lava_dispatcher/utils/udev.py @@ -30,11 +30,11 @@ class WaitUSBSerialDeviceAction(Action): summary = "wait for USB serial device" def __init__(self): - super(WaitUSBSerialDeviceAction, self).__init__() + super().__init__() self.serial_device = {} def validate(self): - super(WaitUSBSerialDeviceAction, self).validate() + super().validate() board_id = self.job.device.get('board_id', '') usb_vendor_id = self.job.device.get('usb_vendor_id', '') usb_product_id = self.job.device.get('usb_product_id', '') @@ -51,7 +51,7 @@ class WaitUSBSerialDeviceAction(Action): 'ID_USB_DRIVER': str(usb_serial_driver)} def run(self, connection, max_end_time, args=None): - connection = super(WaitUSBSerialDeviceAction, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) self.logger.debug("Waiting for usb serial device: %s", self.serial_device) wait_udev_event(action='add', match_dict=self.serial_device, subsystem='tty') return connection @@ -64,11 +64,11 @@ class WaitDFUDeviceAction(Action): summary = "wait for DFU device" def __init__(self): - super(WaitDFUDeviceAction, self).__init__() + super().__init__() self.dfu_device = {} def validate(self): - super(WaitDFUDeviceAction, self).validate() + super().validate() board_id = self.job.device.get('board_id', '') usb_vendor_id = self.job.device.get('usb_vendor_id', '') usb_product_id = self.job.device.get('usb_product_id', '') @@ -83,7 +83,7 @@ class WaitDFUDeviceAction(Action): 'ID_MODEL_ID': str(usb_product_id)} def run(self, connection, max_end_time, args=None): - connection = super(WaitDFUDeviceAction, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) self.logger.debug("Waiting for DFU device: %s", self.dfu_device) wait_udev_event(action='add', match_dict=self.dfu_device, subsystem='usb', devtype='usb_device') return connection @@ -96,18 +96,18 @@ class WaitUSBMassStorageDeviceAction(Action): summary = "wait for USB mass storage device" def __init__(self): - super(WaitUSBMassStorageDeviceAction, self).__init__() + super().__init__() self.ms_device = {} def validate(self): - super(WaitUSBMassStorageDeviceAction, self).validate() + super().validate() usb_fs_label = self.job.device.get('usb_filesystem_label', None) if not isinstance(usb_fs_label, str): self.errors = 'usb_fs_label unset' self.ms_device = {'ID_FS_LABEL': str(usb_fs_label)} def run(self, connection, max_end_time, args=None): - connection = super(WaitUSBMassStorageDeviceAction, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) self.logger.debug("Waiting for USB mass storage device: %s", self.ms_device) wait_udev_event(action='add', match_dict=self.ms_device, subsystem='block', devtype='partition') return connection @@ -120,16 +120,16 @@ class WaitDevicePathAction(Action): summary = "wait for udev device path" def __init__(self, path=None): - super(WaitDevicePathAction, self).__init__() + super().__init__() self.devicepath = path def validate(self): - super(WaitDevicePathAction, self).validate() + super().validate() if not isinstance(self.devicepath, str): self.errors = "invalid device path" def run(self, connection, max_end_time, args=None): - connection = super(WaitDevicePathAction, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) self.logger.debug("Waiting for udev device path: %s", self.devicepath) wait_udev_event(action='add', devicepath=self.devicepath) return connection @@ -142,20 +142,20 @@ class WaitDeviceBoardID(Action): summary = "wait for udev device with board ID" def __init__(self, board_id=None): - super(WaitDeviceBoardID, self).__init__() + super().__init__() if not board_id: self.board_id = self.job.device.get('board_id', None) else: self.board_id = board_id def validate(self): - super(WaitDeviceBoardID, self).validate() + super().validate() if not isinstance(self.board_id, str): self.errors = "invalid board_id" self.udev_device = {'ID_SERIAL_SHORT': str(self.board_id)} def run(self, connection, max_end_time, args=None): - connection = super(WaitDeviceBoardID, self).run(connection, max_end_time, args) + connection = super().run(connection, max_end_time, args) self.logger.debug("Waiting for udev device with ID: %s", self.board_id) wait_udev_event(action='add', match_dict=self.udev_device) return connection diff --git a/lava_dispatcher/utils/vcs.py b/lava_dispatcher/utils/vcs.py index e974abae0..2287dea42 100644 --- a/lava_dispatcher/utils/vcs.py +++ b/lava_dispatcher/utils/vcs.py @@ -41,7 +41,7 @@ class VCSHelper(object): class BzrHelper(VCSHelper): def __init__(self, url): - super(BzrHelper, self).__init__(url) + super().__init__(url) self.binary = '/usr/bin/bzr' def clone(self, dest_path, revision=None, branch=None): @@ -96,7 +96,7 @@ class GitHelper(VCSHelper): """ def __init__(self, url): - super(GitHelper, self).__init__(url) + super().__init__(url) self.binary = '/usr/bin/git' def clone(self, dest_path, shallow=False, revision=None, branch=None, history=True): @@ -141,7 +141,7 @@ class TarHelper(VCSHelper): # TODO: implement TarHelper def __init__(self, url): - super(TarHelper, self).__init__(url) + super().__init__(url) self.binary = None @@ -149,5 +149,5 @@ class URLHelper(VCSHelper): # TODO: implement URLHelper def __init__(self, url): - super(URLHelper, self).__init__(url) + super().__init__(url) self.binary = None |