def get_credentials():
    """ Get consul api password from security.yml """
    # TODO: is this the correct YAML key for the Consul API password?
    yaml_key = "nginx_admin_password:"
    try:
        with open('security.yml') as f:
            for line in f:
                if yaml_key in line:
                    # credentials are the whole string after the key
                    password = line[len(yaml_key):].strip()
                    # only grab what we need
                    return "admin:"+password
    except IOError:
        # Returning "" ensures that unit tests will run network code, rather
        # than just failing because security.yml isn't present.
        return ""
dataset/ETHPy150Open CiscoCloud/mantl/testing/healthchecks.py/get_credentials/original