Tony Mack | 29c287f | 2013-04-11 21:07:16 -0400 | [diff] [blame^] | 1 | from plstackapi.openstack.client import OpenStackClient |
| 2 | from plstackapi.openstack.driver import OpenStackDriver |
| 3 | from plstackapi.core.api.auth import auth_check |
| 4 | from plstackapi.core.models import Node |
| 5 | |
| 6 | def _get_nodes(filter): |
| 7 | if isinstance(filter, int): |
| 8 | nodes = Node.objects.filter(id=filter) |
| 9 | elif isinstance(filter, StringTypes): |
| 10 | nodes = Node.objects.filter(name=filter) |
| 11 | elif isinstance(filer, dict): |
| 12 | nodes = Node.objects.filter(**filter) |
| 13 | else: |
| 14 | nodes = [] |
| 15 | return nodes |
| 16 | |
| 17 | def add_node(auth, fields={}): |
| 18 | """not implemented""" |
| 19 | return |
| 20 | |
| 21 | def delete_node(auth, filter={}): |
| 22 | """not implemented""" |
| 23 | return 1 |
| 24 | |
| 25 | def update_node(auth, id, fields={}): |
| 26 | return |
| 27 | |
| 28 | def get_nodes(auth, filter={}): |
| 29 | auth_check(auth) |
| 30 | nodes = _get_nodes(filter) |
| 31 | return nodes |
| 32 | |
| 33 | |
| 34 | |