maas_ipmi_autodetect mistakes empty slot for taken slot

Bug #1285607 reported by Jeroen T. Vermeulen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MAAS
Fix Released
Critical
Jason Hobbs

Bug Description

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 a single 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.

Tags: server-hwe

Related branches

description: updated
Changed in maas:
assignee: nobody → Jason Hobbs (jason-hobbs)
Changed in maas:
status: Triaged → In Progress
Changed in maas:
status: In Progress → Fix Committed
tags: added: server-hwe
Changed in maas:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.