Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def run_listener(client, event, juju_bin):
logging.info("Running listener.")
loop = asyncio.get_event_loop()
future = asyncio.Future()
logging.info("Connect to the current model.")
os.environ['JUJU_DATA'] = client.env.juju_home
os.environ['PATH'] = "{}{}{}".format(
juju_bin, os.pathsep, os.environ.get('PATH', ''))
conn = loop.run_until_complete(Connection.connect_current())
logging.info("Connected to the current model.")
asyncio.ensure_future(listen_to_watcher(event, conn, future))
return loop, future