Miscellaneous pylint fixes.

The following rules are no longer disabled:

- bad-format-string
- duplicate-key
- lost-exception
- trailing-newlines
- unexpected-keyword-arg
- useless-suppression
- using-constant-test
This commit is contained in:
Matt Clay
2017-09-12 18:49:24 -07:00
parent 77b2aca5a2
commit 442af3744e
35 changed files with 17 additions and 43 deletions

View File

@@ -109,6 +109,7 @@ class ConfigCLI(CLI):
'''
raise AnsibleError("Option not implemented yet")
# pylint: disable=unreachable
if self.options.setting is None:
raise AnsibleOptionsError("update option requries a setting to update")
@@ -141,6 +142,8 @@ class ConfigCLI(CLI):
Opens ansible.cfg in the default EDITOR
'''
raise AnsibleError("Option not implemented yet")
# pylint: disable=unreachable
try:
editor = shlex.split(os.environ.get('EDITOR','vi'))
editor.append(self.config_file)

View File

@@ -643,7 +643,6 @@ class GalaxyCLI(CLI):
if len(self.args) < 4:
raise AnsibleError("Missing one or more arguments. Expecting: source github_user github_repo secret")
return 0
secret = self.args.pop()
github_repo = self.args.pop()

View File

@@ -42,4 +42,3 @@ class ConfigData(object):
if plugin.name not in self._plugins[plugin.type]:
self._plugins[plugin.type][plugin.name] = {}
self._plugins[plugin.type][plugin.name][setting.name] = setting

View File

@@ -147,11 +147,6 @@ class Rhsm(RegistrationBase):
* Boolean - whether the current system is currently registered to
RHN.
'''
# Quick version...
if False:
return os.path.isfile('/etc/pki/consumer/cert.pem') and \
os.path.isfile('/etc/pki/consumer/key.pem')
args = ['subscription-manager', 'identity']
rc, stdout, stderr = self.module.run_command(args, check_rc=False)
if rc == 0:

View File

@@ -293,4 +293,3 @@ def main():
if __name__ == '__main__':
main()

View File

@@ -218,7 +218,7 @@ def main():
module.fail_json(msg="server {server} already has a "
"floating-ip on requested "
"interface but it doesn't match "
"requested network {network: {fip}"
"requested network {network}: {fip}"
.format(server=server_name_or_id,
network=network,
fip=remove_values(f_ip,

View File

@@ -167,4 +167,3 @@ from ansible.module_utils.basic import *
from ansible.module_utils.openstack import *
if __name__ == '__main__':
main()

View File

@@ -199,4 +199,3 @@ def main():
if __name__ == '__main__':
main()

View File

@@ -181,4 +181,3 @@ def main():
if __name__ == '__main__':
main()

View File

@@ -381,4 +381,3 @@ def main():
if __name__ == '__main__':
main()

View File

@@ -365,4 +365,3 @@ def main():
if __name__ == '__main__':
main()

View File

@@ -318,4 +318,3 @@ def main():
if __name__ == '__main__':
main()

View File

@@ -225,4 +225,3 @@ def main():
if __name__ == '__main__':
main()

View File

@@ -294,4 +294,3 @@ def main():
if __name__ == '__main__':
main()

View File

@@ -325,4 +325,3 @@ def main():
if __name__ == '__main__':
main()

View File

@@ -248,4 +248,3 @@ def main():
if __name__ == '__main__':
main()

View File

@@ -152,4 +152,3 @@ def main():
if __name__ == '__main__':
main()

View File

@@ -432,4 +432,3 @@ def main():
if __name__ == "__main__":
main()

View File

@@ -289,4 +289,3 @@ def main():
if __name__ == '__main__':
main()

View File

@@ -351,4 +351,3 @@ def main():
if __name__ == "__main__":
main()

View File

@@ -295,4 +295,3 @@ def main():
if __name__ == '__main__':
main()

View File

@@ -308,4 +308,3 @@ def main():
if __name__ == '__main__':
main()

View File

@@ -270,4 +270,3 @@ def main():
if __name__ == '__main__':
main()

View File

@@ -329,4 +329,3 @@ def main():
if __name__ == '__main__':
main()

View File

@@ -532,7 +532,7 @@ class ActionBase(with_metaclass(ABCMeta, object)):
elif 'json' in errormsg or 'simplejson' in errormsg:
x = "5" # json or simplejson modules needed
finally:
return x
return x # pylint: disable=lost-exception
def _remote_expand_user(self, path, sudoable=True):
''' takes a remote path and performs tilde expansion on the remote host '''

View File

@@ -60,7 +60,7 @@ class Cliconf(CliconfBase):
cmd = b'show configuration'
else:
cmd = b'show configuration | display %s' % format
return self.send_command(to_bytes(cmd), errors='surrogate_or_strict')
return self.send_command(to_bytes(cmd, errors='surrogate_or_strict'))
def edit_config(self, command):
for cmd in chain([b'configure'], to_list(command)):

View File

@@ -589,6 +589,7 @@ class Connection(ConnectionBase):
# Make sure stdin is a proper pty to avoid tcgetattr errors
master, slave = pty.openpty()
if PY3 and self._play_context.password:
# pylint: disable=unexpected-keyword-arg
p = subprocess.Popen(cmd, stdin=slave, stdout=subprocess.PIPE, stderr=subprocess.PIPE, pass_fds=self.sshpass_pipe)
else:
p = subprocess.Popen(cmd, stdin=slave, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
@@ -599,6 +600,7 @@ class Connection(ConnectionBase):
if not p:
if PY3 and self._play_context.password:
# pylint: disable=unexpected-keyword-arg
p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, pass_fds=self.sshpass_pipe)
else:
p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

View File

@@ -139,7 +139,6 @@ class Etcd:
value = "ENOENT"
except:
raise
pass
return value