From 35fa429965fe1d978918547a27d50fead0212721 Mon Sep 17 00:00:00 2001 From: chloenayon Date: Tue, 25 Aug 2020 17:32:52 +0200 Subject: [PATCH] objectstore: get returns object not path Change objectstore.get to return an object or None instead of a path. --- osbuild/objectstore.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osbuild/objectstore.py b/osbuild/objectstore.py index 03ff7d91..c7594d26 100644 --- a/osbuild/objectstore.py +++ b/osbuild/objectstore.py @@ -264,12 +264,12 @@ class ObjectStore(contextlib.AbstractContextManager): prefix=prefix, suffix=suffix) - @contextlib.contextmanager def get(self, object_id): - with Object(self) as obj: - obj.base = object_id - with obj.read() as path: - yield path + if not self.contains(object_id): + return None + + obj = self.new(base_id=object_id) + return obj def new(self, base_id=None): """Creates a new temporary `Object`.