Red Hat Bugzilla – Bug 492294
fence_apc: user outlet not supported - Connection timeout
Last modified: 2009-05-19 16:30:17 EDT
Description of problem:
When using fence_apc agent to controle an APC AP7921, we are obliged to use the dm user or the administrator user. When using outlets users - more secure because they see only the associated outlets - the script fails.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1.Declare outlet user in the powerswitch, enable it, and give him an outlet
2.Use fence_apc :
/sbin/fence_apc2 -o on -a $IP -l $outletuser -p $outletuserpasswd -n $OutletNumber -v
<ESC>- Main Menu, <ENTER>- Refresh
>Success: [Already] ON / OFF
The reason is simple:
When the powerswitch show the list of Outlets, with user dm or administrator, we see the whole list:
1- Outlet 1 ON
2- Outlet 2 ON
fence_apc search for this expression in get_power_status:
status = re.compile("\s*"+options["-n"]+"-.*(ON|OFF)", re.IGNORECASE).search(result).group(1)
so it searchs for "$OutletNumber- ... ON|OFF"
It works if there is the whole list since this number is the outlet number too.
But when using the outlet user, list is not ordonned like that. For example:
1- Outlet 2 ON
2- Outlet 4 ON
We must change the regex like that:
status = re.compile("\s*"+"Outlet "+options["-n"]+".*(ON|OFF)", re.IGNORECASE).search(result).group(1)
I understand your problem but this is not a bug. Your patch can work for you but quite a lot of users uses aliases so there is no such thing as 'Outlet 2'. On APC these aliases does not have to be unique. Only unique number is one that we are parsing.
Currently we are extending our fence agent to support option '-o list' which will show you 'outlet number -> alias' mapping. Then using conga you will be able to select proper outlet number much more easier.