cli: maas logout causes KeyError for other profiles
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MAAS |
Fix Released
|
Medium
|
Greg Lutostanski | ||
2.2 |
Fix Released
|
Medium
|
Andres Rodriguez |
Bug Description
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://
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/
"__main__", fname, loader, pkg_name)
File "/usr/lib/
exec code in run_globals
File "/usr/lib/
main()
File "/usr/lib/
parser = prepare_
File "/usr/lib/
api.
File "/usr/lib/
profile = config[
File "/usr/lib/
raise KeyError(name)
KeyError: u'maas_foo'
This bug can easily be re-produced by:
1. Open two shells on the same host and log into two different MAAS servers.
2. From one shell call 'maas logout <profile>'
3. Immediately attempt to run any maas cli command from the second shell.
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+
un maas-region-
ii python-maas-client 1.9.0~alpha4+
Related branches
- Andres Rodriguez (community): Approve
-
Diff: 105 lines (+38/-2)2 files modifiedsrc/maascli/config.py (+26/-1)
src/maascli/tests/test_config.py (+12/-1)
- Blake Rouse (community): Approve
-
Diff: 105 lines (+38/-2)2 files modifiedsrc/maascli/config.py (+26/-1)
src/maascli/tests/test_config.py (+12/-1)
Changed in maas: | |
milestone: | none → 1.9.0 |
importance: | Undecided → Low |
importance: | Low → Medium |
description: | updated |
Changed in maas: | |
status: | New → Triaged |
Changed in maas: | |
milestone: | 1.9.0 → 2.3.0 |
tags: | added: cdo-qa |
Changed in maas: | |
assignee: | nobody → Blake Rouse (blake-rouse) |
Changed in maas: | |
assignee: | Blake Rouse (blake-rouse) → Greg Lutostanski (lutostag) |
Changed in maas: | |
status: | Triaged → In Progress |
Changed in maas: | |
status: | In Progress → Fix Committed |
Changed in maas: | |
milestone: | 2.3.0 → 2.3.0beta1 |
Changed in maas: | |
status: | Fix Committed → Fix Released |
The workaround used is the test environment is to create a wrapper script, such as /usr/local/bin/maas with: jenkins/ maas.lock -c "/usr/bin/maas $*"
#!/bin/bash
flock -w 10 /var/lib/