Assorted pylint fixes

This commit is contained in:
Dag Wieers 2019-02-14 21:02:27 +01:00 committed by Matt Clay
commit f9ab9b4d68
65 changed files with 343 additions and 473 deletions

View file

@ -1,7 +1,7 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Ansible by Red Hat, inc
# Copyright: (c) 2017, Ansible by Red Hat, inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
@ -111,7 +111,7 @@ class ConfigBase(object):
def map_params_to_obj(self):
text = self._module.params['text']
if text:
text = "{!r}".format(str(text).strip())
text = "{0!r}".format(str(text).strip())
self._want.update({
'banner': self._module.params['banner'],
'text': text,
@ -128,11 +128,11 @@ class CliConfiguration(ConfigBase):
state = self._module.params['state']
if state == 'absent':
if self._have.get('state') != 'absent' and ('text' in self._have.keys() and self._have['text']):
commands.append('no banner {!s}'.format(self._module.params['banner']))
commands.append('no banner {0!s}'.format(self._module.params['banner']))
elif state == 'present':
if (self._want['text'] and
self._want['text'].encode().decode('unicode_escape').strip("'") != self._have.get('text')):
banner_cmd = 'banner {!s} '.format(self._module.params['banner'])
banner_cmd = 'banner {0!s} '.format(self._module.params['banner'])
banner_cmd += self._want['text'].strip()
commands.append(banner_cmd)
self._result['commands'] = commands
@ -144,7 +144,7 @@ class CliConfiguration(ConfigBase):
self._result['changed'] = True
def map_config_to_obj(self):
cli_filter = 'banner {!s}'.format(self._module.params['banner'])
cli_filter = 'banner {0!s}'.format(self._module.params['banner'])
output = get_config(self._module, config_filter=cli_filter)
match = re.search(r'banner (\S+) (.*)', output, re.DOTALL)
if match: