diff --git a/lib/ansible/modules/source_control/hg.py b/lib/ansible/modules/source_control/hg.py index 827a12d7765..5f279e1a9ed 100644 --- a/lib/ansible/modules/source_control/hg.py +++ b/lib/ansible/modules/source_control/hg.py @@ -23,8 +23,6 @@ # You should have received a copy of the GNU General Public License # along with Ansible. If not, see . -import ConfigParser - DOCUMENTATION = ''' --- module: hg @@ -92,6 +90,12 @@ EXAMPLES = ''' - hg: repo=https://bitbucket.org/user/repo1 dest=/home/user/repo1 revision=stable purge=yes ''' +import os + +# import module snippets +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils._text import to_native + class Hg(object): def __init__(self, module, dest, repo, revision, hg_path): @@ -123,7 +127,7 @@ class Hg(object): if rc != 0: self.module.fail_json(msg=err) else: - return out.strip('\n') + return to_native(out).strip('\n') def has_local_mods(self): now = self.get_revision() @@ -270,6 +274,5 @@ def main(): changed = True module.exit_json(before=before, after=after, changed=changed, cleaned=cleaned) -# import module snippets -from ansible.module_utils.basic import * -main() +if __name__ == '__main__': + main()