mirror of
https://github.com/containers/ansible-podman-collections.git
synced 2026-02-04 07:11:49 +00:00
Add inventory plugins for buildah and podman (#963)
Add inventory plugins for buildah and podman, unit tests and functional CI tests. --------- Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
This commit is contained in:
parent
fb76891c50
commit
6ee2f3891b
57 changed files with 3856 additions and 8899 deletions
18
plugins/module_utils/inventory/utils.py
Normal file
18
plugins/module_utils/inventory/utils.py
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue