From 6678a4e5bc4448d59d5890f7a791ab90c5505c8e Mon Sep 17 00:00:00 2001 From: lolwww Date: Fri, 28 Jun 2019 00:02:52 +0300 Subject: [PATCH] Fix indents for pep8 --- zaza/openstack/charm_tests/cinder_backup_swift/setup.py | 4 +++- zaza/openstack/charm_tests/cinder_backup_swift/tests.py | 7 ++++--- zaza/openstack/utilities/openstack.py | 8 +++++++- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/zaza/openstack/charm_tests/cinder_backup_swift/setup.py b/zaza/openstack/charm_tests/cinder_backup_swift/setup.py index 394d9c5..8451556 100644 --- a/zaza/openstack/charm_tests/cinder_backup_swift/setup.py +++ b/zaza/openstack/charm_tests/cinder_backup_swift/setup.py @@ -17,6 +17,7 @@ import zaza.model as zaza_model import zaza.openstack.charm_tests.test_utils + def configure_cinder_backup(): """Configure cinder-backup-swift.""" keystone_ip = zaza_model.get_app_ips( @@ -40,6 +41,7 @@ def configure_cinder_backup(): zaza_model.wait_for_application_states() _singleton = zaza.openstack.charm_tests.test_utils.OpenStackBaseTest() _singleton.setUpClass() - with _singleton.config_change(cinder_backup_swift_conf, cinder_backup_swift_conf): + with _singleton.config_change(cinder_backup_swift_conf, + cinder_backup_swift_conf): # wait for configuration to be applied then return pass diff --git a/zaza/openstack/charm_tests/cinder_backup_swift/tests.py b/zaza/openstack/charm_tests/cinder_backup_swift/tests.py index 9cc058c..45e4660 100644 --- a/zaza/openstack/charm_tests/cinder_backup_swift/tests.py +++ b/zaza/openstack/charm_tests/cinder_backup_swift/tests.py @@ -45,13 +45,14 @@ class CinderBackupSwiftTest(test_utils.OpenStackBaseTest): volume_backup = openstack_utils.create_volume_backup( self.cinder_client, volume.id) + + # Check if backup was created via Swift record = openstack_utils.get_volume_backup_metadata( self.cinder_client, volume_backup.id ) - - #Check if backup was created via Swift - assert record['backup_service'] == 'cinder.backup.drivers.swift.SwiftBackupDriver' + swift_driver = 'cinder.backup.drivers.swift.SwiftBackupDriver' + assert record['backup_service'] == swift_driver # Delete volume backup logging.info('Deleting volume backup') diff --git a/zaza/openstack/utilities/openstack.py b/zaza/openstack/utilities/openstack.py index 33ef570..1339ce2 100644 --- a/zaza/openstack/utilities/openstack.py +++ b/zaza/openstack/utilities/openstack.py @@ -1692,6 +1692,7 @@ def delete_image(glance, img_id): def delete_volume(cinder, vol_id): """Delete the given volume from cinder. + :param cinder: Authenticated cinderclient :type cinder: cinderclient.Client :param vol_id: unique name or id for the openstack resource @@ -1702,6 +1703,7 @@ def delete_volume(cinder, vol_id): def delete_volume_backup(cinder, vol_backup_id): """Delete the given volume from cinder. + :param cinder: Authenticated cinderclient :type cinder: cinderclient.Client :param vol_backup_id: unique name or id for the openstack resource @@ -1710,6 +1712,7 @@ def delete_volume_backup(cinder, vol_backup_id): delete_resource(cinder.backups, vol_backup_id, msg="deleting cinder volume backup") + def upload_image_to_glance(glance, local_path, image_name, disk_format='qcow2', visibility='public', container_format='bare'): """Upload the given image to glance and apply the given label. @@ -1791,6 +1794,7 @@ def create_image(glance, image_url, image_name, image_cache_dir=None, tags=[]): def create_volume(cinder, size, name=None, image=None): """Create cinder volume. + :param cinder: Authenticated cinderclient :type cinder: cinder.Client :param size: Size of the volume @@ -1819,6 +1823,7 @@ def create_volume(cinder, size, name=None, image=None): def create_volume_backup(cinder, volume_id, name=None): """Create cinder volume backup. + :param cinder: Authenticated cinderclient :type cinder: cinder.Client :param volume_id: the source volume's id for backup @@ -1843,7 +1848,8 @@ def create_volume_backup(cinder, volume_id, name=None): def get_volume_backup_metadata(cinder, backup_id): - """Get cinder volume backup record + """Get cinder volume backup record. + :param cinder: Authenticated cinderclient :type cinder: cinder.Client :param backup_id: the source backup id