Files
zaza-openstack-tests/zaza/model.py
T
Chris MacNaughton ddbbce3712 remove extra comments
2017-12-04 17:38:52 +01:00

29 lines
777 B
Python

import logging
import sys
from juju import loop
from juju.model import Model
async def deployed(filter=None):
# Create a Model instance. We need to connect our Model to a Juju api
# server before we can use it.
model = Model()
# Connect to the currently active Juju model
await model.connect_current()
try:
# list currently deploeyd services
return list(model.applications.keys())
finally:
# Disconnect from the api server and cleanup.
await model.disconnect()
def main():
# Run the deploy coroutine in an asyncio event loop, using a helper
# that abstracts loop creation and teardown.
print("Current applications: {}".format( ", ".join(loop.run(deployed()))))
if __name__ == '__main__':
main()