Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
labels=None,
share=None,
infra=False):
"""Create a new empty pod."""
config = ConfigDict(
name=ident,
cgroupParent=cgroupparent,
labels=labels,
share=share,
infra=infra,
)
with self._client() as podman:
result = podman.CreatePod(config)
details = podman.GetPod(result['pod'])
return Pod(self._client, result['pod'], details['pod'])
def get(self, ident):
"""Get Pod from ident."""
with self._client() as podman:
result = podman.GetPod(ident)
return Pod(self._client, result['pod']['id'], result['pod'])
def get_by_context(self, all=True, latest=False, args=[]):
"""Get pods ids or names depending on all, latest, or a list of
pods names"""
with self._client() as podman:
results = podman.GetPodsByContext(all, latest, args)
for pod in results['pods']:
yield Pod(self._client, pod['id'], pod)
def list(self):
"""List all pods."""
with self._client() as podman:
results = podman.ListPods()
for pod in results['pods']:
yield Pod(self._client, pod['id'], pod)