Revision 1ec2f17e snf-cyclades-app/synnefo/management/common.py
b/snf-cyclades-app/synnefo/management/common.py | ||
---|---|---|
81 | 81 |
else: |
82 | 82 |
capital_name = name.capitalize() |
83 | 83 |
|
84 |
if name in ["server", "network", "port"]: |
|
85 |
try:
|
|
86 |
if value.startswith(settings.BACKEND_PREFIX_ID):
|
|
84 |
if isinstance(value, basestring) and name in ["server", "network", "port"]:
|
|
85 |
if value.startswith(settings.BACKEND_PREFIX_ID):
|
|
86 |
try:
|
|
87 | 87 |
if name == "server": |
88 | 88 |
value = id_from_instance_name(value) |
89 | 89 |
elif name == "network": |
90 | 90 |
value = id_from_network_name(value) |
91 | 91 |
elif name == "port": |
92 | 92 |
value = id_from_nic_name(value) |
93 |
except ValueError: |
|
94 |
raise CommandError("Invalid {} ID: {}".format(capital_name, value)) |
|
93 |
except ValueError: |
|
94 |
raise CommandError("Invalid {} ID: {}".format(capital_name, |
|
95 |
value)) |
|
95 | 96 |
|
96 | 97 |
if for_update: |
97 | 98 |
objects = objects.select_for_update() |
Also available in: Unified diff