Commit 0edc0b6c authored by kaiyou's avatar kaiyou
Browse files

Support cloning a configuration repo

parent 944fa74b
Pipeline #650 passed with stage
in 2 minutes and 6 seconds
......@@ -26,7 +26,14 @@ def expand(conf):
def load():
""" Load the configuration from a yaml file
"""
config_path = glob.glob(os.environ.get("AMONIT_CONFIG", "amonit.yaml"))
config_glob = None
if "AMONIT_CONFIG_REPO" in os.environ:
config_repo = os.environ["AMONIT_CONFIG_REPO"]
result = os.system("git clone {} /tmp/repo".format(config_repo))
config_glob = "/tmp/repo/*.yaml" if result == 0 else None
if "AMONIT_CONFIG" in os.environ:
config_glob = os.environ["AMONIT_CONFIG"]
config_path = glob.glob(config_glob or "amonit.yaml")
if not config_path:
raise ValueError("No configuration was loaded")
loaded = [{}]
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment