aboutsummaryrefslogtreecommitdiff
path: root/lava_dispatcher/actions/deploy
diff options
context:
space:
mode:
Diffstat (limited to 'lava_dispatcher/actions/deploy')
-rw-r--r--lava_dispatcher/actions/deploy/apply_overlay.py46
-rw-r--r--lava_dispatcher/actions/deploy/docker.py6
-rw-r--r--lava_dispatcher/actions/deploy/download.py38
-rw-r--r--lava_dispatcher/actions/deploy/environment.py4
-rw-r--r--lava_dispatcher/actions/deploy/fastboot.py20
-rw-r--r--lava_dispatcher/actions/deploy/flasher.py8
-rw-r--r--lava_dispatcher/actions/deploy/image.py10
-rw-r--r--lava_dispatcher/actions/deploy/iso.py18
-rw-r--r--lava_dispatcher/actions/deploy/lxc.py32
-rw-r--r--lava_dispatcher/actions/deploy/mount.py24
-rw-r--r--lava_dispatcher/actions/deploy/nbd.py10
-rw-r--r--lava_dispatcher/actions/deploy/nfs.py4
-rw-r--r--lava_dispatcher/actions/deploy/overlay.py26
-rw-r--r--lava_dispatcher/actions/deploy/prepare.py13
-rw-r--r--lava_dispatcher/actions/deploy/removable.py12
-rw-r--r--lava_dispatcher/actions/deploy/ssh.py12
-rw-r--r--lava_dispatcher/actions/deploy/testdef.py52
-rw-r--r--lava_dispatcher/actions/deploy/tftp.py8
-rw-r--r--lava_dispatcher/actions/deploy/uboot_ums.py2
-rw-r--r--lava_dispatcher/actions/deploy/vemsd.py40
20 files changed, 189 insertions, 196 deletions
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)