Pep8 fixes for jenkins_* module (#24154)

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
Abhijeet Kasurde 2017-05-01 20:31:25 +05:30 committed by Matt Martz
parent d088030fa6
commit cdca648f15
3 changed files with 32 additions and 29 deletions

View file

@ -163,7 +163,9 @@ try:
except ImportError:
python_lxml_installed = False
class JenkinsJob:
def __init__(self, module):
self.module = module
@ -328,18 +330,21 @@ class JenkinsJob:
result['enabled'] = None
return result
def test_dependencies(module):
if not python_jenkins_installed:
module.fail_json(msg="python-jenkins required for this module. "\
module.fail_json(msg="python-jenkins required for this module. "
"see http://python-jenkins.readthedocs.io/en/latest/install.html")
if not python_lxml_installed:
module.fail_json(msg="lxml required for this module. "\
module.fail_json(msg="lxml required for this module. "
"see http://lxml.de/installation.html")
def job_config_to_string(xml_str):
return ET.tostring(ET.fromstring(xml_str))
def main():
module = AnsibleModule(
argument_spec=dict(

View file

@ -127,6 +127,7 @@ except ImportError:
# python3
from urllib.parse import urlencode
def is_csrf_protection_enabled(module):
resp, info = fetch_url(module,
module.params['url'] + '/api/json',
@ -137,6 +138,7 @@ def is_csrf_protection_enabled(module):
content = resp.read()
return json.loads(content).get('useCrumbs', False)
def get_crumb(module):
resp, info = fetch_url(module,
module.params['url'] + '/crumbIssuer/api/json',
@ -147,6 +149,7 @@ def get_crumb(module):
content = resp.read()
return json.loads(content)
def main():
module = AnsibleModule(
@ -160,7 +163,6 @@ def main():
)
)
if module.params['user'] is not None:
if module.params['password'] is None:
module.fail_json(msg="password required when user provided")
@ -168,7 +170,6 @@ def main():
module.params['url_password'] = module.params['password']
module.params['force_basic_auth'] = True
if module.params['args'] is not None:
from string import Template
script_contents = Template(module.params['script']).substitute(module.params['args'])
@ -199,6 +200,5 @@ def main():
)
if __name__ == '__main__':
main()

View file

@ -781,8 +781,6 @@ lib/ansible/modules/web_infrastructure/django_manage.py
lib/ansible/modules/web_infrastructure/ejabberd_user.py
lib/ansible/modules/web_infrastructure/htpasswd.py
lib/ansible/modules/web_infrastructure/jboss.py
lib/ansible/modules/web_infrastructure/jenkins_job.py
lib/ansible/modules/web_infrastructure/jenkins_script.py
lib/ansible/modules/web_infrastructure/jira.py
lib/ansible/modules/web_infrastructure/letsencrypt.py
lib/ansible/modules/windows/win_disk_image.py