Pep8 fixes for taiga_issue module (#24143)

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
Abhijeet Kasurde 2017-05-01 20:28:59 +05:30 committed by Matt Martz
parent bb8666471d
commit 806506c032
2 changed files with 13 additions and 8 deletions

View file

@ -131,9 +131,10 @@ from os.path import isfile
try:
from taiga import TaigaAPI
from taiga.exceptions import TaigaException
TAIGA_MODULE_IMPORTED=True
TAIGA_MODULE_IMPORTED = True
except ImportError:
TAIGA_MODULE_IMPORTED=False
TAIGA_MODULE_IMPORTED = False
def manage_issue(module, taiga_host, project_name, issue_subject, issue_priority,
issue_status, issue_type, issue_severity, issue_description,
@ -202,7 +203,7 @@ def manage_issue(module, taiga_host, project_name, issue_subject, issue_priority
"severity": issue_severity,
"description": issue_description,
"tags": issue_tags,
}
}
# An issue is identified by the project_name, the issue_subject and the issue_type
matching_issue_list = filter(lambda x: x.subject == issue_subject and x.type == type_id, project.list_issues())
@ -245,9 +246,11 @@ def manage_issue(module, taiga_host, project_name, issue_subject, issue_priority
return (False, changed, "More than one issue with subject %s in project %s" % (issue_subject, project_name), {})
except TaigaException:
msg = "An exception happened: %s" % sys.exc_info()[1]
exc = get_exception()
msg = "An exception happened: %s" % exc
return (False, changed, msg, {})
def main():
module = AnsibleModule(
argument_spec=dict(
@ -262,7 +265,8 @@ def main():
attachment=dict(required=False, default=None),
attachment_description=dict(required=False, default=""),
tags=dict(required=False, default=[], type='list'),
state=dict(required=False, choices=['present','absent'], default='present'),
state=dict(required=False, choices=['present', 'absent'],
default='present'),
),
supports_check_mode=True
)
@ -303,7 +307,7 @@ def main():
issue_tags,
state,
check_mode=module.check_mode
)
)
if return_status:
if len(issue_attr_dict) > 0:
module.exit_json(changed=changed, msg=msg, issue=issue_attr_dict)
@ -313,6 +317,8 @@ def main():
module.fail_json(msg=msg)
from ansible.module_utils.basic import *
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.pycompat24 import get_exception
if __name__ == '__main__':
main()

View file

@ -785,7 +785,6 @@ 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/web_infrastructure/taiga_issue.py
lib/ansible/modules/windows/win_disk_image.py
lib/ansible/modules/windows/win_dns_client.py
lib/ansible/modules/windows/win_domain.py