Merge "Log the traceback in the kolla libraries"

This commit is contained in:
Jenkins 2016-05-31 13:59:32 +00:00 committed by Gerrit Code Review
commit ca6cf5bfd1
6 changed files with 27 additions and 12 deletions

View File

@ -109,6 +109,7 @@ Distribute a to file many host without compression; Change permissions on dest:
import base64 import base64
import hashlib import hashlib
import os import os
import traceback
import zlib import zlib
@ -180,8 +181,9 @@ def main():
copy_to_host(module) copy_to_host(module)
else: else:
copy_from_host(module) copy_from_host(module)
except Exception as e: except Exception:
module.exit_json(failed=True, changed=True, msg=repr(e)) module.exit_json(failed=True, changed=True,
msg=repr(traceback.format_exc()))
# import module snippets # import module snippets

View File

@ -188,6 +188,7 @@ EXAMPLES = '''
''' '''
import os import os
import traceback
import docker import docker
@ -728,8 +729,9 @@ def main():
# meaningful data, we need to refactor all methods to return dicts. # meaningful data, we need to refactor all methods to return dicts.
result = bool(getattr(dw, module.params.get('action'))()) result = bool(getattr(dw, module.params.get('action'))())
module.exit_json(changed=dw.changed, result=result) module.exit_json(changed=dw.changed, result=result)
except Exception as e: except Exception:
module.exit_json(failed=True, changed=True, msg=repr(e)) module.exit_json(failed=True, changed=True,
msg=repr(traceback.format_exc()))
# import module snippets # import module snippets
from ansible.module_utils.basic import * # noqa from ansible.module_utils.basic import * # noqa

View File

@ -22,6 +22,8 @@
# in upstream shade we will be able to use more of the shade module. Until then # in upstream shade we will be able to use more of the shade module. Until then
# if we want to be 'stable' we really need to be using it as a passthrough # if we want to be 'stable' we really need to be using it as a passthrough
import traceback
import shade import shade
@ -74,8 +76,9 @@ def main():
region=endpoint_region) region=endpoint_region)
module.exit_json(changed=changed) module.exit_json(changed=changed)
except Exception as e: except Exception:
module.exit_json(failed=True, changed=True, msg=e) module.exit_json(failed=True, changed=True,
msg=repr(traceback.format_exc()))
# import module snippets # import module snippets
from ansible.module_utils.basic import * # noqa from ansible.module_utils.basic import * # noqa

View File

@ -22,6 +22,8 @@
# in upstream shade we will be able to use more of the shade module. Until then # in upstream shade we will be able to use more of the shade module. Until then
# if we want to be 'stable' we really need to be using it as a passthrough # if we want to be 'stable' we really need to be using it as a passthrough
import traceback
import shade import shade
@ -78,8 +80,9 @@ def main():
project=project) project=project)
module.exit_json(changed=changed) module.exit_json(changed=changed)
except Exception as e: except Exception:
module.exit_json(failed=True, changed=True, msg=e) module.exit_json(failed=True, changed=True,
msg=repr(traceback.format_exc()))
# import module snippets # import module snippets
from ansible.module_utils.basic import * # noqa from ansible.module_utils.basic import * # noqa

View File

@ -22,6 +22,8 @@
# in upstream shade we will be able to use more of the shade module. Until then # in upstream shade we will be able to use more of the shade module. Until then
# if we want to be 'stable' we really need to be using it as a passthrough # if we want to be 'stable' we really need to be using it as a passthrough
import traceback
import shade import shade
@ -61,8 +63,9 @@ def main():
getattr(SanityChecks, module.params.pop("service"))(cloud) getattr(SanityChecks, module.params.pop("service"))(cloud)
module.exit_json(changed=changed) module.exit_json(changed=changed)
except Exception as e: except Exception:
module.exit_json(failed=True, changed=True, msg=e) module.exit_json(failed=True, changed=True,
msg=repr(traceback.format_exc()))
# import module snippets # import module snippets
from ansible.module_utils.basic import * # noqa from ansible.module_utils.basic import * # noqa

View File

@ -15,6 +15,7 @@
# under the License. # under the License.
import contextlib import contextlib
import traceback
import kazoo.client import kazoo.client
import kazoo.exceptions import kazoo.exceptions
@ -56,8 +57,9 @@ def main():
changed = True changed = True
module.exit_json(changed=changed) module.exit_json(changed=changed)
except Exception as e: except Exception:
module.exit_json(failed=True, changed=True, msg=e) module.exit_json(failed=True, changed=True,
msg=repr(traceback.format_exc()))
# import module snippets # import module snippets