mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 22:02:50 +00:00
Assorted pylint fixes
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# (c) 2017, Ted Elhourani <ted@bigswitch.com>
|
||||
# Copyright: (c) 2017, Ted Elhourani <ted@bigswitch.com>
|
||||
# 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
|
||||
@@ -101,7 +101,7 @@ def switch(module, check_mode):
|
||||
|
||||
response = rest.get('switch-config', data={})
|
||||
if response.status_code != 200:
|
||||
module.fail_json(msg="failed to obtain existing switch config: {}".format(response.json['description']))
|
||||
module.fail_json(msg="failed to obtain existing switch config: {0}".format(response.json['description']))
|
||||
|
||||
config_present = False
|
||||
for switch in response.json:
|
||||
@@ -127,14 +127,14 @@ def switch(module, check_mode):
|
||||
if response.status_code == 204:
|
||||
module.exit_json(changed=True)
|
||||
else:
|
||||
module.fail_json(msg="error configuring switch '{}': {}".format(name, response.json['description']))
|
||||
module.fail_json(msg="error configuring switch '{0}': {1}".format(name, response.json['description']))
|
||||
|
||||
if state in ('absent'):
|
||||
response = rest.delete('switch-config[name="%s"]' % name, data={})
|
||||
if response.status_code == 204:
|
||||
module.exit_json(changed=True)
|
||||
else:
|
||||
module.fail_json(msg="error deleting switch '{}': {}".format(name, response.json['description']))
|
||||
module.fail_json(msg="error deleting switch '{0}': {1}".format(name, response.json['description']))
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Ansible module to manage Big Monitoring Fabric service chains
|
||||
# (c) 2016, Ted Elhourani <ted@bigswitch.com>
|
||||
# Copyright: (c) 2016, Ted Elhourani <ted@bigswitch.com>
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
# Ansible module to manage Big Monitoring Fabric service chains
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
@@ -88,7 +89,7 @@ def chain(module):
|
||||
|
||||
response = rest.get('chain?config=true', data={})
|
||||
if response.status_code != 200:
|
||||
module.fail_json(msg="failed to obtain existing chain config: {}".format(response.json['description']))
|
||||
module.fail_json(msg="failed to obtain existing chain config: {0}".format(response.json['description']))
|
||||
|
||||
config_present = False
|
||||
matching = [chain for chain in response.json if chain['name'] == name]
|
||||
@@ -106,14 +107,14 @@ def chain(module):
|
||||
if response.status_code == 204:
|
||||
module.exit_json(changed=True)
|
||||
else:
|
||||
module.fail_json(msg="error creating chain '{}': {}".format(name, response.json['description']))
|
||||
module.fail_json(msg="error creating chain '{0}': {1}".format(name, response.json['description']))
|
||||
|
||||
if state in ('absent'):
|
||||
response = rest.delete('chain[name="%s"]' % name, data={})
|
||||
if response.status_code == 204:
|
||||
module.exit_json(changed=True)
|
||||
else:
|
||||
module.fail_json(msg="error deleting chain '{}': {}".format(name, response.json['description']))
|
||||
module.fail_json(msg="error deleting chain '{0}': {1}".format(name, response.json['description']))
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Ansible module to manage Big Monitoring Fabric service chains
|
||||
# (c) 2016, Ted Elhourani <ted@bigswitch.com>
|
||||
# Copyright: (c) 2016, Ted Elhourani <ted@bigswitch.com>
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
# Ansible module to manage Big Monitoring Fabric service chains
|
||||
|
||||
from __future__ import absolute_import, division, print_function
|
||||
__metaclass__ = type
|
||||
|
||||
@@ -121,7 +122,7 @@ def policy(module):
|
||||
|
||||
response = rest.get('policy?config=true', data={})
|
||||
if response.status_code != 200:
|
||||
module.fail_json(msg="failed to obtain existing policy config: {}".format(response.json['description']))
|
||||
module.fail_json(msg="failed to obtain existing policy config: {0}".format(response.json['description']))
|
||||
|
||||
config_present = False
|
||||
|
||||
@@ -151,14 +152,14 @@ def policy(module):
|
||||
if response.status_code == 204:
|
||||
module.exit_json(changed=True)
|
||||
else:
|
||||
module.fail_json(msg="error creating policy '{}': {}".format(name, response.json['description']))
|
||||
module.fail_json(msg="error creating policy '{0}': {1}".format(name, response.json['description']))
|
||||
|
||||
if state in ('absent'):
|
||||
response = rest.delete('policy[name="%s"]' % name, data={})
|
||||
if response.status_code == 204:
|
||||
module.exit_json(changed=True)
|
||||
else:
|
||||
module.fail_json(msg="error deleting policy '{}': {}".format(name, response.json['description']))
|
||||
module.fail_json(msg="error deleting policy '{0}': {1}".format(name, response.json['description']))
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
Reference in New Issue
Block a user