Exemplo n.º 1
0
def recipe_get(backend, recipe):
    """
    Get the latest files for this recipe.
    """
    recipe_root_dir = DKRecipeDisk.find_recipe_root_dir()
    if recipe_root_dir is None:
        if recipe is None:
            raise click.ClickException(
                "\nPlease change to a recipe folder or provide a recipe name arguement"
            )

        # raise click.ClickException('You must be in a Recipe folder')
        kitchen_root_dir = DKKitchenDisk.is_kitchen_root_dir()
        if not kitchen_root_dir:
            raise click.ClickException(
                "\nPlease change to a recipe folder or a kitchen root dir.")
        recipe_name = recipe
        start_dir = DKKitchenDisk.find_kitchen_root_dir()
    else:
        recipe_name = DKRecipeDisk.find_recipe_name()
        if recipe is not None:
            if recipe_name != recipe:
                raise click.ClickException(
                    "\nThe recipe name argument '%s' is inconsistent with the current directory '%s'"
                    % (recipe, recipe_root_dir))
        start_dir = recipe_root_dir

    kitchen_name = Backend.get_kitchen_name_soft()
    click.secho(
        "%s - Getting the latest version of Recipe '%s' in Kitchen '%s'" %
        (get_datetime(), recipe_name, kitchen_name),
        fg='green')
    check_and_print(
        DKCloudCommandRunner.get_recipe(backend.dki, kitchen_name, recipe_name,
                                        start_dir))
Exemplo n.º 2
0
def recipe_get(backend, recipe):
    """
    Get the latest files for this recipe.
    """
    recipe_root_dir = DKRecipeDisk.find_recipe_root_dir()
    if recipe_root_dir is None:
        if recipe is None:
            raise click.ClickException("\nPlease change to a recipe folder or provide a recipe name arguement")

        # raise click.ClickException('You must be in a Recipe folder')
        kitchen_root_dir = DKKitchenDisk.is_kitchen_root_dir()
        if not kitchen_root_dir:
            raise click.ClickException("\nPlease change to a recipe folder or a kitchen root dir.")
        recipe_name = recipe
        start_dir = DKKitchenDisk.find_kitchen_root_dir()
    else:
        recipe_name = DKRecipeDisk.find_recipe_name()
        if recipe is not None:
            if recipe_name != recipe:
                raise click.ClickException("\nThe recipe name argument '%s' is inconsistent with the current directory '%s'" % (recipe, recipe_root_dir))
        start_dir = recipe_root_dir

    kitchen_name = Backend.get_kitchen_name_soft()
    click.secho("%s - Getting the latest version of Recipe '%s' in Kitchen '%s'" % (get_datetime(), recipe_name, kitchen_name), fg='green')
    check_and_print(DKCloudCommandRunner.get_recipe(backend.dki, kitchen_name, recipe_name, start_dir))
Exemplo n.º 3
0
def kitchen_get(backend, kitchen_name, recipe):
    """
    Get an existing Kitchen
    """
    found_kitchen = DKKitchenDisk.find_kitchen_name()
    if found_kitchen is not None and len(found_kitchen) > 0:
        raise click.ClickException("You cannot get a kitchen into an existing kitchen directory structure.")

    if len(recipe) > 0:
        click.secho("%s - Getting kitchen '%s' and the recipes %s" % (get_datetime(), kitchen_name, str(recipe)), fg='green')
    else:
        click.secho("%s - Getting kitchen '%s'" % (get_datetime(), kitchen_name), fg='green')

    check_and_print(DKCloudCommandRunner.get_kitchen(backend.dki, kitchen_name, os.getcwd(), recipe))
Exemplo n.º 4
0
def kitchen_get(backend, kitchen_name, recipe):
    """
    Get an existing Kitchen
    """
    found_kitchen = DKKitchenDisk.find_kitchen_name()
    if found_kitchen is not None and len(found_kitchen) > 0:
        raise click.ClickException(
            "You cannot get a kitchen into an existing kitchen directory structure."
        )

    if len(recipe) > 0:
        click.secho("%s - Getting kitchen '%s' and the recipes %s" %
                    (get_datetime(), kitchen_name, str(recipe)),
                    fg='green')
    else:
        click.secho("%s - Getting kitchen '%s'" %
                    (get_datetime(), kitchen_name),
                    fg='green')

    check_and_print(
        DKCloudCommandRunner.get_kitchen(backend.dki, kitchen_name,
                                         os.getcwd(), recipe))