Commit fff3f953 authored by Antoine Catton's avatar Antoine Catton

Replace OrderedDict by simple dict

Mybad, OrderedDict is not needed, moreover it reduces
performances.
parent 68ef8900
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import collections
import StringIO import StringIO
class LXCConfig(object): class LXCConfig(object):
...@@ -39,7 +38,7 @@ class LXCConfig(object): ...@@ -39,7 +38,7 @@ class LXCConfig(object):
with open(filename, 'r') as lxcconf_file: with open(filename, 'r') as lxcconf_file:
self._values = self._load(lxcconf_file.read()) self._values = self._load(lxcconf_file.read())
else: else:
self._values = collections.OrderedDict() self._values = dict()
def __getattr__(self, name): def __getattr__(self, name):
return self._get(name) return self._get(name)
...@@ -51,7 +50,7 @@ class LXCConfig(object): ...@@ -51,7 +50,7 @@ class LXCConfig(object):
self._set(name, value) self._set(name, value)
def _load(self, config_string): def _load(self, config_string):
result = collections.OrderedDict() result = dict()
for line in config_string.split('\n'): for line in config_string.split('\n'):
if not line.strip().startswith('#') and line.strip() != '': if not line.strip().startswith('#') and line.strip() != '':
if '=' not in line: if '=' not in line:
......
...@@ -49,7 +49,6 @@ def main(sr_directory, partition_list): ...@@ -49,7 +49,6 @@ def main(sr_directory, partition_list):
def start(sr_directory, partition_path): def start(sr_directory, partition_path):
return
lxc_start = os.path.join(sr_directory, lxc_start = os.path.join(sr_directory,
'parts/lxc/bin/lxc-start') 'parts/lxc/bin/lxc-start')
config_filename = os.path.join(partition_path, 'config') config_filename = os.path.join(partition_path, 'config')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment