From ddfcfe55867bb0acc23914b04b27aa7c94a5dcad Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Tue, 10 Dec 2019 12:29:51 +0100 Subject: [PATCH 1/2] Avoid crash when --store is not specified on save --- project-installcheck.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/project-installcheck.py b/project-installcheck.py index 81f79830..936ebfe3 100755 --- a/project-installcheck.py +++ b/project-installcheck.py @@ -97,6 +97,9 @@ class RepoChecker(): return repository def store_yaml(self, state, project, repository, arch): + if not self.store_project or not self.store_package: + return + state_yaml = yaml.dump(state, default_flow_style=False) comment = 'Updated rebuild infos for {}/{}/{}'.format(project, repository, arch) source_file_ensure(self.apiurl, self.store_project, self.store_package, From aa0b8fcabe366c21b6a0b3078ac71ef641f8618c Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Tue, 10 Dec 2019 12:30:06 +0100 Subject: [PATCH 2/2] Sanitize read rebuild yaml In case the syntax was not parsing correctly, make sure we have the expected type. --- project-installcheck.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/project-installcheck.py b/project-installcheck.py index 936ebfe3..d6618d6a 100755 --- a/project-installcheck.py +++ b/project-installcheck.py @@ -118,7 +118,11 @@ class RepoChecker(): oldstate = oldstate or {} oldstate.setdefault('check', {}) + if not isinstance(oldstate['check'], dict): + oldstate['check'] = {} oldstate.setdefault('leafs', {}) + if not isinstance(oldstate['leafs'], dict): + oldstate['leafs'] = {} repository_pairs = repository_path_expand(self.apiurl, project, repository) directories = []