diff options
| author | Stephen Finucane <sfinucan@redhat.com> | 2023-05-08 11:35:45 +0100 |
|---|---|---|
| committer | Stephen Finucane <sfinucan@redhat.com> | 2023-05-10 10:51:30 +0100 |
| commit | 7d80f9e9626d14ce2ab60e4b69e3ccd070f31e0d (patch) | |
| tree | 6498649965c44537669d58b2167b56612cd1490b /openstackclient/common/project_purge.py | |
| parent | 7ca43885c26d9dd7903e7015c0a31f3486730eea (diff) | |
| download | python-openstackclient-7d80f9e9626d14ce2ab60e4b69e3ccd070f31e0d.tar.gz | |
Blacken openstack.common
Black used with the '-l 79 -S' flags.
A future change will ignore this commit in git-blame history by adding a
'git-blame-ignore-revs' file.
Change-Id: Ifcb3c798666d74d596b8ecb3d6d507f782de7ba5
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
Diffstat (limited to 'openstackclient/common/project_purge.py')
| -rw-r--r-- | openstackclient/common/project_purge.py | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/openstackclient/common/project_purge.py b/openstackclient/common/project_purge.py index 76ed4563..11cf0076 100644 --- a/openstackclient/common/project_purge.py +++ b/openstackclient/common/project_purge.py @@ -88,7 +88,8 @@ class ProjectPurge(command.Command): search_opts = {'tenant_id': project_id, 'all_tenants': True} data = compute_client.servers.list(search_opts=search_opts) self.delete_objects( - compute_client.servers.delete, data, 'server', dry_run) + compute_client.servers.delete, data, 'server', dry_run + ) except Exception: pass @@ -104,7 +105,8 @@ class ProjectPurge(command.Command): else: raise NotImplementedError self.delete_objects( - image_client.images.delete, data, 'image', dry_run) + image_client.images.delete, data, 'image', dry_run + ) except Exception: pass @@ -117,45 +119,49 @@ class ProjectPurge(command.Command): self.delete_one_volume_snapshot, data, 'volume snapshot', - dry_run) + dry_run, + ) except Exception: pass try: data = volume_client.backups.list(search_opts=search_opts) self.delete_objects( - self.delete_one_volume_backup, - data, - 'volume backup', - dry_run) + self.delete_one_volume_backup, data, 'volume backup', dry_run + ) except Exception: pass try: data = volume_client.volumes.list(search_opts=search_opts) self.delete_objects( - volume_client.volumes.force_delete, data, 'volume', dry_run) + volume_client.volumes.force_delete, data, 'volume', dry_run + ) except Exception: pass def delete_objects(self, func_delete, data, resource, dry_run): result = 0 for i in data: - LOG.warning(_('Deleting %(resource)s : %(id)s') % - {'resource': resource, 'id': i.id}) + LOG.warning( + _('Deleting %(resource)s : %(id)s') + % {'resource': resource, 'id': i.id} + ) if not dry_run: try: func_delete(i.id) except Exception as e: result += 1 - LOG.error(_("Failed to delete %(resource)s with " - "ID '%(id)s': %(e)s") - % {'resource': resource, 'id': i.id, 'e': e}) + LOG.error( + _( + "Failed to delete %(resource)s with " + "ID '%(id)s': %(e)s" + ) + % {'resource': resource, 'id': i.id, 'e': e} + ) if result > 0: total = len(data) - msg = (_("%(result)s of %(total)s %(resource)ss failed " - "to delete.") % - {'result': result, - 'total': total, - 'resource': resource}) + msg = _( + "%(result)s of %(total)s %(resource)ss failed " "to delete." + ) % {'result': result, 'total': total, 'resource': resource} LOG.error(msg) def delete_one_volume_snapshot(self, snapshot_id): |
