Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def prepare_client(image):
'''prepare a client to embed in a shell with recipe parsers and writers.
'''
# The client will announce itself (backend/database) unless it's get
from spython.main import get_client
from spython.main.parse import parsers
from spython.main.parse import writers
client = get_client()
client.load(image)
# Add recipe parsers
client.parsers = parsers
client.writers = writers
return client
def __init__(self, name, working_dir, sudo=False, params=None):
if not params:
params = {}
self.image = None
self.recipe = None
self.instance = None
self.sudo = sudo
self.set_name(name, params)
self.set_args(params)
self.set_context(params)
self.set_volumes(params)
self.set_ports(params)
self.params = params
self.client = get_client()
self.working_dir = working_dir
# If the instance exists, instantiate it
self.get()
def __init__(self, filename=None, name=None, env_file=None):
self.set_filename(filename)
self.set_name(name)
self.load()
self.parse()
self.env_file = env_file
self.client = get_client()