Revision 5482bc0a
b/kamaki/cli/config.py | ||
---|---|---|
113 | 113 |
checker = Config(self.path, with_defaults=False) |
114 | 114 |
sections = checker.sections() |
115 | 115 |
log.warning('Config file heuristic 1: global section ?') |
116 |
v = 0.0 |
|
116 | 117 |
if 'global' in sections: |
117 | 118 |
if checker.get('global', 'url') or checker.get('global', 'token'): |
118 | 119 |
log.warning('..... config file has an old global section') |
119 |
return 2.0
|
|
120 |
v = 2.0
|
|
120 | 121 |
log.warning('Config file heuristic 2: at least 1 remote section ?') |
121 | 122 |
for section in sections: |
122 | 123 |
if self._remote_name(section): |
123 | 124 |
log.warning('... found %s section' % section) |
124 |
return 3.0
|
|
125 |
v = 3.0
|
|
125 | 126 |
log.warning('All heuristics failed, cannot decide') |
126 |
return 0.0 |
|
127 |
del checker |
|
128 |
return v |
|
127 | 129 |
|
128 | 130 |
def _load_defaults(self): |
129 | 131 |
for section, options in DEFAULTS.items(): |
Also available in: Unified diff