Daryl Walleck | 1465d61 | 2011-11-02 02:22:15 -0500 | [diff] [blame^] | 1 | from storm.services.nova.json.images_client import ImagesClient |
| 2 | from storm.services.nova.json.flavors_client import FlavorsClient |
| 3 | from storm.services.nova.json.servers_client import ServersClient |
| 4 | import storm.config |
| 5 | |
| 6 | |
| 7 | class Manager(object): |
| 8 | |
| 9 | def __init__(self): |
| 10 | """ |
| 11 | Top level manager for all Openstack APIs |
| 12 | """ |
| 13 | |
| 14 | self.config = storm.config.StormConfig() |
| 15 | if self.config.env.authentication == 'keystone_v2': |
| 16 | self.servers_client = ServersClient(self.config.nova.username, |
| 17 | self.config.nova.api_key, |
| 18 | self.config.nova.auth_url, |
| 19 | self.config.nova.tenant_name) |
| 20 | self.flavors_client = FlavorsClient(self.config.nova.username, |
| 21 | self.config.nova.api_key, |
| 22 | self.config.nova.auth_url, |
| 23 | self.config.nova.tenant_name) |
| 24 | self.images_client = ImagesClient(self.config.nova.username, |
| 25 | self.config.nova.api_key, |
| 26 | self.config.nova.auth_url, |
| 27 | self.config.nova.tenant_name) |
| 28 | else: |
| 29 | #Assuming basic/native authentication |
| 30 | self.servers_client = ServersClient(self.config.nova.username, |
| 31 | self.config.nova.api_key, |
| 32 | self.config.nova.auth_url) |
| 33 | self.flavors_client = FlavorsClient(self.config.nova.username, |
| 34 | self.config.nova.api_key, |
| 35 | self.config.nova.auth_url) |
| 36 | self.images_client = ImagesClient(self.config.nova.username, |
| 37 | self.config.nova.api_key, |
| 38 | self.config.nova.auth_url) |