Revision f1d06d74
b/kamaki/cli/__init__.py | ||
---|---|---|
241 | 241 |
_verbose = arguments['verbose'].value |
242 | 242 |
_cnf = arguments['config'] |
243 | 243 |
|
244 |
_silent = arguments['silent'].value |
|
245 |
_setup_logging(_silent, _debug, _verbose, _include) |
|
246 |
|
|
244 | 247 |
if _help or is_non_API: |
245 | 248 |
return None, None |
246 | 249 |
|
... | ... | |
251 | 254 |
if not (stdout.isatty() and _colors == 'on'): |
252 | 255 |
from kamaki.cli.utils import remove_colors |
253 | 256 |
remove_colors() |
254 |
_silent = arguments['silent'].value |
|
255 |
_setup_logging(_silent, _debug, _verbose, _include) |
|
256 | 257 |
|
257 | 258 |
cloud = arguments['cloud'].value or _cnf.value.get( |
258 | 259 |
'global', 'default_cloud') |
... | ... | |
327 | 328 |
|
328 | 329 |
|
329 | 330 |
def _load_spec_module(spec, arguments, module): |
331 |
global kloger |
|
330 | 332 |
if not spec: |
331 | 333 |
return None |
332 | 334 |
pkg = None |
333 | 335 |
for location in cmd_spec_locations: |
334 | 336 |
location += spec if location == '' else '.%s' % spec |
335 | 337 |
try: |
338 |
kloger.debug('Import %s from %s' % ([module], location)) |
|
336 | 339 |
pkg = __import__(location, fromlist=[module]) |
340 |
kloger.debug('\t...OK') |
|
337 | 341 |
return pkg |
338 | 342 |
except ImportError as ie: |
343 |
kloger.debug('\t...Failed') |
|
339 | 344 |
continue |
340 | 345 |
if not pkg: |
341 | 346 |
msg = 'Loading command group %s failed: %s' % (spec, ie) |
342 |
try: |
|
343 |
kloger.debug(msg) |
|
344 |
except AttributeError: |
|
345 |
print msg |
|
346 |
print 'HINT: use a text editor to remove all global.*_cli' |
|
347 |
print ' settings from the configuration file' |
|
347 |
msg += '\nHINT: use a text editor to remove all global.*_cli' |
|
348 |
msg += '\n\tsettings from the configuration file' |
|
349 |
kloger.debug(msg) |
|
348 | 350 |
return pkg |
349 | 351 |
|
350 | 352 |
|
b/kamaki/cli/config.py | ||
---|---|---|
246 | 246 |
""" |
247 | 247 |
checker = Config(self.path, with_defaults=False) |
248 | 248 |
sections = checker.sections() |
249 |
log.warning('Config file heuristic 1: old global section ?')
|
|
249 |
log.debug('Config file heuristic 1: old global section ?')
|
|
250 | 250 |
if 'global' in sections: |
251 | 251 |
if checker.get('global', 'url') or checker.get('global', 'token'): |
252 |
log.warning('..... config file has an old global section')
|
|
252 |
log.debug('..... config file has an old global section')
|
|
253 | 253 |
return 0.8 |
254 |
log.warning('........ nope')
|
|
255 |
log.warning('Config file heuristic 2: Any cloud sections ?')
|
|
254 |
log.debug('........ nope')
|
|
255 |
log.debug('Config file heuristic 2: Any cloud sections ?')
|
|
256 | 256 |
if CLOUD_PREFIX in sections: |
257 | 257 |
for r in self.keys(CLOUD_PREFIX): |
258 |
log.warning('... found cloud "%s"' % r)
|
|
258 |
log.debug('... found cloud "%s"' % r)
|
|
259 | 259 |
return 0.9 |
260 |
log.warning('........ nope')
|
|
261 |
log.warning('All heuristics failed, cannot decide')
|
|
260 |
log.debug('........ nope')
|
|
261 |
log.debug('All heuristics failed, cannot decide')
|
|
262 | 262 |
return 0.9 |
263 | 263 |
|
264 | 264 |
def get_cloud(self, cloud, option): |
Also available in: Unified diff