ipa-healthcheck combined configuration and command-line options

Introduction

ipa-healthcheck runs automatically daily by default with some default options like where the log file is written and the output format. We had a request that this be easily configurable without having to modify the systemd services directly. The request was to add the command-line (CLI) options to the configuration file.

This was done upstream in the 0.11 release. There are a few gotchas that one needs to be aware of.

The first option used wins. A merge happens between the configuration file and the command-line, with the configuration file loaded first. So the command-line will not override the config.

To specify options that contain a dash (-) replace it with an underscore (_) in the file.

For example, --output-type=human becomes output_type=human in the configuration file.

Options that make no sense in configuration

I’m a great believer into giving users lots of flexibility. A number of options are allowed, but make no sense stored in a configuration file. This includes the --source and --check options. While sure, you can add them, they won’t do a lot of good since they are limited to a single source and a single check and there is zero validation that the source/check are valid. Doesn’t do a lot. This may be addressed in the future but it is what it is for now.

--list-sources and --input-file are others that makes no sense. Yes, you can set them, but it’ll do nothing useful. I may eventually add a “not-for-config” flag or something but that’s a nice-to-have, not a must-have.

--debug and --verbose are equally not useful as the output will be on stderr and will be suppressed by systemd when run in automation. Otherwise you’re looking at a firehose of output.

Options that do make sense

The original intention was to make --output-type and –-output-file configurable, I just went a bit overboard. In for a penny, in for a pound. The idea is that you set these options in /etc/ipahealthcheck/ipahealthcheck.conf and when automation runs it honors the requested formatting and output location. Some users really prefer the human output format.

Configuration file(s)

Per the requested use-case, if you aren’t running from the command-line much then go ahead and update the default configuration as needed. There is a new option, --config, that lets one pass in a different set of defaults. This can be helpful if you want control when running manually. You may want a different output type, for example.

# ipa-healthcheck --config /etc/ipahealthcheck/manual.conf

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s