Skip to content

Allow for restricting to only backup or restore for a file #7

@k4j8

Description

@k4j8

In addition to include_devices and exclude_devices, add options for backup_only_devices and restore_only_devices for files. When evaluating if a file should be acted upon, consider devices in the corresponding category as well.

Code to modify below.

In sync.py,

     if ftconfig.sync in [BACKUP]:
         includes = ['include_devices', 'backup_only_devices']
     elif ftconfig.sync in [STATUS, RESTORE]:
         includes = ['include_devices', 'restore_only_devices']
     include_devices_all = [cfile.yaml_file[x] for x in includes if include in cfile.yaml_file
         

     # Check if file is for this device
     if len(include_devices_all):
         if cdevice.device_id not in include_devices_all:
             logging.debug('Skipping %s, host not in included list',
                           cfile.file_id)
             return SKIP
     elif 'exclude_devices' in cfile.yaml_file:
         if cdevice.device_id in cfile.yaml_file['exclude_devices']:
             logging.debug('Skipping %s, host in excluded list',
                           cfile.file_id)
             return SKIP

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions