Mailing List Archive

A little tip about crm configure filter ?
Hi,

I'm fighting with the crm configure filter command to change all
migration-threshold values in the configuration :

crm -F configure filter \"sed '/threshold="1"/s/="1"/="0"/g'\"

does not change anything , and I've tried to add several \ around the "
, around the = etc. nothing works ...

whereas if I execute the sed command on a resulting file of command crm
configure show, sed command works :
sed '/threshold="1"/s/="1"/="0"/g'

can someone tell me the tip to make it works with crm configure filter ?

Thanks a lot !
Alain
_______________________________________________
Linux-HA mailing list
Linux-HA@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems
Re: A little tip about crm configure filter ? [ In reply to ]
On Tue, 7 Jan 2014 10:35:10 +0100
Moullé Alain <alain.moulle@bull.net> wrote:

> Hi,
>
> I'm fighting with the crm configure filter command to change all
> migration-threshold values in the configuration :
>
> crm -F configure filter \"sed '/threshold="1"/s/="1"/="0"/g'\"
>
> does not change anything , and I've tried to add several \ around the
> " , around the = etc. nothing works ...
>
> whereas if I execute the sed command on a resulting file of command
> crm configure show, sed command works :
> sed '/threshold="1"/s/="1"/="0"/g'
>
> can someone tell me the tip to make it works with crm configure
> filter ?

Hi,

Unfortunately bash quoting makes it really tricky to get the input
right. It's easier to do this through the interactive shell. The
following variant should work:

crm configure <<END
filter "sed '/threshold=\"1\"/s/=\"1\"/=\"0\"/g'"
END

--
// Kristoffer Grönlund
// kgronlund@suse.com
_______________________________________________
Linux-HA mailing list
Linux-HA@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems
Re: A little tip about crm configure filter ? [ In reply to ]
Thanks Kristoffer,

works fine but ...
I also needed to execute the command in a perl script such as :
`crm -F configure filter \"sed '/threshold="1"/s/="1"/="0"/g'\"`

but it seems also difficult to make it work with the mandatory CR and
<<END and END flags inside ...
:-\

Alain

On Tue, 7 Jan 2014 10:35:10 +0100 Moullé Alain <alain.moulle@bull.net>
wrote:
>> Hi,
>>
>> I'm fighting with the crm configure filter command to change all
>> migration-threshold values in the configuration :
>>
>> crm -F configure filter \"sed '/threshold="1"/s/="1"/="0"/g'\"
>>
>> does not change anything , and I've tried to add several \ around the
>> " , around the = etc. nothing works ...
>>
>> whereas if I execute the sed command on a resulting file of command
>> crm configure show, sed command works :
>> sed '/threshold="1"/s/="1"/="0"/g'
>>
>> can someone tell me the tip to make it works with crm configure
>> filter ?
> Hi,
>
> Unfortunately bash quoting makes it really tricky to get the input
> right. It's easier to do this through the interactive shell. The
> following variant should work:
>
> crm configure <<END
> filter "sed '/threshold=\"1\"/s/=\"1\"/=\"0\"/g'"
> END
>

_______________________________________________
Linux-HA mailing list
Linux-HA@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems
Re: A little tip about crm configure filter ? [ In reply to ]
On Wed, 8 Jan 2014 10:10:35 +0100
Moullé Alain <alain.moulle@bull.net> wrote:

> works fine but ...
> I also needed to execute the command in a perl script such as :
> `crm -F configure filter \"sed '/threshold="1"/s/="1"/="0"/g'\"`
>
> but it seems also difficult to make it work with the mandatory CR and
> <<END and END flags inside ...
> :-\

Hmm, I'm not a perl hacker, but it shouldn't be impossible to feed
multiline input to stdin from a perl script. You'll need to pipe the
filter text to crm from perl. Googling seems to indicate that this [1]
should have the answer, but my perl reading abilities aren't quite
good enough to tell. :)

[1]: http://perldoc.perl.org/perlipc.html#Using-open%28%29-for-IPC

--
// Kristoffer Grönlund
// kgronlund@suse.com
_______________________________________________
Linux-HA mailing list
Linux-HA@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems
Re: A little tip about crm configure filter ? [ In reply to ]
On Wed, 8 Jan 2014 10:10:35 +0100
Moullé Alain <alain.moulle@bull.net> wrote:

> Thanks Kristoffer,
>
> works fine but ...
> I also needed to execute the command in a perl script such as :
> `crm -F configure filter \"sed '/threshold="1"/s/="1"/="0"/g'\"`
>
> but it seems also difficult to make it work with the mandatory CR and
> <<END and END flags inside ...
> :-\
>

Another option that could work for you is to save the contents of
<<END .. END to a file, and pass it to crm using load:
crm configure load filter.txt


--
// Kristoffer Grönlund
// kgronlund@suse.com
_______________________________________________
Linux-HA mailing list
Linux-HA@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems