Revision 883c1f94 snf-cyclades-app/synnefo/logic/subnets.py
b/snf-cyclades-app/synnefo/logic/subnets.py | ||
---|---|---|
148 | 148 |
return sub |
149 | 149 |
|
150 | 150 |
|
151 |
def get_subnet(sub_id): |
|
151 |
def get_subnet(sub_id, prefetch_related=False):
|
|
152 | 152 |
"""Show info of a specific subnet""" |
153 | 153 |
log.debug('get_subnet %s', sub_id) |
154 | 154 |
try: |
155 |
subnet = Subnet.objects.get(id=sub_id) |
|
155 |
subnets = Subnet.objects |
|
156 |
if prefetch_related: |
|
157 |
subnets = subnets.select_related("network") |
|
158 |
subnets = subnets.prefetch_related("ip_pools") |
|
159 |
return subnets.get(id=sub_id) |
|
156 | 160 |
except Subnet.DoesNotExist: |
157 | 161 |
raise api.faults.ItemNotFound("Subnet not found") |
158 | 162 |
|
159 |
return subnet |
|
160 |
|
|
161 | 163 |
|
162 | 164 |
def delete_subnet(): |
163 | 165 |
"""Delete a subnet, raises BadRequest |
Also available in: Unified diff