Revision f724cd35 kamaki/cli/config.py

b/kamaki/cli/config.py
108 108
            for option, val in options.items():
109 109
                self.set(section, option, val)
110 110

  
111
    def _get_dict(self, section, include_defaults=True):
112
        try:
113
            d = dict(DEFAULTS[section]) if include_defaults else {}
114
        except KeyError:
115
            d = {}
116
        try:
117
            d.update(RawConfigParser.items(self, section))
118
        except NoSectionError:
119
            pass
120
        return d
121

  
111 122
    def reload(self):
112 123
        self = self.__init__(self.path)
113 124

  
114
    def apis(self):
115
        return [api for api in self.sections() if api != 'global']
116

  
117 125
    def get(self, section, option):
118 126
        value = self._overrides.get(section, {}).get(option)
119 127
        if value is not None:
......
137 145
        except NoSectionError:
138 146
            pass
139 147

  
148
    def keys(self, section, include_defaults=True):
149
        d = self._get_dict(section, include_defaults)
150
        return d.keys()
151

  
140 152
    def items(self, section, include_defaults=True):
141
        try:
142
            d = dict(DEFAULTS[section]) if include_defaults else {}
143
        except KeyError:
144
            d = {}
145
        try:
146
            d.update(RawConfigParser.items(self, section))
147
        except NoSectionError:
148
            pass
153
        d = self._get_dict(section, include_defaults)
149 154
        return d.items()
150 155

  
151 156
    def override(self, section, option, value):

Also available in: Unified diff