def delete(self, *backups): """Delete one or more backups Args: One or Multiple 'cfme.storage.volume_backup.VolumeBackup' objects """ view = navigate_to(self, 'All') if view.entities.get_all(): for backup in backups: try: view.entities.get_entity(name=backup.name).check() except ItemNotFound: raise BackupNotFoundError( "Volume backup {} not found".format(backup.name)) view.toolbar.configuration.item_select('Delete selected Backups', handle_alert=True) wait_for(lambda: not bool({backup.name for backup in backups} & set( view.entities.all_entity_names)), message="Wait backups to disappear", delay=20, timeout=800, fail_func=random.choice(backups).refresh) else: raise BackupNotFoundError('No Volume Backups for Deletion')
def step(self, *args, **kwargs): try: self.prerequisite_view.entities.get_entity( name=self.obj.name, surf_pages=True).click() except ItemNotFound: raise BackupNotFoundError( 'Could not locate volume backup {}'.format(self.obj.name))