This repository has been archived on 2020-06-17. You can view files and clone it, but cannot push or open issues or pull requests.
autonomic/autonomic/infrastructure.py

21 lines
554 B
Python

"""Infrastructure handling module."""
import os
from autonomic.settings import MEMBERS_YAML
from autonomic.system import exit_with_msg
from autonomic.yaml import yaml
def get_members():
"""Get list of Autonomic members."""
if not os.path.exists(MEMBERS_YAML):
msg = "{} is missing, run: autonomic init".format(MEMBERS_YAML)
exit_with_msg(msg)
with open(MEMBERS_YAML, "r") as handle:
try:
return yaml.load(handle.read())
except Exception as exception:
exit_with_msg(str(exception))