← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1592345] Re: Import of tempest.test has side-effect that config is parsed

 

** Changed in: neutron
       Status: New => Invalid

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1592345

Title:
  Import of tempest.test has side-effect that config is parsed

Status in neutron:
  Invalid
Status in tempest:
  Invalid

Bug description:
  During implementation of tempest scenario for qos, it revealed that
  calling

   from tempest import test

  has a side-effect. It replaces oslo config object with a proxy object.
  Calling __getattr__ on this object has a side-effect of parsing the
  config which makes config object no longer capable of registering new
  CLI opts.

  In [1]: from oslo_config import cfg

  In [2]: from tempest import test
  2016-06-14 10:21:46.063 7637 INFO tempest [-] Using tempest config file /etc/tempest/tempest.conf
  ^[[A^[[A
  In [3]: cfg.CONF.register_cli_opts([cfg.StrOpt('foo')])
  ---------------------------------------------------------------------------
  ArgsAlreadyParsedError                    Traceback (most recent call last)
  <ipython-input-3-a1153935307d> in <module>()
  ----> 1 cfg.CONF.register_cli_opts([cfg.StrOpt('foo')])

  /usr/lib/python2.7/site-packages/oslo_config/cfg.pyc in __inner(self, *args, **kwargs)
     2106         def __inner(self, *args, **kwargs):
     2107             if kwargs.pop('clear_cache', True):
  -> 2108                 result = f(self, *args, **kwargs)
     2109                 self.__cache.clear()
     2110                 return result

  /usr/lib/python2.7/site-packages/oslo_config/cfg.pyc in register_cli_opts(self, opts, group)
     2290         """Register multiple CLI option schemas at once."""
     2291         for opt in opts:
  -> 2292             self.register_cli_opt(opt, group, clear_cache=False)
     2293 
     2294     def register_group(self, group):

  /usr/lib/python2.7/site-packages/oslo_config/cfg.pyc in __inner(self, *args, **kwargs)
     2110                 return result
     2111             else:
  -> 2112                 return f(self, *args, **kwargs)
     2113 
     2114         return __inner

  /usr/lib/python2.7/site-packages/oslo_config/cfg.pyc in register_cli_opt(self, opt, group)
     2282         """
     2283         if self._args is not None:
  -> 2284             raise ArgsAlreadyParsedError("cannot register CLI option")
     2285 
     2286         return self.register_opt(opt, group, cli=True, clear_cache=False)

  ArgsAlreadyParsedError: arguments already parsed: cannot register CLI
  option

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1592345/+subscriptions