29.03.2011 17:28, Dejan Muhamedagic:

The fact that the shell has this feature doesn't mean that it
should be misused. It was meant mainly for one-off management
commands (such as "resource stop" or "node standby") and only
very seldom for one-off configuration commands.

Sounds reasonable.

If you think that the feature should not be misused, there must be something enforcing your intention. Unfortunately, it's almost late to restrict command line arguments usage, as it will broke backward compatibility.

But, unfortunately, the feature is not uniform with interactive shell.
How's that now? I know that many people don't understand how
shell (as in bash) work, but don't understand how crm shell can
work around that. If you have an idea, please speak up.

I'm not very familiar with crm shell internals, so it's raw idea only. But, as I've said before, this kind of mistake can be detected. Look at what we have seen in the very start of the thread:

>crm configure primitive rsa-fencing stonith:external/ibmrsa params hostname="alpha1 alpha2" ipaddr=192.168.75.178 userid=USR passwd=PWD type=ibm op monitor interval="60s"

The console print the ERROR message: "ERROR: rsa-fencing: parameter
alpha2 does not exist"


The shell does not give you meaningful explanation of what has happened. Most nonintrusive change I can imagine would be to print actual crm command which has caused the error. For example:

ERROR: rsa-fencing: parameter alpha2 does not exist
The command was: configure primitive rsa-fencing stonith:external/ibmrsa params hostname=alpha1 alpha2 ipaddr=192.168.75.178 userid=USR passwd=PWD type=ibm op monitor interval=60s


Hopefully the user will quickly notice the difference between his command and shell's variant.

The shell can also analyze command line parameters and note that one of them contains space. It would then suggest user to do proper shell escaping. But there may be false positives.


The shell can go one step further and analyze it's arguments to repair lost quotes. If there are many arguments, and there is an argument without quotes and with space inside, quotes can be inserted right after first '=' character (if any) and at the end of the argument. The result may be unreliable, though. So it's up to you to rate this quirk.


--
Pavel Levshin

_______________________________________________
Pacemaker mailing list: Pacemaker@oss.clusterlabs.org
http://oss.clusterlabs.org/mailman/listinfo/pacemaker

Project Home: http://www.clusterlabs.org
Getting started: http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf
Bugs: http://developerbugs.linux-foundation.org/enter_bug.cgi?product=Pacemaker

Reply via email to