Exemplo n.º 1
0
def file_update_all(backend, message, dryrun):
    """
    Update all of the changed files for this Recipe
    """
    kitchen = DKCloudCommandRunner.which_kitchen_name()
    if kitchen is None:
        raise click.ClickException('You must be in a Kitchen')
    recipe_dir = DKRecipeDisk.find_recipe_root_dir()
    if recipe_dir is None:
        raise click.ClickException('You must be in a Recipe folder')
    recipe = DKRecipeDisk.find_recipe_name()

    if dryrun:
        click.secho(
            '%s - Display all changed files in Recipe (%s) in Kitchen(%s) with message (%s)'
            % (get_datetime(), recipe, kitchen, message),
            fg='green')
    else:
        click.secho(
            '%s - Updating all changed files in Recipe (%s) in Kitchen(%s) with message (%s)'
            % (get_datetime(), recipe, kitchen, message),
            fg='green')
    check_and_print(
        DKCloudCommandRunner.update_all_files(backend.dki, kitchen, recipe,
                                              recipe_dir, message, dryrun))
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 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.º 4
0
def recipe_conflicts(backend):
    """
    See if there are any unresolved conflicts for this recipe.
    """
    recipe_dir = DKRecipeDisk.find_recipe_root_dir()
    if recipe_dir is None:
        raise click.ClickException('You must be in a Recipe folder.')
    click.secho("%s - Checking for conflicts on Recipe '%s'" % (
        get_datetime(),recipe_name))
    recipe_name = DKRecipeDisk.find_recipe_name()
    check_and_print(DKCloudCommandRunner.get_unresolved_conflicts(recipe_name, recipe_dir))
Exemplo n.º 5
0
def recipe_conflicts(backend):
    """
    See if there are any unresolved conflicts for this recipe.
    """
    recipe_dir = DKRecipeDisk.find_recipe_root_dir()
    if recipe_dir is None:
        raise click.ClickException('You must be in a Recipe folder.')
    recipe_name = DKRecipeDisk.find_recipe_name()
    click.secho("%s - Checking for conflicts on Recipe '%s'" %
                (get_datetime(), recipe_name))
    recipe_name = DKRecipeDisk.find_recipe_name()
    check_and_print(
        DKCloudCommandRunner.get_unresolved_conflicts(recipe_name, recipe_dir))
Exemplo n.º 6
0
def recipe_status(backend):
    """
    Compare local recipe to remote recipe for the current recipe.
    """
    kitchen = DKCloudCommandRunner.which_kitchen_name()
    if kitchen is None:
        raise click.ClickException('You are not in a Kitchen')
    recipe_dir = DKRecipeDisk.find_recipe_root_dir()
    if recipe_dir is None:
        raise click.ClickException('You must be in a Recipe folder')
    recipe_name = DKRecipeDisk.find_recipe_name()
    click.secho("%s - Getting the status of Recipe '%s' in Kitchen '%s'\n\tversus directory '%s'" % (
        get_datetime(), recipe_name, kitchen, recipe_dir), fg='green')
    check_and_print(DKCloudCommandRunner.recipe_status(backend.dki, kitchen, recipe_name, recipe_dir))
Exemplo n.º 7
0
def recipe_status(backend):
    """
    Compare local recipe to remote recipe for the current recipe.
    """
    kitchen = DKCloudCommandRunner.which_kitchen_name()
    if kitchen is None:
        raise click.ClickException('You are not in a Kitchen')
    recipe_dir = DKRecipeDisk.find_recipe_root_dir()
    if recipe_dir is None:
        raise click.ClickException('You must be in a Recipe folder')
    recipe_name = DKRecipeDisk.find_recipe_name()
    click.secho(
        "%s - Getting the status of Recipe '%s' in Kitchen '%s'\n\tversus directory '%s'"
        % (get_datetime(), recipe_name, kitchen, recipe_dir),
        fg='green')
    check_and_print(
        DKCloudCommandRunner.recipe_status(backend.dki, kitchen, recipe_name,
                                           recipe_dir))
Exemplo n.º 8
0
def file_update_all(backend, message, dryrun):
    """
    Update all of the changed files for this Recipe
    """
    kitchen = DKCloudCommandRunner.which_kitchen_name()
    if kitchen is None:
        raise click.ClickException('You must be in a Kitchen')
    recipe_dir = DKRecipeDisk.find_recipe_root_dir()
    if recipe_dir is None:
        raise click.ClickException('You must be in a Recipe folder')
    recipe = DKRecipeDisk.find_recipe_name()

    if dryrun:
        click.secho('%s - Display all changed files in Recipe (%s) in Kitchen(%s) with message (%s)' %
                    (get_datetime(), recipe, kitchen, message), fg='green')
    else:
        click.secho('%s - Updating all changed files in Recipe (%s) in Kitchen(%s) with message (%s)' %
                    (get_datetime(), recipe, kitchen, message), fg='green')
    check_and_print(DKCloudCommandRunner.update_all_files(backend.dki, kitchen, recipe, recipe_dir, message, dryrun))