Comment 0 for bug 1507712

Revision history for this message
John George (jog) wrote :

maas cli commands fail if run at the same time as 'maas logout' for any other profile.

The setup where this bug is frequently seen involves a host which interacts with 4 separate MAAS servers. The host is a test driver and uses the maas cli, when a test is being run, to collect information about the nodes that have been allocated:
    1. maas login maas_A http://10.0.40.100/MAAS/api/1.0/ <apikey>
    2. <maas cli commands to query nodes>
    3. maas logout maas_A

Tests are run in parallel against all 4 MAAS server (maas_A, maas_B, maas_C, maas_D).

When the timing lines up is a way that 'maas logout' is called, for example against maas_A, within close proximity to maas cli commands against maas_B, maas_C or maas_D, the following error is reported back to the shell running the latter.

jenkins@finfolk:~$ maas maas_B nodes list
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/lib/python2.7/dist-packages/maascli/__main__.py", line 20, in <module>
    main()
  File "/usr/lib/python2.7/dist-packages/maascli/__init__.py", line 41, in main
    parser = prepare_parser(argv)
  File "/usr/lib/python2.7/dist-packages/maascli/parser.py", line 80, in prepare_parser
    api.register_api_commands(parser)
  File "/usr/lib/python2.7/dist-packages/maascli/api.py", line 480, in register_api_commands
    profile = config[profile_name]
  File "/usr/lib/python2.7/dist-packages/maascli/config.py", line 56, in __getitem__
    raise KeyError(name)
KeyError: u'maas_foo'

This bug can easily be re-produced by opening two shells that are logged into two different MAAS servers. Log out of one server and then immediately attempt to run a maas cli command against the other. A re-try will generally work, so it seems there is a small window when this occurs but not so small that it's hard to reproduce.

ii maas-cli 1.9.0~alpha4+bzr4371-0ubuntu1~trusty1 all MAAS command line API tool
un maas-region-controller-min <none> <none> (no description available)
ii python-maas-client 1.9.0~alpha4+bzr4371-0ubuntu1~trusty1 all MAAS python API client