sawyl: (Default)
[personal profile] sawyl
Defaults can be dangerous and options that can be safely assumed in one context can be lethal in another. For example, most of the xCAT commands support a -t option that can be used to specify the type of target object, e.g. groups, nodes, etc. If the type is left unspecified, it assumes that the target is a node. A sensible assumption for harmless query commands like lsdef, but a foolish one potentially damaging commands like rmdef.

Thus, after creating a series of dynamic groups in a failed attempt to work around the lack of sensible booleans in the node selection criteria, I found myself with a series of groups I no longer needed. Naively, I tried to delete one of them using rmdef. But because I'd failed to specify the -t group the command removed the contents of the group, i.e. my nodes, instead of the group itself. Luckily I noticed the problem almost immediately because the number of deleted objects was larger than expected, but I still faced the boring and slightly embarrassing task of recreating the deleted objects (because, of course, the daily database backups hadn't been run for some weeks).

The behaviour of chdef is clearly wrong, given the way that it violates the principle of least surprise. I know, for it was certainly a surprise to me.

If the user is trying to delete something and there is insufficient information on the command line to determine unambiguously the target of the operation, the command should fail until enough arguments have been have be specified to allow the target to be deleted. It should not, pace xCAT, attempt to guess at the target by applying default option values, even when a this sort of guess-work identification is applied to other similar but non-destructive commands.

Profile

sawyl: (Default)
sawyl

August 2018

S M T W T F S
   123 4
5 6 7 8910 11
12131415161718
192021222324 25
262728293031 

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Feb. 5th, 2026 12:25 pm
Powered by Dreamwidth Studios