Sandro Bonazzola has uploaded a new change for review. Change subject: nit: pep8 1.5.4 fixes ......................................................................
nit: pep8 1.5.4 fixes Change-Id: I9c96c656b681d3baefecf32ac7f8dbc40ec2447a Signed-off-by: Sandro Bonazzola <[email protected]> --- M src/ovirt_hosted_engine_setup/check_liveliness.py M src/ovirt_hosted_engine_setup/tasks.py M src/plugins/ovirt-hosted-engine-setup/core/conf.py M src/plugins/ovirt-hosted-engine-setup/engine/add_host.py M src/plugins/ovirt-hosted-engine-setup/ha/ha_services.py M src/plugins/ovirt-hosted-engine-setup/libvirt/workarounds.py M src/plugins/ovirt-hosted-engine-setup/network/bridge.py M src/plugins/ovirt-hosted-engine-setup/network/gateway.py M src/plugins/ovirt-hosted-engine-setup/network/iptables.py M src/plugins/ovirt-hosted-engine-setup/pki/vdsmpki.py M src/plugins/ovirt-hosted-engine-setup/storage/storage.py M src/plugins/ovirt-hosted-engine-setup/system/vdsmenv.py M src/plugins/ovirt-hosted-engine-setup/vm/boot_disk.py M src/plugins/ovirt-hosted-engine-setup/vm/runvm.py 14 files changed, 38 insertions(+), 40 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-hosted-engine-setup refs/changes/39/26639/1 diff --git a/src/ovirt_hosted_engine_setup/check_liveliness.py b/src/ovirt_hosted_engine_setup/check_liveliness.py index a2b357f..cbfc7b6 100644 --- a/src/ovirt_hosted_engine_setup/check_liveliness.py +++ b/src/ovirt_hosted_engine_setup/check_liveliness.py @@ -1,6 +1,6 @@ # # ovirt-hosted-engine-setup -- ovirt hosted engine setup -# Copyright (C) 2013 Red Hat, Inc. +# Copyright (C) 2013-2014 Red Hat, Inc. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -89,7 +89,7 @@ except IOError: sys.stderr.write(_('Error reading the configuration file\n')) sys.exit(2) - if not 'fqdn' in config: + if 'fqdn' not in config: sys.stderr.write( _( 'Incomplete configuration, missing FQDN ' diff --git a/src/ovirt_hosted_engine_setup/tasks.py b/src/ovirt_hosted_engine_setup/tasks.py index 49dd910..b988b73 100644 --- a/src/ovirt_hosted_engine_setup/tasks.py +++ b/src/ovirt_hosted_engine_setup/tasks.py @@ -1,6 +1,6 @@ # # ovirt-hosted-engine-setup -- ovirt hosted engine setup -# Copyright (C) 2013 Red Hat, Inc. +# Copyright (C) 2013-2014 Red Hat, Inc. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -99,7 +99,7 @@ stats = response['statsList'][0] down = (stats['status'] == 'Down') elif code == 1: - #assuming VM destroyed + # Assuming VM destroyed down = True destroyed = True else: diff --git a/src/plugins/ovirt-hosted-engine-setup/core/conf.py b/src/plugins/ovirt-hosted-engine-setup/core/conf.py index 68f6d05..950480c 100644 --- a/src/plugins/ovirt-hosted-engine-setup/core/conf.py +++ b/src/plugins/ovirt-hosted-engine-setup/core/conf.py @@ -1,6 +1,6 @@ # # ovirt-hosted-engine-setup -- ovirt hosted engine setup -# Copyright (C) 2013 Red Hat, Inc. +# Copyright (C) 2013-2014 Red Hat, Inc. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -111,7 +111,6 @@ ], ), ) - # vim: expandtab tabstop=4 shiftwidth=4 diff --git a/src/plugins/ovirt-hosted-engine-setup/engine/add_host.py b/src/plugins/ovirt-hosted-engine-setup/engine/add_host.py index d410539..f1a41a2 100644 --- a/src/plugins/ovirt-hosted-engine-setup/engine/add_host.py +++ b/src/plugins/ovirt-hosted-engine-setup/engine/add_host.py @@ -125,7 +125,7 @@ if os.path.exists(authorized_keys_file): with open(authorized_keys_file, 'r') as f: content = f.read().splitlines() - if not authorized_keys_line in content: + if authorized_keys_line not in content: content.append(authorized_keys_line) with transaction.Transaction() as localtransaction: localtransaction.append( @@ -207,7 +207,7 @@ try: state = engine_api.hosts.get(host).status.state except Exception as exc: - #sadly all ovirtsdk errors inherit only from Exception + # Sadly all ovirtsdk errors inherit only from Exception self.logger.debug( 'Error fetching host state: {error}'.format( error=str(exc), @@ -502,7 +502,7 @@ ) ) else: - #This works only if the host is up. + # This works only if the host is up. self.logger.debug('Setting CPU for the cluster') try: cluster = engine_api.clusters.get(cluster_name) diff --git a/src/plugins/ovirt-hosted-engine-setup/ha/ha_services.py b/src/plugins/ovirt-hosted-engine-setup/ha/ha_services.py index a96fce4..3ec691e 100644 --- a/src/plugins/ovirt-hosted-engine-setup/ha/ha_services.py +++ b/src/plugins/ovirt-hosted-engine-setup/ha/ha_services.py @@ -1,6 +1,6 @@ # # ovirt-hosted-engine-setup -- ovirt hosted engine setup -# Copyright (C) 2013 Red Hat, Inc. +# Copyright (C) 2013-2014 Red Hat, Inc. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -67,7 +67,7 @@ ) waiter = tasks.VMDownWaiter(self.environment) if not waiter.wait(): - #The VM is down but not destroyed + # The VM is down but not destroyed vdscommand = [self.command.get('vdsClient')] if self.environment[ohostedcons.VDSMEnv.USE_SSL]: vdscommand.append('-s') diff --git a/src/plugins/ovirt-hosted-engine-setup/libvirt/workarounds.py b/src/plugins/ovirt-hosted-engine-setup/libvirt/workarounds.py index ccb3fe5..c19420f 100644 --- a/src/plugins/ovirt-hosted-engine-setup/libvirt/workarounds.py +++ b/src/plugins/ovirt-hosted-engine-setup/libvirt/workarounds.py @@ -1,6 +1,6 @@ # # ovirt-hosted-engine-setup -- ovirt hosted engine setup -# Copyright (C) 2013 Red Hat, Inc. +# Copyright (C) 2013-2014 Red Hat, Inc. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -48,16 +48,16 @@ priority=plugin.Stages.PRIORITY_LAST + 10000, ) def _terminate(self): - #TODO: libvirt has an issue in a destructor that cause an error - #message to be printed on stderr. The error is not relevant for us - #but it's really ugly to see at the end of the setup execution. - #Remove this plugin once libvirt is fixed. - #The error reported is: - #Exception AttributeError: - #AttributeError("virConnect instance has no attribute - # 'domainEventCallbacks'",) in - #<bound method virConnect.__del__ of - #<libvirt.virConnect instance at 0x4280f38>> ignored + # TODO: libvirt has an issue in a destructor that cause an error + # message to be printed on stderr. The error is not relevant for us + # but it's really ugly to see at the end of the setup execution. + # Remove this plugin once libvirt is fixed. + # The error reported is: + # Exception AttributeError: + # AttributeError("virConnect instance has no attribute + # 'domainEventCallbacks'",) in + # <bound method virConnect.__del__ of + # <libvirt.virConnect instance at 0x4280f38>> ignored sys.stderr.close() diff --git a/src/plugins/ovirt-hosted-engine-setup/network/bridge.py b/src/plugins/ovirt-hosted-engine-setup/network/bridge.py index 01b20f8..5dc7418 100644 --- a/src/plugins/ovirt-hosted-engine-setup/network/bridge.py +++ b/src/plugins/ovirt-hosted-engine-setup/network/bridge.py @@ -161,7 +161,7 @@ ] is None if interactive: default = ohostedcons.Defaults.DEFAULT_BRIDGE_IF - if not default in validValues: + if default not in validValues: default = validValues[0] self.environment[ ohostedcons.NetworkEnv.BRIDGE_IF diff --git a/src/plugins/ovirt-hosted-engine-setup/network/gateway.py b/src/plugins/ovirt-hosted-engine-setup/network/gateway.py index 565b8f1..aa8ed6d 100644 --- a/src/plugins/ovirt-hosted-engine-setup/network/gateway.py +++ b/src/plugins/ovirt-hosted-engine-setup/network/gateway.py @@ -1,6 +1,6 @@ # # ovirt-hosted-engine-setup -- ovirt hosted engine setup -# Copyright (C) 2013 Red Hat, Inc. +# Copyright (C) 2013-2014 Red Hat, Inc. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -136,7 +136,6 @@ raise RuntimeError(_('Specified gateway is not pingable')) else: self.logger.error(_('Specified gateway is not pingable')) - # vim: expandtab tabstop=4 shiftwidth=4 diff --git a/src/plugins/ovirt-hosted-engine-setup/network/iptables.py b/src/plugins/ovirt-hosted-engine-setup/network/iptables.py index c6cdd06..a4f7e5d 100644 --- a/src/plugins/ovirt-hosted-engine-setup/network/iptables.py +++ b/src/plugins/ovirt-hosted-engine-setup/network/iptables.py @@ -55,7 +55,7 @@ ), ) def _validate(self): - if not self._distribution in ('redhat', 'fedora', 'centos'): + if self._distribution not in ('redhat', 'fedora', 'centos'): self.logger.warning( _('Unsupported distribution for iptables plugin') ) diff --git a/src/plugins/ovirt-hosted-engine-setup/pki/vdsmpki.py b/src/plugins/ovirt-hosted-engine-setup/pki/vdsmpki.py index a68f0f1..12ff0b0 100644 --- a/src/plugins/ovirt-hosted-engine-setup/pki/vdsmpki.py +++ b/src/plugins/ovirt-hosted-engine-setup/pki/vdsmpki.py @@ -1,6 +1,6 @@ # # ovirt-hosted-engine-setup -- ovirt hosted engine setup -# Copyright (C) 2013 Red Hat, Inc. +# Copyright (C) 2013-2014 Red Hat, Inc. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -134,9 +134,9 @@ self.environment[ohostedcons.VDSMEnv.SPICE_SUBJECT] = subject def _generateSPICEcerts(self): - #'https://fedoraproject.org/wiki/ - #QA:Testcase_Virtualization_Manually_ - #set_spice_listening_port_with_TLS_port_set' + # 'https://fedoraproject.org/wiki/ + # QA:Testcase_Virtualization_Manually_ + # set_spice_listening_port_with_TLS_port_set' self.logger.info(_('Generating libvirt-spice certificates')) self._tmpdir = tempfile.mkdtemp() expire = '1095' # FIXME: configurable? diff --git a/src/plugins/ovirt-hosted-engine-setup/storage/storage.py b/src/plugins/ovirt-hosted-engine-setup/storage/storage.py index e19e052..a838f88 100644 --- a/src/plugins/ovirt-hosted-engine-setup/storage/storage.py +++ b/src/plugins/ovirt-hosted-engine-setup/storage/storage.py @@ -1,6 +1,6 @@ # # ovirt-hosted-engine-setup -- ovirt hosted engine setup -# Copyright (C) 2013 Red Hat, Inc. +# Copyright (C) 2013-2014 Red Hat, Inc. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -144,7 +144,7 @@ else: tries -= 1 time.sleep(1) - #rc, stdout and stderr are automatically logged as debug + # rc, stdout and stderr are automatically logged as debug self.execute( ( self.command.get('lsof'), diff --git a/src/plugins/ovirt-hosted-engine-setup/system/vdsmenv.py b/src/plugins/ovirt-hosted-engine-setup/system/vdsmenv.py index 837bac1..60cbd91 100644 --- a/src/plugins/ovirt-hosted-engine-setup/system/vdsmenv.py +++ b/src/plugins/ovirt-hosted-engine-setup/system/vdsmenv.py @@ -1,6 +1,6 @@ # # ovirt-hosted-engine-setup -- ovirt hosted engine setup -# Copyright (C) 2013 Red Hat, Inc. +# Copyright (C) 2013-2014 Red Hat, Inc. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -121,7 +121,7 @@ ), ) def _late_setup(self): - #We need vdsmd up for customization checks + # We need vdsmd up for customization checks if not self.services.status( name=self.environment[ ohostedcons.VDSMEnv.VDSMD_SERVICE @@ -179,7 +179,7 @@ ], state=True, ) - #We need to restart the daemon for reloading the configuration + # We need to restart the daemon for reloading the configuration for state in (False, True): self.services.state( name=self.environment[ diff --git a/src/plugins/ovirt-hosted-engine-setup/vm/boot_disk.py b/src/plugins/ovirt-hosted-engine-setup/vm/boot_disk.py index 7d3e93c..a8e93b0 100644 --- a/src/plugins/ovirt-hosted-engine-setup/vm/boot_disk.py +++ b/src/plugins/ovirt-hosted-engine-setup/vm/boot_disk.py @@ -1,6 +1,6 @@ # # ovirt-hosted-engine-setup -- ovirt hosted engine setup -# Copyright (C) 2013 Red Hat, Inc. +# Copyright (C) 2013-2014 Red Hat, Inc. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -318,7 +318,7 @@ self.logger.error(_('The specified file does not exists')) success = False else: - #decode ovf file content + # Decode ovf file content tar = tarfile.open(path, 'r:gz') try: ovf_xml = None diff --git a/src/plugins/ovirt-hosted-engine-setup/vm/runvm.py b/src/plugins/ovirt-hosted-engine-setup/vm/runvm.py index b68ff06..251d691 100644 --- a/src/plugins/ovirt-hosted-engine-setup/vm/runvm.py +++ b/src/plugins/ovirt-hosted-engine-setup/vm/runvm.py @@ -1,6 +1,6 @@ # # ovirt-hosted-engine-setup -- ovirt hosted engine setup -# Copyright (C) 2013 Red Hat, Inc. +# Copyright (C) 2013-2014 Red Hat, Inc. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -134,8 +134,8 @@ ), ) def _boot_from_install_media(self): - #Need to be done after firewall closeup for allowing the user to - #connect from remote. + # Need to be done after firewall closeup for allowing the user to + # connect from remote. os_installed = False while not os_installed: self._create_vm() -- To view, visit http://gerrit.ovirt.org/26639 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9c96c656b681d3baefecf32ac7f8dbc40ec2447a Gerrit-PatchSet: 1 Gerrit-Project: ovirt-hosted-engine-setup Gerrit-Branch: master Gerrit-Owner: Sandro Bonazzola <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
