Revision 55f562a4 snf-cyclades-app/synnefo/api/util.py
b/snf-cyclades-app/synnefo/api/util.py | ||
---|---|---|
547 | 547 |
return MacPrefixPoolTable |
548 | 548 |
else: |
549 | 549 |
raise Exception("Unknown resource type") |
550 |
|
|
551 |
|
|
552 |
def get_existing_users(): |
|
553 |
""" |
|
554 |
Retrieve user ids stored in cyclades user agnostic models. |
|
555 |
""" |
|
556 |
# also check PublicKeys a user with no servers/networks exist |
|
557 |
from synnefo.ui.userdata.models import PublicKeyPair |
|
558 |
from synnefo.db.models import VirtualMachine, Network |
|
559 |
|
|
560 |
keypairusernames = PublicKeyPair.objects.filter().values_list('user', |
|
561 |
flat=True) |
|
562 |
serverusernames = VirtualMachine.objects.filter().values_list('userid', |
|
563 |
flat=True) |
|
564 |
networkusernames = Network.objects.filter().values_list('userid', |
|
565 |
flat=True) |
|
566 |
|
|
567 |
return set(list(keypairusernames) + list(serverusernames) + \ |
|
568 |
list(networkusernames)) |
|
569 |
|
Also available in: Unified diff