def _availability_zones(): api_manager = manager.APIManager() try: zones = api_manager.availability_zone_client.list_availability_zones() info = zones['availabilityZoneInfo'] return {zone['zoneName'] for zone in info} finally: api_manager.cleanup_credentials()
def __init__(self, conf, name=None, userdata=None, metadata=None, availability_zone=None): super(BaseHeatBackend, self).__init__( conf, name=name, userdata=userdata, metadata=metadata, availability_zone=availability_zone) self._manager = api_manager.APIManager() self._heat_client = client.heat_client( self._manager.primary_credentials()) self._keypair = None
def _get_image_name(image_ref): """Return the image name. :param image_ref: The id of the image. """ image_name = None try: mng = manager.APIManager() images = mng.image_client.list_images()["images"] for img_ref in images: if img_ref["id"].lower() == image_ref.lower(): image_name = img_ref["name"] finally: mng.cleanup_credentials() return image_name
def __init__(self, conf, name, userdata, metadata, availability_zone): if userdata: userdata = base64.encodestring(userdata) super(BaseTempestBackend, self).__init__(conf, name, userdata, metadata, availability_zone) self._server = None self._keypair = None self._security_group = None self._security_groups_rules = [] self._subnets = [] self._routers = [] self._floating_ip = None self._networks = None # list with UUIDs for future attached NICs # set some members from the configuration file needed by recipes self.image_ref = self._conf.openstack.image_ref self.flavor_ref = self._conf.openstack.flavor_ref self._manager = api_manager.APIManager()
def __init__(self, name, userdata, metadata, availability_zone): if userdata: # NOTE(dtoncu): `encodestring` is a deprecated alias in Python 3.*; # `encodebytes` can be used instead. # pylint: disable=deprecated-method, maybe-no-member if six.PY2: userdata = base64.encodestring(userdata) else: userdata = base64.encodebytes(userdata) super(BaseTempestBackend, self).__init__(name, userdata, metadata, availability_zone) self._server = None self._keypair = None self._security_group = None self._security_groups_rules = [] self._subnets = [] self._routers = [] self._floating_ip = None self._networks = None # list with UUIDs for future attached NICs # set some members from the configuration file needed by recipes self.image_ref = CONFIG.openstack.image_ref self.flavor_ref = CONFIG.openstack.flavor_ref self._manager = api_manager.APIManager()
def setUp(self, mock_credentials, mock_waiters, mock_clients): self._api_manager = manager.APIManager()