[ClusterLabs] [OCF] [RFC at agents] unresolved issue with handling parameters containing whitespaces
lars.ellenberg at linbit.com
Wed May 13 05:44:46 EDT 2015
On Tue, May 12, 2015 at 07:23:36AM -0600, Alan Robertson wrote:
> This is not a problem in the OCF API, but in the pcs command.
> There is no issue with having spaces in environment variables.
> It's the pcs command that's doing you dirty here...
In this case it is also the mysql RA (and helper functions)
that do not properly quote.
if [ ! -f $OCF_RESKEY_config ]; then
Well, sure, that breaks.
But Alan is right, of course, this is not a problem with the OCF API.
More a problem in the implementation of the individual resource agents.
And possibly something the UIs need to review in their internals.
I know CRM shell handles white space quite well
(or at least in a way I expect it to).
I personally don't use PCS that often, so I'm unsure there.
> > - I want to run ocf:heartbeat:mysql resource in my cluster
> > - I am a rebel going against best practices, hence my configuration
> > file for this mysql instance is "/mnt/foo/mysql/config final.cnf"
> > (notice the space)
> > - so I go ahead and type:
> > # pcs resource create mysql-test1 ocf:heartbeat:mysql \
> > 'config=/mnt/foo/mysql/config final.cnf'
> > (quotes present so as to pass the whole config=... argument at once,
> > otherwise the same word-splitting problem as mentioned would be
> > present)
In crmsh, you would say
shell# crm configure primitive mysql-test1 ocf:heartbeat:mysql params 'config="/mnt/foo/mysql/config final.cnf"'
(from the shell prompt), or
shell# crm configure
crm(live)configure# primitive mysql-test1 ocf:heartbeat:mysql params config="/mnt/foo/mysql/config final.cnf"
from the crmsh prompt.
>From the error output below, PCS handles it just fine,
and passes the white space just fine.
But it still breaks in
> > > '[' '!' -f /mnt/foo/mysql/config final.cnf ']'
> > ^^^
> > OOPS#1a
> > > stderr: /usr/lib/ocf/lib/heartbeat/mysql-common.sh: line 108: \
> > > [: /mnt/foo/mysql/config: binary operator expected
> > ^^^
etc., because that RA script does not use quotes properly.
So: fix (all) the agents, or don't do that.
Or both ;-)
: Lars Ellenberg
: http://www.LINBIT.com | Your Way to High Availability
: DRBD, Linux-HA and Pacemaker support and consulting
DRBD® and LINBIT® are registered trademarks of LINBIT, Austria.
More information about the Users