sanity: remove ansible-bad-function (#70431)

* Updated docs and ignore.txt
* Replaced with correct function calls

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
pull/70503/head
Abhijeet Kasurde 4 years ago committed by GitHub
parent 535fde3c0f
commit f5037314e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -136,7 +136,7 @@ class DistributionFiles:
parsed, dist_file_dict = distfunc(name, dist_file_content, path, collected_facts) parsed, dist_file_dict = distfunc(name, dist_file_content, path, collected_facts)
return parsed, dist_file_dict return parsed, dist_file_dict
except AttributeError as exc: except AttributeError as exc:
print('exc: %s' % exc) self.module.debug('exc: %s' % exc)
# this should never happen, but if it does fail quietly and not with a traceback # this should never happen, but if it does fail quietly and not with a traceback
return False, dist_file_dict return False, dist_file_dict

@ -237,7 +237,7 @@ class AnsibleModuleError(Exception):
self.results = results self.results = results
def __repr__(self): def __repr__(self):
print('AnsibleModuleError(results={0})'.format(self.results)) return 'AnsibleModuleError(results={0})'.format(self.results)
class ParameterError(AnsibleModuleError): class ParameterError(AnsibleModuleError):

@ -51,7 +51,6 @@ lib/ansible/module_utils/distro/_distro.py no-assert
lib/ansible/module_utils/distro/_distro.py pep8!skip # bundled code we don't want to modify lib/ansible/module_utils/distro/_distro.py pep8!skip # bundled code we don't want to modify
lib/ansible/module_utils/facts/__init__.py empty-init # breaks namespacing, deprecate and eventually remove lib/ansible/module_utils/facts/__init__.py empty-init # breaks namespacing, deprecate and eventually remove
lib/ansible/module_utils/facts/network/linux.py pylint:blacklisted-name lib/ansible/module_utils/facts/network/linux.py pylint:blacklisted-name
lib/ansible/module_utils/facts/system/distribution.py pylint:ansible-bad-function
lib/ansible/module_utils/powershell/Ansible.ModuleUtils.ArgvParser.psm1 pslint:PSUseApprovedVerbs lib/ansible/module_utils/powershell/Ansible.ModuleUtils.ArgvParser.psm1 pslint:PSUseApprovedVerbs
lib/ansible/module_utils/powershell/Ansible.ModuleUtils.CommandUtil.psm1 pslint:PSProvideCommentHelp # need to agree on best format for comment location lib/ansible/module_utils/powershell/Ansible.ModuleUtils.CommandUtil.psm1 pslint:PSProvideCommentHelp # need to agree on best format for comment location
lib/ansible/module_utils/powershell/Ansible.ModuleUtils.CommandUtil.psm1 pslint:PSUseApprovedVerbs lib/ansible/module_utils/powershell/Ansible.ModuleUtils.CommandUtil.psm1 pslint:PSUseApprovedVerbs
@ -84,7 +83,6 @@ lib/ansible/modules/copy.py validate-modules:doc-default-does-not-match-spec
lib/ansible/modules/copy.py validate-modules:doc-type-does-not-match-spec lib/ansible/modules/copy.py validate-modules:doc-type-does-not-match-spec
lib/ansible/modules/copy.py validate-modules:nonexistent-parameter-documented lib/ansible/modules/copy.py validate-modules:nonexistent-parameter-documented
lib/ansible/modules/copy.py validate-modules:undocumented-parameter lib/ansible/modules/copy.py validate-modules:undocumented-parameter
lib/ansible/modules/file.py pylint:ansible-bad-function
lib/ansible/modules/file.py validate-modules:doc-default-does-not-match-spec lib/ansible/modules/file.py validate-modules:doc-default-does-not-match-spec
lib/ansible/modules/file.py validate-modules:undocumented-parameter lib/ansible/modules/file.py validate-modules:undocumented-parameter
lib/ansible/modules/find.py use-argspec-type-path # fix needed lib/ansible/modules/find.py use-argspec-type-path # fix needed
@ -169,7 +167,7 @@ lib/ansible/modules/user.py validate-modules:use-run-command-not-popen
lib/ansible/modules/async_status.py use-argspec-type-path lib/ansible/modules/async_status.py use-argspec-type-path
lib/ansible/modules/async_status.py validate-modules!skip lib/ansible/modules/async_status.py validate-modules!skip
lib/ansible/modules/async_wrapper.py ansible-doc!skip # not an actual module lib/ansible/modules/async_wrapper.py ansible-doc!skip # not an actual module
lib/ansible/modules/async_wrapper.py pylint:ansible-bad-function lib/ansible/modules/async_wrapper.py pylint:ansible-bad-function # ignore, required
lib/ansible/modules/async_wrapper.py use-argspec-type-path lib/ansible/modules/async_wrapper.py use-argspec-type-path
lib/ansible/modules/wait_for.py validate-modules:parameter-list-no-elements lib/ansible/modules/wait_for.py validate-modules:parameter-list-no-elements
lib/ansible/parsing/vault/__init__.py pylint:blacklisted-name lib/ansible/parsing/vault/__init__.py pylint:blacklisted-name
@ -183,9 +181,9 @@ lib/ansible/plugins/lookup/sequence.py pylint:blacklisted-name
lib/ansible/plugins/strategy/__init__.py pylint:blacklisted-name lib/ansible/plugins/strategy/__init__.py pylint:blacklisted-name
lib/ansible/plugins/strategy/linear.py pylint:blacklisted-name lib/ansible/plugins/strategy/linear.py pylint:blacklisted-name
lib/ansible/vars/hostvars.py pylint:blacklisted-name lib/ansible/vars/hostvars.py pylint:blacklisted-name
test/integration/targets/ansible-test/ansible_collections/ns/col/tests/integration/targets/hello/files/bad.py pylint:ansible-bad-import test/integration/targets/ansible-test/ansible_collections/ns/col/tests/integration/targets/hello/files/bad.py pylint:ansible-bad-import # ignore, required for testing
test/integration/targets/ansible-test/ansible_collections/ns/col/tests/integration/targets/hello/files/bad.py pylint:ansible-bad-import-from test/integration/targets/ansible-test/ansible_collections/ns/col/tests/integration/targets/hello/files/bad.py pylint:ansible-bad-import-from # ignore, required for testing
test/integration/targets/ansible-test/ansible_collections/ns/col/tests/integration/targets/hello/files/bad.py pylint:ansible-bad-function test/integration/targets/ansible-test/ansible_collections/ns/col/tests/integration/targets/hello/files/bad.py pylint:ansible-bad-function # ignore, required for testing
test/integration/targets/ansible-test/ansible_collections/ns/col/plugins/modules/hello.py pylint:relative-beyond-top-level test/integration/targets/ansible-test/ansible_collections/ns/col/plugins/modules/hello.py pylint:relative-beyond-top-level
test/integration/targets/ansible-test/ansible_collections/ns/col/tests/unit/plugins/module_utils/test_my_util.py pylint:relative-beyond-top-level test/integration/targets/ansible-test/ansible_collections/ns/col/tests/unit/plugins/module_utils/test_my_util.py pylint:relative-beyond-top-level
test/integration/targets/ansible-test/ansible_collections/ns/col/tests/unit/plugins/modules/test_hello.py pylint:relative-beyond-top-level test/integration/targets/ansible-test/ansible_collections/ns/col/tests/unit/plugins/modules/test_hello.py pylint:relative-beyond-top-level
@ -335,7 +333,6 @@ test/units/module_utils/urls/fixtures/multipart.txt line-endings # Fixture for
test/units/module_utils/urls/test_Request.py replace-urlopen test/units/module_utils/urls/test_Request.py replace-urlopen
test/units/module_utils/urls/test_fetch_url.py replace-urlopen test/units/module_utils/urls/test_fetch_url.py replace-urlopen
test/units/modules/test_apt.py pylint:blacklisted-name test/units/modules/test_apt.py pylint:blacklisted-name
test/units/modules/test_known_hosts.py pylint:ansible-bad-function
test/units/parsing/vault/test_vault.py pylint:blacklisted-name test/units/parsing/vault/test_vault.py pylint:blacklisted-name
test/units/playbook/role/test_role.py pylint:blacklisted-name test/units/playbook/role/test_role.py pylint:blacklisted-name
test/units/plugins/test_plugins.py pylint:blacklisted-name test/units/plugins/test_plugins.py pylint:blacklisted-name

@ -22,7 +22,7 @@ class KnownHostsDiffTestCase(unittest.TestCase):
return tmp_file.name return tmp_file.name
def test_no_existing_file(self): def test_no_existing_file(self):
path = tempfile.mktemp(prefix='ansible-test-', suffix='-known_hosts') path = "/tmp/this_file_does_not_exists_known_hosts"
key = 'example.com ssh-rsa AAAAetc\n' key = 'example.com ssh-rsa AAAAetc\n'
diff = compute_diff(path, found_line=None, replace_or_add=False, state='present', key=key) diff = compute_diff(path, found_line=None, replace_or_add=False, state='present', key=key)
self.assertEqual(diff, { self.assertEqual(diff, {

Loading…
Cancel
Save