tree: fix pylint warnings

This fixes pylint warnings on our modules that are currently not part of
CI-pylint. The fixes should all be straightforward.

Signed-off-by: David Rheinsberg <david.rheinsberg@gmail.com>
This commit is contained in:
David Rheinsberg 2022-09-13 12:28:27 +02:00 committed by Simon de Vlieger
parent cdd65d4fd9
commit 8c367dfa6f
6 changed files with 12 additions and 11 deletions

View file

@ -18,11 +18,10 @@ documentation for `osbuil.util.udev.UdevInhibitor`.
import argparse import argparse
import errno
import os import os
import sys import sys
from typing import Dict, Optional from typing import Dict
from osbuild import devices from osbuild import devices
from osbuild import loop from osbuild import loop
@ -64,6 +63,9 @@ class LoopbackService(devices.DeviceService):
def __init__(self, args: argparse.Namespace): def __init__(self, args: argparse.Namespace):
super().__init__(args) super().__init__(args)
self.ctl = loop.LoopControl() self.ctl = loop.LoopControl()
self.fd = None
self.lo = None
self.sector_size = None
@staticmethod @staticmethod
def setup_loop(lo: loop.Loop): def setup_loop(lo: loop.Loop):

View file

@ -140,11 +140,11 @@ class CryptDeviceService(devices.DeviceService):
self.devname = None self.devname = None
# finally close the device # finally close the device
res = subprocess.run(["cryptsetup", "-q", "close", name], subprocess.run(["cryptsetup", "-q", "close", name],
check=self.check, check=self.check,
stdout=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT, stderr=subprocess.STDOUT,
encoding="UTF-8") encoding="UTF-8")
def main(): def main():

View file

@ -133,7 +133,7 @@ class OSTreeInput(inputs.InputService):
if origin == "org.osbuild.pipeline": if origin == "org.osbuild.pipeline":
for ref, options in refs.items(): for ref, options in refs.items():
source = store.read_tree(ref) source = store.read_tree(ref)
with open(os.path.join(source, "compose.json"), "r") as f: with open(os.path.join(source, "compose.json"), "r", encoding="utf8") as f:
compose = json.load(f) compose = json.load(f)
commit_id = compose["ostree-commit"] commit_id = compose["ostree-commit"]
reply = export({commit_id: options}, source, target) reply = export({commit_id: options}, source, target)

View file

@ -105,7 +105,7 @@ class OSTreeCheckoutInput(inputs.InputService):
if origin == "org.osbuild.pipeline": if origin == "org.osbuild.pipeline":
for ref, options in refs.items(): for ref, options in refs.items():
source = store.read_tree(ref) source = store.read_tree(ref)
with open(os.path.join(source, "compose.json"), "r") as f: with open(os.path.join(source, "compose.json"), "r", encoding="utf8") as f:
compose = json.load(f) compose = json.load(f)
commit_id = compose["ostree-commit"] commit_id = compose["ostree-commit"]
ids.append(checkout({commit_id: options}, source, target)) ids.append(checkout({commit_id: options}, source, target))

View file

@ -34,6 +34,7 @@ SCHEMA_2 = """
class NoOpMount(mounts.MountService): class NoOpMount(mounts.MountService):
mountpoint = None
def mount(self, args: Dict): def mount(self, args: Dict):
root = args["root"] root = args["root"]

View file

@ -104,8 +104,6 @@ class OSTreeDeploymentMount(mounts.MountService):
self.mountpoint = tree self.mountpoint = tree
self.check = True self.check = True
return None
def umount(self): def umount(self):
if not self.mountpoint: if not self.mountpoint: