Dominik Vogt via FreeIPA-users wrote:
The config-mod commands generates an error if it does not change
anything:
$ ipa config-mod --ipaselinuxusermap="....."
ipa: ERROR: no modifications to be performed
As for real errors, the return code is 1, so this cannot be used
to detect "nothing to be done" errors.
This makes it very inconvenient to write scripts that overwrite a
value and do not care what the current value is. Is there an easy
way to suppress this kind of errors?
No.
I could do something like
{ ipa config-mod ... 2>&1 && echo && echo succes; } |
grep -qE "(success)|(no modifications to be performed)"
but that's really ugly and depends on the exact wording and
language of the error message.
You could force a specific locale in order to ensure the message doesn't
change. It hasn't in many, many years.
(This is also a problem for other "add" commands like user-add,
group-add, selinuxusermap-add etc.)
What's the problem? Can you provide some examples?
rob