PageRenderTime 182ms CodeModel.GetById 80ms app.highlight 2ms RepoModel.GetById 99ms app.codeStats 0ms

/silverlining/commands/list_sizes.py

https://bitbucket.org/ianb/silverlining/
Python | 18 lines | 15 code | 2 blank | 1 comment | 4 complexity | c9240012704e4bd458b214ff3f89a429 MD5 | raw file
 1"""List available sizes"""
 2
 3
 4def command_list_sizes(config):
 5    sizes = config.driver.list_sizes()
 6    try:
 7        default_size = config.select_size(sizes=sizes)
 8    except LookupError:
 9        default_size = None
10        config.logger.info('[%s] has no default size' % (
11            config['section_name']))
12    for size in sizes:
13        if default_size and size.id == default_size.id:
14            default = '**default**'
15        else:
16            default = ''
17        config.logger.notify('%s %14s: ram=%5sMb, disk=%3sGb %s' % (
18            size.id, size.name, size.ram, size.disk, default))