Comment 0 for bug 1285607

Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

Lord_Set reports that some systems are not enlisting. Running maas_ipmi_autodetect.py manually produces this error:

raceback (most recent call last):
  File "maas_ipmi_autodetect.py", line 309, in <module>
    main()
  File "maas_ipmi_autodetect.py", line 276, in main
    apply_ipmi_user_settings(user_settings)
  File "maas_ipmi_autodetect.py", line 189, in apply_ipmi_user_settings
    ipmi_user_number = pick_user_number(username)
  File "maas_ipmi_autodetect.py", line 138, in pick_user_number
    raise IPMIError('No IPMI user slots available.')
__main__.IPMIError: No IPMI user slots available.

Yet there are clearly empty slots: User1, User2, User3 and so on.

Obtaining the user names for one of these slots as the script does it, produced:

# bmc-config --checkout --key-pair=User5:Username
Section User5
        ## Give Username
        Username
EndSection

(Indentation may not be correct: the text went through IRC).

The cause of the problem seems to be in bmc_user_get(). It matches that user query output to:

    r'^\s*%s(?:[ \t])+([^# \t\r\n\v\f]*[^\n]+)$' % (parameter)

If that doesn't match, bmc_user_get() returns None. Otherwise, it returns the match. But it looks as if just indentation whitespace _can_ produce a match: in this case the returned user name for an empty slot consisted of just blank space!

I think either the regex needs fixing, or we need to strip the output and also consider the empty user name to indicate an empty slot.