Revision c825ddc9 kamaki/cli/config.py
b/kamaki/cli/config.py | ||
---|---|---|
61 | 61 |
if c not in '0.123456789': |
62 | 62 |
break |
63 | 63 |
version += c |
64 |
HEADER = '# Kamaki configuration file v%s' % version |
|
64 |
HEADER = '# Kamaki configuration file v%s\n' % version
|
|
65 | 65 |
|
66 | 66 |
DEFAULTS = { |
67 | 67 |
'global': { |
... | ... | |
156 | 156 |
self.remove_option(s, term) |
157 | 157 |
continue |
158 | 158 |
gval = self.get(s, term) |
159 |
cval = self.get_cloud('default', term) |
|
159 |
try: |
|
160 |
cval = self.get_cloud('default', term) |
|
161 |
except KeyError: |
|
162 |
cval = '' |
|
160 | 163 |
if gval and cval and ( |
161 | 164 |
gval.lower().strip('/') != cval.lower().strip('/')): |
162 | 165 |
raise CLISyntaxError( |
... | ... | |
225 | 228 |
if 'global' in sections: |
226 | 229 |
if checker.get('global', 'url') or checker.get('global', 'token'): |
227 | 230 |
log.warning('..... config file has an old global section') |
228 |
return 8.0
|
|
231 |
return 0.8
|
|
229 | 232 |
log.warning('........ nope') |
230 | 233 |
log.warning('Config file heuristic 2: missing all cloud sections ?') |
231 | 234 |
if 'cloud' in sections: |
232 | 235 |
for r in self.keys('cloud'): |
233 | 236 |
log.warning('... found cloud "%s"' % r) |
234 |
return 9.0
|
|
237 |
return 0.9
|
|
235 | 238 |
log.warning('........ yep') |
236 | 239 |
log.warning('All heuristics failed, cannot decide') |
237 | 240 |
return 0.0 |
Also available in: Unified diff