Pylint: enable global-variable-not-assigned check

the global keyword should be used only when variable from outside is
assigned inside, otherwise it has no effect and just confuses developers

Reviewed-By: Tomas Krizek <tkrizek@redhat.com>
This commit is contained in:
Martin Basti 2016-09-22 14:39:16 +02:00
parent 4d7d53c966
commit 9b68d2a1f8
6 changed files with 3 additions and 15 deletions

View File

@ -38,7 +38,9 @@ KEYTAB_FB = paths.IPA_DNSKEYSYNCD_KEYTAB
# Shutdown handler
def commenceShutdown(signum, stack):
# Declare the needed global variables
global watcher_running, ldap_connection, log
global watcher_running
global ldap_connection # pylint: disable=global-variable-not-assigned
log.info('Signal %s received: Shutting down!', signum)
# We are no longer running

View File

@ -385,7 +385,6 @@ def main():
print_info("\nConnection from replica to master is OK.")
# create listeners
global RESPONDERS
print_info("Start listening on required ports for remote master check")
for port in required_ports:

View File

@ -314,9 +314,6 @@ def install_check(standalone, api, replica, options, hostname):
def install(standalone, replica, options, api=api):
global ip_addresses
global reverse_zones
local_dnskeysyncd_dn = DN(('cn', 'DNSKeySync'), ('cn', api.env.host),
('cn', 'masters'), ('cn', 'ipa'), ('cn', 'etc'),
api.env.basedn)

View File

@ -35,17 +35,14 @@ def _load_sstore():
def get_upgrade_state(module, state):
_load_sstore()
global _sstore
return _sstore.get_state(module, state)
def set_upgrade_state(module, state, value):
_load_sstore()
global _sstore
_sstore.backup_state(module, state, value)
def remove_upgrade_state(module, state):
_load_sstore()
global _sstore
_sstore.delete_state(module, state)
def remove_upgrade_file():

View File

@ -166,8 +166,6 @@ class test_cert(XMLRPC_test):
"""
Verify that service-show has the right certificate using service-show.
"""
global cert
res = api.Command['service_show'](self.service_princ)['result']
assert base64.b64encode(res['usercertificate'][0]) == cert
@ -175,8 +173,6 @@ class test_cert(XMLRPC_test):
"""
Verify that service-find has the right certificate using service-find.
"""
global cert
# Assume there is only one service
res = api.Command['service_find'](self.service_princ)['result']
assert base64.b64encode(res[0]['usercertificate'][0]) == cert
@ -210,8 +206,6 @@ class test_cert(XMLRPC_test):
"""
Verify the new certificate with service-show.
"""
global cert, newcert
res = api.Command['service_show'](self.service_princ)['result']
# Both the old and the new certs should be listed as certificates now

View File

@ -46,7 +46,6 @@ disable=
exec-used,
fixme,
global-statement,
global-variable-not-assigned,
no-init,
pointless-string-statement,
protected-access,