Skip to content

Commit

Permalink
Use the configparser type helpers
Browse files Browse the repository at this point in the history
Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
  • Loading branch information
stgraber committed Jul 10, 2014
1 parent 52d7799 commit dc2459c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/lxccmd/lxccmd/config.py
Expand Up @@ -41,6 +41,13 @@ def config_get(section, key, default=None, answer_type=str):
if not config.has_option(section, key):
return default

if answer_type == bool:
return config.getboolean(section, key)
elif answer_type == int:
return config.getint(section, key)
elif answer_type == float:
return config.getfloat(section, key)

value = config.get(section, key)
if answer_type == list:
return value.split(", ")
Expand Down

0 comments on commit dc2459c

Please sign in to comment.