Commit fc076088 authored by Antoine Catton's avatar Antoine Catton

Revert "Replace OrderedDict by simple dict"

This reverts commit f29dae997ac26e5fcbd2eb037ed42028e54f2a6d.

This is usefull to control the order of how lxc.conf will
be written (especially for lxc.network.* values)
parent 8a3adf90
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import collections
import StringIO import StringIO
class LXCConfig(object): class LXCConfig(object):
...@@ -38,7 +39,7 @@ class LXCConfig(object): ...@@ -38,7 +39,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 = dict() self._values = collections.OrderedDict()
def __getattr__(self, name): def __getattr__(self, name):
return self._get(name) return self._get(name)
...@@ -50,7 +51,7 @@ class LXCConfig(object): ...@@ -50,7 +51,7 @@ class LXCConfig(object):
self._set(name, value) self._set(name, value)
def _load(self, config_string): def _load(self, config_string):
result = dict() result = collections.OrderedDict()
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:
......
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