Making yum_repository module compatible with Python 3 (#3487)

This commit is contained in:
Jiri Tyr 2016-11-18 14:38:04 +00:00 committed by Matt Clay
parent 36f1ecc5be
commit c7ae273f13

View file

@ -19,10 +19,10 @@
# along with Ansible. If not, see <http://www.gnu.org/licenses/>. # along with Ansible. If not, see <http://www.gnu.org/licenses/>.
import ConfigParser
import os import os
from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.pycompat24 import get_exception from ansible.module_utils.pycompat24 import get_exception
from ansible.module_utils.six.moves import configparser
DOCUMENTATION = ''' DOCUMENTATION = '''
@ -469,7 +469,7 @@ class YumRepo(object):
module = None module = None
params = None params = None
section = None section = None
repofile = ConfigParser.RawConfigParser() repofile = configparser.RawConfigParser()
# List of parameters which will be allowed in the repo file output # List of parameters which will be allowed in the repo file output
allowed_params = [ allowed_params = [
@ -576,7 +576,7 @@ class YumRepo(object):
if len(self.repofile.sections()): if len(self.repofile.sections()):
# Write data into the file # Write data into the file
try: try:
fd = open(self.params['dest'], 'wb') fd = open(self.params['dest'], 'w')
except IOError: except IOError:
e = get_exception() e = get_exception()
self.module.fail_json( self.module.fail_json(