Try to short-circuit podman execution

This commit is contained in:
jpic 2020-01-26 18:34:16 +01:00
parent 2aa657d5ef
commit c88aea9ba9
2 changed files with 15 additions and 12 deletions

2
pod.py
View File

@ -8,7 +8,7 @@ from podctl import *
podctl = Container(
Base('quay.io/podman/stable'),
Packages('python3', 'buildah'),
Packages('python3', 'buildah', mgr='dnf'),
Copy(['setup.py', 'podctl'], '/app'),
Pip('/app'),
Config(cmd='podctl', author='jpic'),

View File

@ -20,12 +20,15 @@ class Packages:
),
)
def __init__(self, *packages):
def __init__(self, *packages, mgr=None):
self.packages = list(packages)
self.mgr = None
self.mgr = mgr
def pre_build(self, script):
base = script.container.variable('base')
if self.mgr:
self.cmds = self.mgrs[self.mgr]
else:
for mgr, cmds in self.mgrs.items():
cmd = ['podman', 'run', base, 'sh', '-c', f'type {mgr}']
try: