Fix various sonarcloud issues

This fixes various reported bugs through sonarcloud at:
https://sonarcloud.io/project/issues?id=Rodney-Reis_ansible&resolved=false&types=BUG
This commit is contained in:
Dag Wieers 2019-02-05 01:44:45 +01:00 committed by Matt Clay
parent f9ab9b4d68
commit c2fb581414
12 changed files with 15 additions and 70 deletions

View file

@ -1,20 +1,7 @@
#!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
#
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
@ -406,7 +393,6 @@ class StaticRoute(object):
if self.prefix.find('.') == -1:
return False
if self.mask == '32':
self.prefix = self.prefix
return True
if self.mask == '0':
self.prefix = '0.0.0.0'
@ -427,7 +413,6 @@ class StaticRoute(object):
if self.prefix.find(':') == -1:
return False
if self.mask == '128':
self.prefix = self.prefix
return True
if self.mask == '0':
self.prefix = '::'

View file

@ -361,8 +361,6 @@ def bgpNeighborConfig(module, cmd, prompt, answer):
command = command + bgpNeighborArg1 + " "
if(bgpNeighborArg2 is not None and bgpNeighborArg2 == "mutihop"):
command = command + bgpNeighborArg2
else:
command = command
elif(bgpNeighborArg1 == "connection-retry-time"):
command = command + bgpNeighborArg1 + " "
@ -565,8 +563,6 @@ def bgpNeighborAFConfig(module, cmd, prompt, answer):
else:
retVal = "Error-325"
return retVal
else:
command = command
elif(bgpNeighborAFArg1 == "default-originate"):
command = command + bgpNeighborAFArg1 + " "
@ -643,8 +639,6 @@ def bgpNeighborAFConfig(module, cmd, prompt, answer):
command = command + bgpNeighborAFArg1 + " "
if(bgpNeighborAFArg2 is not None and bgpNeighborAFArg2 == "extended"):
command = command + bgpNeighborAFArg2
else:
command = command
elif(bgpNeighborAFArg1 == "soft-reconfiguration"):
command = command + bgpNeighborAFArg1 + " inbound"