From 31b34906d0396590631e1792ea9e638057f411e9 Mon Sep 17 00:00:00 2001 From: Nico Cesar Date: Tue, 5 Aug 2014 10:56:20 -0400 Subject: [PATCH] if python >=2.7 use the option allow_no_value=True for ini_file. --- files/ini_file | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/files/ini_file b/files/ini_file index 29abe510657..83a980f5ba8 100644 --- a/files/ini_file +++ b/files/ini_file @@ -87,6 +87,7 @@ EXAMPLES = ''' ''' import ConfigParser +import sys # ============================================================== # do_ini @@ -94,7 +95,10 @@ import ConfigParser def do_ini(module, filename, section=None, option=None, value=None, state='present', backup=False): changed = False - cp = ConfigParser.ConfigParser() + if (sys.version_info[0] == 2 and sys.version_info[1] >= 7) or sys.version_info[0] >= 3: + cp = ConfigParser.ConfigParser(allow_no_value=True) + else: + cp = ConfigParser.ConfigParser() cp.optionxform = identity try: