Remove unnecessary parantheses
Remove all the explicit paranthesis tuples (under return values). Change-Id: Id8e2b2fd0d74788e46c8f8686e5653b4b7a44978
This commit is contained in:
@@ -46,7 +46,7 @@ class BaseOSUtils(object):
|
||||
out = out.decode(sys.stdout.encoding)
|
||||
err = err.decode(sys.stdout.encoding)
|
||||
|
||||
return (out, err, p.returncode)
|
||||
return out, err, p.returncode
|
||||
|
||||
def sanitize_shell_input(self, value):
|
||||
raise NotImplementedError()
|
||||
|
||||
@@ -389,7 +389,7 @@ class WindowsUtils(base.BaseOSUtils):
|
||||
raise exception.WindowsCloudbaseInitException(
|
||||
"Cannot get user SID: %r")
|
||||
|
||||
return (sid, domainName.value)
|
||||
return sid, domainName.value
|
||||
|
||||
def add_user_to_local_group(self, username, groupname):
|
||||
|
||||
@@ -734,9 +734,9 @@ class WindowsUtils(base.BaseOSUtils):
|
||||
default_routes = [r for r in self._get_ipv4_routing_table()
|
||||
if r[0] == '0.0.0.0']
|
||||
if default_routes:
|
||||
return (default_routes[0][3], default_routes[0][2])
|
||||
return default_routes[0][3], default_routes[0][2]
|
||||
else:
|
||||
return (None, None)
|
||||
return None, None
|
||||
|
||||
@staticmethod
|
||||
def _heap_alloc(heap, size):
|
||||
|
||||
@@ -22,7 +22,7 @@ class BasePlugin(object):
|
||||
return self.__class__.__name__
|
||||
|
||||
def get_os_requirements(self):
|
||||
return (None, None)
|
||||
return None, None
|
||||
|
||||
def execute(self, service, shared_data):
|
||||
pass
|
||||
|
||||
@@ -88,4 +88,4 @@ class BaseCreateUserPlugin(base.BasePlugin):
|
||||
except Exception:
|
||||
LOG.exception('Cannot add user to group "%s"', group_name)
|
||||
|
||||
return (base.PLUGIN_EXECUTION_DONE, False)
|
||||
return base.PLUGIN_EXECUTION_DONE, False
|
||||
|
||||
@@ -52,4 +52,4 @@ class MTUPlugin(base.BasePlugin):
|
||||
LOG.debug('Could not obtain the MTU configuration '
|
||||
'via DHCP for interface "%s"' % mac_address)
|
||||
|
||||
return (base.PLUGIN_EXECUTE_ON_NEXT_BOOT, False)
|
||||
return base.PLUGIN_EXECUTE_ON_NEXT_BOOT, False
|
||||
|
||||
@@ -65,7 +65,7 @@ class NTPClientPlugin(base.BasePlugin):
|
||||
|
||||
if not ntp_option_data:
|
||||
LOG.debug("Could not obtain the NTP configuration via DHCP")
|
||||
return (base.PLUGIN_EXECUTE_ON_NEXT_BOOT, False)
|
||||
return base.PLUGIN_EXECUTE_ON_NEXT_BOOT, False
|
||||
|
||||
ntp_hosts = self._unpack_ntp_hosts(ntp_option_data)
|
||||
|
||||
@@ -74,4 +74,4 @@ class NTPClientPlugin(base.BasePlugin):
|
||||
|
||||
LOG.info('NTP client configured. Server(s): %s' % ntp_hosts)
|
||||
|
||||
return (base.PLUGIN_EXECUTION_DONE, False)
|
||||
return base.PLUGIN_EXECUTION_DONE, False
|
||||
|
||||
@@ -42,7 +42,7 @@ class SetHostNamePlugin(base.BasePlugin):
|
||||
metadata_host_name = service.get_host_name()
|
||||
if not metadata_host_name:
|
||||
LOG.debug('Hostname not found in metadata')
|
||||
return (base.PLUGIN_EXECUTION_DONE, False)
|
||||
return base.PLUGIN_EXECUTION_DONE, False
|
||||
|
||||
metadata_host_name = metadata_host_name.split('.', 1)[0]
|
||||
|
||||
@@ -65,4 +65,4 @@ class SetHostNamePlugin(base.BasePlugin):
|
||||
LOG.info("Setting hostname: %s" % new_host_name)
|
||||
reboot_required = osutils.set_host_name(new_host_name)
|
||||
|
||||
return (base.PLUGIN_EXECUTION_DONE, reboot_required)
|
||||
return base.PLUGIN_EXECUTION_DONE, reboot_required
|
||||
|
||||
@@ -129,6 +129,6 @@ class SetUserPasswordPlugin(base.BasePlugin):
|
||||
# If the metadata provider can update the password, the plugin
|
||||
# must run at every boot in order to update the password if
|
||||
# it was changed.
|
||||
return (base.PLUGIN_EXECUTE_ON_NEXT_BOOT, False)
|
||||
return base.PLUGIN_EXECUTE_ON_NEXT_BOOT, False
|
||||
else:
|
||||
return (base.PLUGIN_EXECUTION_DONE, False)
|
||||
return base.PLUGIN_EXECUTION_DONE, False
|
||||
|
||||
@@ -32,7 +32,7 @@ class SetUserSSHPublicKeysPlugin(base.BasePlugin):
|
||||
public_keys = service.get_public_keys()
|
||||
if not public_keys:
|
||||
LOG.debug('Public keys not found in metadata')
|
||||
return (base.PLUGIN_EXECUTION_DONE, False)
|
||||
return base.PLUGIN_EXECUTION_DONE, False
|
||||
|
||||
username = CONF.username
|
||||
|
||||
@@ -55,4 +55,4 @@ class SetUserSSHPublicKeysPlugin(base.BasePlugin):
|
||||
# All public keys are space-stripped.
|
||||
f.write(public_key + "\n")
|
||||
|
||||
return (base.PLUGIN_EXECUTION_DONE, False)
|
||||
return base.PLUGIN_EXECUTION_DONE, False
|
||||
|
||||
@@ -35,10 +35,10 @@ class UserDataPlugin(base.BasePlugin):
|
||||
try:
|
||||
user_data = service.get_user_data()
|
||||
except metadata_services_base.NotExistingMetadataException:
|
||||
return (base.PLUGIN_EXECUTION_DONE, False)
|
||||
return base.PLUGIN_EXECUTION_DONE, False
|
||||
|
||||
if not user_data:
|
||||
return (base.PLUGIN_EXECUTION_DONE, False)
|
||||
return base.PLUGIN_EXECUTION_DONE, False
|
||||
|
||||
LOG.debug('User data content length: %d' % len(user_data))
|
||||
user_data = self._check_gzip_compression(user_data)
|
||||
@@ -76,7 +76,7 @@ class UserDataPlugin(base.BasePlugin):
|
||||
for handler_func in list(set(user_handlers.values())):
|
||||
self._end_part_process_event(handler_func)
|
||||
|
||||
return (plugin_status, reboot)
|
||||
return plugin_status, reboot
|
||||
else:
|
||||
return self._process_non_multi_part(user_data)
|
||||
|
||||
|
||||
@@ -167,7 +167,7 @@ class ExtendVolumesPlugin(base.BasePlugin):
|
||||
for pack in packs:
|
||||
self._extend_volumes(pack, volumes_to_extend)
|
||||
|
||||
return (base.PLUGIN_EXECUTE_ON_NEXT_BOOT, False)
|
||||
return base.PLUGIN_EXECUTE_ON_NEXT_BOOT, False
|
||||
|
||||
def get_os_requirements(self):
|
||||
return ('win32', (5, 2))
|
||||
return 'win32', (5, 2)
|
||||
|
||||
@@ -67,4 +67,4 @@ class WindowsLicensingPlugin(base.BasePlugin):
|
||||
activation_result = self._run_slmgr(osutils, ['/ato'])
|
||||
LOG.debug("Activation result:\n%s" % activation_result)
|
||||
|
||||
return (base.PLUGIN_EXECUTION_DONE, False)
|
||||
return base.PLUGIN_EXECUTION_DONE, False
|
||||
|
||||
@@ -53,7 +53,7 @@ class ConfigWinRMCertificateAuthPlugin(base.BasePlugin):
|
||||
# as it is currently not needed by other plugins
|
||||
shared_data[constants.SHARED_DATA_PASSWORD] = None
|
||||
|
||||
return (user_name, password)
|
||||
return user_name, password
|
||||
|
||||
def execute(self, service, shared_data):
|
||||
user_name, password = self._get_credentials(service, shared_data)
|
||||
@@ -62,7 +62,7 @@ class ConfigWinRMCertificateAuthPlugin(base.BasePlugin):
|
||||
if not certs_data:
|
||||
LOG.info("WinRM certificate authentication cannot be configured "
|
||||
"as a certificate has not been provided in the metadata")
|
||||
return (base.PLUGIN_EXECUTION_DONE, False)
|
||||
return base.PLUGIN_EXECUTION_DONE, False
|
||||
|
||||
osutils = osutils_factory.get_os_utils()
|
||||
security_utils = security.WindowsSecurityUtils()
|
||||
@@ -112,4 +112,4 @@ class ConfigWinRMCertificateAuthPlugin(base.BasePlugin):
|
||||
LOG.debug("Enabling UAC remote restrictions")
|
||||
security_utils.set_uac_remote_restrictions(enable=True)
|
||||
|
||||
return (base.PLUGIN_EXECUTION_DONE, False)
|
||||
return base.PLUGIN_EXECUTION_DONE, False
|
||||
|
||||
@@ -65,7 +65,7 @@ class ConfigWinRMListenerPlugin(base.BasePlugin):
|
||||
security_utils = security.WindowsSecurityUtils()
|
||||
|
||||
if not self._check_winrm_service(osutils):
|
||||
return (base.PLUGIN_EXECUTE_ON_NEXT_BOOT, False)
|
||||
return base.PLUGIN_EXECUTE_ON_NEXT_BOOT, False
|
||||
|
||||
# On Windows Vista, 2008, 2008 R2 and 7, changing the configuration of
|
||||
# the winrm service will fail with an "Access is denied" error if the
|
||||
@@ -110,4 +110,4 @@ class ConfigWinRMListenerPlugin(base.BasePlugin):
|
||||
LOG.debug("Enabling UAC remote restrictions")
|
||||
security_utils.set_uac_remote_restrictions(enable=True)
|
||||
|
||||
return (base.PLUGIN_EXECUTION_DONE, False)
|
||||
return base.PLUGIN_EXECUTION_DONE, False
|
||||
|
||||
@@ -71,14 +71,14 @@ def _parse_dhcp_reply(data, id_req):
|
||||
message_type = struct.unpack('b', data[0:1])[0]
|
||||
|
||||
if message_type != 2:
|
||||
return (False, {})
|
||||
return False, {}
|
||||
|
||||
id_reply = struct.unpack('!L', data[4:8])[0]
|
||||
if id_reply != id_req:
|
||||
return (False, {})
|
||||
return False, {}
|
||||
|
||||
if data[236:240] != _DHCP_COOKIE:
|
||||
return (False, {})
|
||||
return False, {}
|
||||
|
||||
options = {}
|
||||
|
||||
@@ -91,7 +91,7 @@ def _parse_dhcp_reply(data, id_req):
|
||||
options[id_option] = data[i: i + option_data_len]
|
||||
i += option_data_len
|
||||
|
||||
return (True, options)
|
||||
return True, options
|
||||
|
||||
|
||||
def _get_mac_address_by_local_ip(ip_addr):
|
||||
|
||||
@@ -107,4 +107,4 @@ class PhysicalDisk(object):
|
||||
if not ret_val:
|
||||
raise exception.WindowsCloudbaseInitException(
|
||||
"Read exception: %r")
|
||||
return (buf, bytes_read.value)
|
||||
return buf, bytes_read.value
|
||||
|
||||
@@ -285,7 +285,7 @@ class CryptoAPICertManager(object):
|
||||
upn = upn_ar.value
|
||||
|
||||
thumbprint = self._get_cert_thumprint(cert_context_p)
|
||||
return (thumbprint, upn)
|
||||
return thumbprint, upn
|
||||
finally:
|
||||
if cert_context_p:
|
||||
cryptoapi.CertFreeCertificateContext(cert_context_p)
|
||||
|
||||
Reference in New Issue
Block a user