Fix hg for python3 (#4528)

* Remove import of unused ConfigParser (ConfigParser has been renamed in py3)
* When retrieving version, normalize to a native string
This commit is contained in:
Toshio Kuratomi 2016-08-24 11:14:45 -07:00 committed by GitHub
parent c8ca1a6211
commit cbd9e07f19

View file

@ -23,8 +23,6 @@
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
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()