def _get_ptr_details(self, device, device_type): """ Takes a device and device type and returns the corresponding HREF link and service name for use with PTR record management. """ if device_type.lower().startswith("load"): ep = pyrax._get_service_endpoint("load_balancer") svc = "loadbalancers" svc_name = "cloudLoadBalancers" else: ep = pyrax._get_service_endpoint("compute") svc = "servers" svc_name = "cloudServersOpenStack" href = "%s/%s/%s" % (ep, svc, utils.get_id(device)) return (href, svc_name)
def _create(self): """Rackspace cloud networks client. Though pyrax "fixed" the network client bugs that were introduced in 1.8, it still doesn't work for contexts because of caching of the nova client. """ if not self.pyrax: self._authenticate() # need special handling now since the contextual # pyrax doesn't handle "networks" not being in # the catalog ep = pyrax._get_service_endpoint( self.pyrax, "compute", region=cfg.CONF.region_name_for_services) cls = pyrax._client_classes['compute:network'] client = cls(self.pyrax, region_name=cfg.CONF.region_name_for_services, management_url=ep) return client