def datacenters(gandi, id): """List available datacenters.""" output_keys = ['iso', 'name', 'country', 'dc_code', 'status'] if id: output_keys.append('id') result = gandi.datacenter.list() for num, dc in enumerate(result): if num: gandi.separator_line() output_datacenter(gandi, dc, output_keys, justify=10) return result
def kernels(gandi, vm, datacenter, flavor, match): """List available kernels.""" if vm: vm = gandi.iaas.info(vm) dc_list = gandi.datacenter.filtered_list(datacenter, vm) for dc in dc_list: gandi.echo('\n') output_datacenter(gandi, dc) kmap = gandi.kernel.list(dc['id'], flavor, match) for _flavor in kmap: gandi.separator_line() output_kernels(gandi, _flavor, kmap[_flavor])
def kernels(gandi, vm, datacenter, flavor, match): """List available kernels.""" if vm: vm = gandi.iaas.info(vm) dc_list = gandi.datacenter.filtered_list(datacenter, vm) for num, dc in enumerate(dc_list): if num: gandi.echo('\n') output_datacenter(gandi, dc, ['dc_name']) kmap = gandi.kernel.list(dc['id'], flavor, match) for _flavor in kmap: gandi.separator_line() output_kernels(gandi, _flavor, kmap[_flavor])
def kernels(gandi, vm, datacenter, flavor, match): """List available kernels.""" if vm: vm = gandi.iaas.info(vm) dc_list = gandi.datacenter.filtered_list(datacenter, vm) for num, dc in enumerate(dc_list): if num: gandi.echo("\n") output_datacenter(gandi, dc) kmap = gandi.kernel.list(dc["id"], flavor, match) for _flavor in kmap: gandi.separator_line() output_kernels(gandi, _flavor, kmap[_flavor])