def snapshot_main(bin_dir, storages, keep, verbose, gzip, backup_blobs, only_blobs, use_rsync, keep_blob_days=0, pre_command='', post_command='', **kwargs): """Main method, gets called by generated bin/snapshotbackup.""" utils.execute_or_fail(pre_command) if not only_blobs: result = repozorunner.snapshot_main( bin_dir, storages, keep, verbose, gzip) if result and backup_blobs: logger.error("Halting execution due to error; not backing up " "blobs.") if not backup_blobs: utils.execute_or_fail(post_command) return for storage in storages: blobdir = storage['blobdir'] if not blobdir: logger.info("No blob dir defined for %s storage" % \ (storage['storage'])) continue blob_snapshot_location = storage['blob_snapshot_location'] logger.info("Please wait while making snapshot of blobs from %s to %s", blobdir, blob_snapshot_location) copyblobs.backup_blobs(blobdir, blob_snapshot_location, full=True, use_rsync=use_rsync, keep=keep, keep_blob_days=keep_blob_days) utils.execute_or_fail(post_command)
def snapshot_main(bin_dir, storages, keep, verbose, gzip, backup_blobs, only_blobs, use_rsync, keep_blob_days=0, pre_command='', post_command='', gzip_blob=False, rsync_options='', quick=True, **kwargs): """Main method, gets called by generated bin/snapshotbackup.""" utils.check_folders(storages, backup_blobs=backup_blobs, only_blobs=only_blobs, backup=False, snapshot=True, zipbackup=False) utils.execute_or_fail(pre_command) if not only_blobs: result = repozorunner.snapshot_main(bin_dir, storages, keep, verbose, gzip) if result: if backup_blobs: logger.error("Halting execution due to error; not backing up " "blobs.") else: logger.error("Halting execution due to error.") sys.exit(1) if not backup_blobs: utils.execute_or_fail(post_command) return for storage in storages: blobdir = storage['blobdir'] if not blobdir: logger.info("No blob dir defined for %s storage" % storage['storage']) continue blob_snapshot_location = storage['blob_snapshot_location'] logger.info("Please wait while making snapshot of blobs from %s to %s", blobdir, blob_snapshot_location) copyblobs.backup_blobs(blobdir, blob_snapshot_location, full=True, use_rsync=use_rsync, keep=keep, keep_blob_days=keep_blob_days, gzip_blob=gzip_blob, rsync_options=rsync_options) utils.execute_or_fail(post_command)
def snapshot_main(bin_dir, datafs, snapshot_location, keep, verbose, gzip, additional, blob_storage_source, backup_blobs, only_blobs, **kwargs): """Main method, gets called by generated bin/snapshotbackup.""" if not only_blobs: result = repozorunner.snapshot_main( bin_dir, datafs, snapshot_location, keep, verbose, gzip, additional) if result and backup_blobs: logger.error("Halting execution due to error; not backing up " "blobs.") if not backup_blobs: return if not blob_storage_source: logger.error("No blob storage source specified") sys.exit(1) result = repoborunner.snapshot_main(bin_dir, blob_storage_source, snapshot_location, keep, verbose, gzip)