Make Rootwrap python3-compatible

cmd.py was still using ConfigParser, changed this to use
six.moves.configparser instead (like in wrapper.py).
This commit is contained in:
Thierry Carrez 2013-11-21 15:09:34 +01:00
parent d2e833795d
commit d7f323271d

View File

@ -34,7 +34,6 @@
from __future__ import print_function
import ConfigParser
import logging
import os
import pwd
@ -42,6 +41,7 @@ import signal
import subprocess
import sys
from six import moves
RC_UNAUTHORIZED = 99
RC_NOCOMMAND = 98
@ -90,13 +90,13 @@ def main():
# Load configuration
try:
rawconfig = ConfigParser.RawConfigParser()
rawconfig = moves.configparser.RawConfigParser()
rawconfig.read(configfile)
config = wrapper.RootwrapConfig(rawconfig)
except ValueError as exc:
msg = "Incorrect value in %s: %s" % (configfile, exc.message)
_exit_error(execname, msg, RC_BADCONFIG, log=False)
except ConfigParser.Error:
except moves.configparser.Error:
_exit_error(execname, "Incorrect configuration file: %s" % configfile,
RC_BADCONFIG, log=False)