From 07a8c3c79a7837258af914d837676f106e9d9dba Mon Sep 17 00:00:00 2001 From: InsanePrawn Date: Tue, 27 Sep 2022 04:47:57 +0200 Subject: [PATCH] chroot/abstract: clean up --- chroot/abstract.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/chroot/abstract.py b/chroot/abstract.py index 8cf0902..93e8fcc 100644 --- a/chroot/abstract.py +++ b/chroot/abstract.py @@ -129,6 +129,7 @@ class Chroot(AbstractChroot): def get_path(self, *joins: str) -> str: if joins: + # no need to check for len(joins) > 1 because [1:] will just return [] joins = (joins[0].lstrip('/'),) + joins[1:] return os.path.join(self.path, *joins) @@ -385,7 +386,6 @@ class Chroot(AbstractChroot): results = {} logging.debug('Falling back to serial installation') for pkg in set(packages): - # Don't check for errors here because there might be packages that are listed as dependencies but are not available on x86_64 results[pkg] = self.run_cmd(f'{cmd} {pkg}') return results @@ -410,11 +410,12 @@ def get_chroot( if fail_if_exists: raise Exception(f'chroot {name} already exists: {existing.uuid}') logging.debug(f"returning existing chroot {name}: {existing.uuid}") + assert isinstance(existing, chroot_class) chroot = chroots[name] if extra_repos is not None: chroot.extra_repos = dict(extra_repos) # copy to new dict if initialize: chroot.initialize() if activate: - chroot.activate(fail_if_active=False) + chroot.activate() return chroot