Friday, March 15, 2013

Lessons about Default Values

I have lots of "Rules of System Administration".  Some day I'll write them all down and publish a book.

Today I got a reminder about the nuance of one:

Always provide reasonable defaults.

I happen to have been building an OpenShift Broker on Fedora 18, but it applies elsewhere.  The OpenShift broker service is configured with the /etc/openshift/broker.conf file. The configuration file is a traditional line-oriented set of key/value pairs.  That is, each pair is on one line, separated by an equals sign (=).

I was trying to set custom values to the Mongo database, but when I tried starting the broker application it would try to connect to the data store and fail.  It indicated that it was trying to use the default value, ignoring my settings.

I fished around in the Rails environments files and several other places where I saw the same value until I figured out which one it was coming from (the right one, config/environments/production.rb).

I knew I'd set the values in my configuration file right, so why weren't they showing up?

It turns out that the reason was that I hadn't set them right.  I'd left the equal sign out when I made the substitutions.  That's my problem.  And that's not the real issue.

In looking at that default which looked like a real, good, usable value, I realized it shouldn't.

For most settings a "reasonable default value" is one that will nominally work.  For access information and authentication, the reasonable default is "you didn't tell me what to do. I'm going to sit on my hands until you do".  The system shouldn't work until you successfully set your own values.

There's one other thing.  The system should not just spew garbage if you haven't set the values.  It should very politely inform you that you're not done yet and what needs to be done.

So, that's something I'm going to be thinking about for OpenShift next week.

No comments:

Post a Comment