mirror of
ssh://git.janware.com/janware/proj/jw-pkg
synced 2026-04-24 09:13:37 +02:00
lib.FileContext.file_exists(): Fix missing await
file_exists and _stat() in file_exists() are async, need to be awaited, but aren't. Fix that. Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
21ff616db1
commit
b44879c517
2 changed files with 4 additions and 4 deletions
|
|
@ -40,7 +40,7 @@ class DistroContext(FilesContext):
|
||||||
ret = []
|
ret = []
|
||||||
for tmpl in await self.list_template_files(packages):
|
for tmpl in await self.list_template_files(packages):
|
||||||
path = str(Path(tmpl).with_suffix(".jw-secret"))
|
path = str(Path(tmpl).with_suffix(".jw-secret"))
|
||||||
if ignore_missing and not self.ctx.file_exists(path):
|
if ignore_missing and not await self.ctx.file_exists(path):
|
||||||
continue
|
continue
|
||||||
ret.append(path)
|
ret.append(path)
|
||||||
return ret
|
return ret
|
||||||
|
|
@ -49,7 +49,7 @@ class DistroContext(FilesContext):
|
||||||
ret = []
|
ret = []
|
||||||
for tmpl in await self.list_template_files(packages):
|
for tmpl in await self.list_template_files(packages):
|
||||||
path = tmpl.removesuffix('.jw-tmpl')
|
path = tmpl.removesuffix('.jw-tmpl')
|
||||||
if ignore_missing and not self.ctx.file_exists(path):
|
if ignore_missing and not await self.ctx.file_exists(path):
|
||||||
continue
|
continue
|
||||||
ret.append(path)
|
ret.append(path)
|
||||||
return ret
|
return ret
|
||||||
|
|
|
||||||
|
|
@ -157,7 +157,7 @@ class FileContext(abc.ABC):
|
||||||
|
|
||||||
async def _file_exists(self, path: str) -> bool:
|
async def _file_exists(self, path: str) -> bool:
|
||||||
try:
|
try:
|
||||||
self._stat(path, False)
|
await self._stat(path, False)
|
||||||
except FileNotFoundError as e:
|
except FileNotFoundError as e:
|
||||||
log(DEBUG, f'Could not stat file {path} ({str(e)}), ignored')
|
log(DEBUG, f'Could not stat file {path} ({str(e)}), ignored')
|
||||||
return False
|
return False
|
||||||
|
|
@ -167,7 +167,7 @@ class FileContext(abc.ABC):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
async def file_exists(self, path: str) -> bool:
|
async def file_exists(self, path: str) -> bool:
|
||||||
return self._file_exists(path)
|
return await self._file_exists(path)
|
||||||
|
|
||||||
async def _is_dir(self, path: str) -> bool:
|
async def _is_dir(self, path: str) -> bool:
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue