devpi-create-backup

Description

Note, this frecklet does not create the local destination parent folder for the fetched backup archive.

Variables

Name Type Default Description

backup_archive_file

string ~/Downloads/

Specify a trailinug '/' in this var to use the (timestamped) default file-name.

Code

doc:
  short_help: Backs-up a devpi service.
  help: |
    Note, this *frecklet* does not create the local destination parent folder for the fetched backup archive.

args:
  backup_archive_file:
    doc:
      short_help: The (local) destination file/folder.
      help: |
        Specify a trailinug '/' in this var to use the (timestamped) default file-name.
    type: string
    default: ~/Downloads/

meta:
  status: unknown

frecklets:
- folder-is-empty:
    path: /tmp/devpi-backup
    mode: '0700'
    owner: devpi
    group: devpi
- execute-command:
    command: /home/devpi/.virtualenvs/devpi/bin/devpi-server --export /tmp/devpi-backup
    become_user: devpi
- path-archived:
    path: /tmp/devpi-backup/*
    become: true
    mode: '0700'
    owner: '{{ ansible_env.USER }}'
    dest: /tmp/devpi-backup-{{ ansible_date_time.iso8601_basic_short }}.tar.gz
- path-is-absent:
    path: /tmp/devpi-backup
    become: true
- file-fetched:
    src: /tmp/devpi-backup-{{ ansible_date_time.iso8601_basic_short }}.tar.gz
    dest: '{{:: backup_archive_file ::}}'
- path-is-absent:
    path: /tmp/devpi-backup-{{ ansible_date_time.iso8601_basic_short }}.tar.gz
    become: true
frecklecute devpi-create-backup --help

Usage: frecklecute devpi-create-backup [OPTIONS]

  Note, this *frecklet* does not create the local destination parent folder
  for the fetched backup archive.

Options:
  --backup-archive-file BACKUP_ARCHIVE_FILE
                                  The (local) destination file/folder.
  --help                          Show this message and exit.
# -*- coding: utf-8 -*-


#
# module path: pycklets.devpi_create_backup.DevpiCreateBackup
#


from dataclasses import dataclass
from pyckles import AutoPycklet
from typing import *    # noqa

@dataclass
class DevpiCreateBackup(AutoPycklet):
    """Note, this *frecklet* does not create the local destination parent folder for the fetched backup archive.

       Args:
         backup_archive_file: The (local) destination file/folder.

    """

    FRECKLET_ID = "devpi-create-backup"

    backup_archive_file: str = None


    def __post_init__(self):
        super(DevpiCreateBackup, self).__init__(var_names=["backup_archive_file"])


frecklet_class = DevpiCreateBackup
# -*- coding: utf-8 -*-


#
# module path: pycklets.devpi_create_backup.DevpiCreateBackup
#


from pyckles import AutoPycklet

class DevpiCreateBackup(AutoPycklet):
    """Note, this *frecklet* does not create the local destination parent folder for the fetched backup archive.

       Args:
         backup_archive_file: The (local) destination file/folder.

    """

    FRECKLET_ID = "devpi-create-backup"

    def __init__(self, backup_archive_file="~/Downloads/"):

        super(DevpiCreateBackup, self).__init__(var_names=["backup_archive_file"])
        self._backup_archive_file = backup_archive_file

    @property
    def backup_archive_file(self):
        return self._backup_archive_file

    @backup_archive_file.setter
    def backup_archive_file(self, backup_archive_file):
        self._backup_archive_file = backup_archive_file



frecklet_class = DevpiCreateBackup