Exemple #1
0
                            break

            if vm_name_match:
                for vm_name in map(lambda x: x.name, existing_vms):
                    if re.match(vm_name_match, vm_name):
                        for vm in existing_vms:
                            if vm.name == vm_name:
                                tmp_vms.append(vm)
                            break

            tmp_vms = unique_list(tmp_vms)
            backup.run_backup(tmp_vms, allow_using_any_existing_snapshot=allow_using_any_existing_snapshot)
            os.remove('/tmp/proxmox-rbd-backup.lock')
        if re.match(r'^(list|ls)$', args.action_backup):
            tmp_vms = []
            for vm in backup.get_vms():
                tmp_vms.append({
                    'VMID': vm['vm.id'],
                    'Name': vm['vm.name'],
                    'UUID': vm['vm.uuid'],
                    'Last updated': vm['last_updated']
                })
            tmp_vms = unique_list(tmp_vms)
            print(tabulate(tmp_vms, headers='keys'))
        if re.match(r'^(remove|rm)$', args.action_backup):
            vms_uuid = args.vm_uuid
            vms_id = args.vm_id
            vm_name_match = args.vm_name
            force = args.force

            if is_list_empty(vms_uuid) and not vm_name_match and is_list_empty(vms_id):