1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fix 'hg module fails with: AttributeError: 'AnsibleModule' object has no attribute 'parames''

This commit is contained in:
Mads Weitling 2013-10-10 17:15:04 +02:00
parent c2572b0379
commit 740a33bcab

View file

@ -47,7 +47,7 @@ options:
revision: revision:
description: description:
- Equivalent C(-r) option in hg command which could be the changeset, revision number, - Equivalent C(-r) option in hg command which could be the changeset, revision number,
branch name or even tag. branch name or even tag.
required: false required: false
default: "default" default: "default"
aliases: [ version ] aliases: [ version ]
@ -97,7 +97,7 @@ def _set_hgrc(hgrc, vals):
if not parser.has_section(section): if not parser.has_section(section):
parser.add_section(section) parser.add_section(section)
parser.set(section, option, value) parser.set(section, option, value)
f = open(hgrc, 'w') f = open(hgrc, 'w')
parser.write(f) parser.write(f)
f.close() f.close()
@ -106,7 +106,7 @@ def _set_hgrc(hgrc, vals):
def _undo_hgrc(hgrc, vals): def _undo_hgrc(hgrc, vals):
parser = ConfigParser.SafeConfigParser() parser = ConfigParser.SafeConfigParser()
parser.read(hgrc) parser.read(hgrc)
for each in vals: for each in vals:
(section, option, value) = each (section, option, value) = each
if parser.has_section(section): if parser.has_section(section):
@ -168,17 +168,17 @@ class Hg(object):
after = self.has_local_mods() after = self.has_local_mods()
if before != after and not after: # no more local modification if before != after and not after: # no more local modification
return True return True
def purge(self): def purge(self):
hgrc = os.path.join(self.dest, '.hg/hgrc') hgrc = os.path.join(self.dest, '.hg/hgrc')
purge_option = [('extensions', 'purge', '')] purge_option = [('extensions', 'purge', '')]
_set_hgrc(hgrc, purge_option) # enable purge extension _set_hgrc(hgrc, purge_option) # enable purge extension
# before purge, find out if there are any untracked files # before purge, find out if there are any untracked files
(rc1, out1, err1) = self._list_untracked() (rc1, out1, err1) = self._list_untracked()
if rc1 != 0: if rc1 != 0:
self.module.fail_json(msg=err1) self.module.fail_json(msg=err1)
# there are some untrackd files # there are some untrackd files
if out1 != '': if out1 != '':
(rc2, out2, err2) = self._command(['purge', '-R', self.dest]) (rc2, out2, err2) = self._command(['purge', '-R', self.dest])
@ -234,9 +234,9 @@ def main():
revision = module.params['revision'] revision = module.params['revision']
force = module.params['force'] force = module.params['force']
purge = module.params['purge'] purge = module.params['purge']
hg_path = module.parames['executable'] or module.get_bin_path('hg', True) hg_path = module.params['executable'] or module.get_bin_path('hg', True)
hgrc = os.path.join(dest, '.hg/hgrc') hgrc = os.path.join(dest, '.hg/hgrc')
# initial states # initial states
before = '' before = ''
changed = False changed = False