[rabbitmq-discuss] rabbitmqadmin and default node behaviour

Simon Lundström simlu at su.se
Mon Oct 29 16:04:42 GMT 2012


On Fri, 2012-10-19 at 13:38:51 +0100, Simon MacMullen wrote:
> On 19/10/12 11:01, Simon Lundström wrote:
> >I'm trying to understand why rabbitmqadmin doesn't use the "default"
> >node when no config file is specified.
> >I use a config (stored in the default location) but I everytime I use
> >rabbitmqadmin I don't want to explicitly specify the node for every
> >command.
> >Someone must have had a good reason for not doing this in the first
> >place, but I cannot figure it out.
> 
> Hmm. Not sure I remember. The best explanation is at
> 
> http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/2012-February/018191.html
> 
> There's obviously a concern about not breaking the case where there
> is no config file. Maybe that was all.

Ugh, while implementing my solution I understand why it's made the way
it is. Config parsing is messy = S (Especially since my Python- and
ConfigParser-FU is weak)

So, my new suggestion is:

Parse the config/defaults in this order:
# defaults from default_options hash^Wdictionary
# config file, one of:
## specified via --config
### Use it and exit with an error if:
#### File doesn't exist
#### Node in config doesn't exist (default being default node or the one
specified via --node)
## default config file (~/.rabbitmqadmin.conf)
### If file doesn't exist, just ignore it.
### If file exists and node in file doesn't exist
#### exit showing that error message
# Options on the command line

This would also overwrite any options (last parsed "wins").

How does this sound?

Thanks,
- Simon


More information about the rabbitmq-discuss mailing list