def run(self):
        """Grab plugin's stats.

        Infinite loop, should be stopped by calling the stop() method
        """
        if import_error_tag:
            self.stop()
            return False

        for k, v in iteritems(self.OPENSTACK_API_METADATA):
            r_url = '{}/{}'.format(self.OPENSTACK_API_URL, v)
            try:
                # Local request, a timeout of 3 seconds is OK
                r = requests.get(r_url, timeout=3)
            except Exception as e:
                logger.debug('cloud plugin - Cannot connect to the OpenStack metadata API {}: {}'.format(r_url, e))
                break
            else:
                if r.ok:
                    self._stats[k] = to_ascii(r.content)

        return True
def run ( self ) : if import_error_tag : self . stop ( ) return False for k , v in iteritems ( self . OPENSTACK_API_METADATA ) : r_url = '{}/{}' . format ( self . OPENSTACK_API_URL , v ) try : r = requests . get ( r_url , timeout = 3 ) except Exception as e : logger . debug ( 'cloud plugin - Cannot connect to the OpenStack metadata API {}: {}' . format ( r_url , e ) ) break else : if r . ok : self . _stats [ k ] = to_ascii ( r . content ) return True
Grab plugin's stats.

        Infinite loop, should be stopped by calling the stop() method