weka / snaptool

GNU General Public License v3.0
9 stars 4 forks source link

Request: have the ability to upload to both a local and remote bucket, within the same schedule #33

Open vrragosta opened 10 months ago

vrragosta commented 10 months ago

Currently, per the logic in create_snapshot(), uploading to local vs remote buckets is mutually exclusive. There has been a request to permit both of these to be specified within the same schedule.

def create_snapshot(self, fs, name, access_point_name, upload):
    try:
        status = self.call_weka_api(method="snapshots_list", parms={'file_system': fs, 'name': name})
        if len(status) == 1:
            actions_log.info(f"Snapshot exists: {fs} - {name}")
            return
        created_snap = self.call_weka_api(method="snapshot_create", parms={
            "file_system": fs,
            "name": name,
            "access_point": access_point_name,
            "is_writable": False})
        if created_snap == None:
            actions_log.info(f"Snapshot exists: {fs} - {name}")
            log.info(f"   Snap {fs}/{name} already exists")
        else:
            actions_log.info(f"Created snap {fs} - {name}")
            log.info(f"   Snap {fs}/{name} created")
        upload_op = False
        if upload == True or str(upload).upper() == 'LOCAL':
            upload_op = "upload"
        elif str(upload).upper() == 'REMOTE':
            upload_op = "upload-remote"
        if upload_op:
            background.QueueOperation(self.weka_cluster, fs, name, upload_op)