Revision 4cbef2a0
b/snf-cyclades-app/synnefo/logic/utils.py | ||
---|---|---|
39 | 39 |
Strips the ganeti prefix atm. Needs a better name! |
40 | 40 |
|
41 | 41 |
""" |
42 |
if not str(name).startswith(settings.BACKEND_PREFIX_ID): |
|
43 |
raise VirtualMachine.InvalidBackendIdError(str(name)) |
|
44 |
ns = str(name).replace(settings.BACKEND_PREFIX_ID, "", 1) |
|
42 |
sname = str(name) |
|
43 |
if not sname.startswith(settings.BACKEND_PREFIX_ID): |
|
44 |
raise VirtualMachine.InvalidBackendIdError(sname) |
|
45 |
ns = sname.replace(settings.BACKEND_PREFIX_ID, "", 1) |
|
45 | 46 |
if not ns.isdigit(): |
46 |
raise VirtualMachine.InvalidBackendIdError(str(name))
|
|
47 |
raise VirtualMachine.InvalidBackendIdError(sname)
|
|
47 | 48 |
|
48 | 49 |
return int(ns) |
49 | 50 |
|
Also available in: Unified diff