def configure()

in aws/petctl.py [0:0]


def configure(args):
    """
    Configures petctl. Writes a simple json config file indicating
    the specs file to use and the aws region to the petctl config directory
    (default ~/.petctl). Prompts the user to input the specs file location
    and aws region.
    """
    while True:
        specs_file = input(
            "Absolute path to specs file (e.g. /home/${USER}/specs.json): "
        )
        if os.path.isfile(specs_file):
            break
        print(f"[{specs_file}] does not exist! Provide an existing path")

    while True:
        region = input("Default aws region to use (e.g. us-west-2): ")
        if region:
            break
        print("AWS region cannot be empty!")

    write_config_file(region, specs_file)
    log.info(f"Configuration complete. petctl config file: {PETCTL_CONFIG_FILE}")