Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self,
uri='unix:/run/podman/io.podman',
interface='io.podman',
**kwargs):
"""Construct a podman varlink Client.
uri from default systemd unit file.
interface from io.podman.varlink, do not change unless
you are a varlink guru.
"""
self._client = BaseClient.factory(uri, interface, **kwargs)
address = "{}-{}".format(uri, interface)
# Quick validation of connection data provided
try:
if not System(self._client).ping():
raise ConnectionRefusedError(
errno.ECONNREFUSED,
('Failed varlink connection "{}"').format(address))
except FileNotFoundError:
raise ConnectionError(
errno.ECONNREFUSED,
('Failed varlink connection "{}".'
' Is podman socket or service running?').format(address))