Ejemplo n.º 1
0
 def set_proxy(self):
     """Sets environment property for http_proxy:
         To behave properly - method must be called after all nailgun params
         is processed
     """
     if self.compute.online_controllers:
         os.environ['http_proxy'] = 'http://{0}:{1}'.format(
             self.compute.online_controllers[0], 8888)
     else:
         raise exceptions.SetProxy()
Ejemplo n.º 2
0
    def set_proxy(self):
        """Sets environment property for http_proxy:
            To behave properly - method must be called after all nailgun params
            is processed
        """
        if not self.compute.online_controllers:
            raise exceptions.OfflineControllers()

        proxies = [
            self.find_proxy(ip) for ip in self.compute.online_controllers
        ]
        if not proxies:
            raise exceptions.SetProxy()

        os.environ['http_proxy'] = 'http://{0}:{1}'.format(proxies[0], 8888)
Ejemplo n.º 3
0
 def set_proxy(self):
     """Sets environment property for http_proxy:
         To behave properly - method must be called after all nailgun params
         is processed
     """
     if not self.compute.online_controllers:
         raise exceptions.OfflineControllers()
     keystone_vip = self.get_keystone_vip()
     proxy_port = 8888
     LOG.debug('Keystone VIP is: {0}'.format(keystone_vip))
     proxies = self.find_proxy(self.compute.online_controllers, proxy_port,
                               keystone_vip)
     if not proxies:
         raise exceptions.SetProxy()
     for proxy in proxies:
         if proxy['auth_passed']:
             os.environ['http_proxy'] = 'http://{0}:{1}'.format(
                 proxy['ip'], proxy_port)
             return
     raise exceptions.InvalidCredentials