mirror of
https://github.com/containers/ansible-podman-collections.git
synced 2026-02-03 23:01:48 +00:00
Add inventory plugins for buildah and podman, unit tests and functional CI tests. --------- Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
18 lines
483 B
Python
18 lines
483 B
Python
import os
|
|
|
|
|
|
def verify_inventory_file(self, path: str) -> bool:
|
|
|
|
unused, ext = os.path.splitext(path)
|
|
if ext not in (".yml", ".yaml"):
|
|
return False
|
|
try:
|
|
with open(path, "r", encoding="utf-8") as f:
|
|
header = f.read(2048)
|
|
return (
|
|
(f"plugin: {self.NAME}\n" in header)
|
|
or (f"plugin: '{self.NAME}'" in header)
|
|
or (f'plugin: "{self.NAME}"' in header)
|
|
)
|
|
except Exception:
|
|
return False
|