Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 'sympa config' command return code to be 0 when there are no changes #1518

Merged
merged 1 commit into from
Nov 23, 2022

Conversation

k0lter
Copy link
Contributor

@k0lter k0lter commented Nov 13, 2022

While trying to update a config value using sympa config command when there are no changes, it die() with a return code > 0.

It means that the command is not idempotent.

As an example, we started to use it in Debian Maintainer scripts with some config parameters instead of our custom routines to update configuration.

@ikedas
Copy link
Member

ikedas commented Nov 17, 2022

Hi @k0lter ,

It makes sense not to die(), however I feel the message "Not changed." helps.

@ikedas ikedas added the bug label Nov 17, 2022
@k0lter
Copy link
Contributor Author

k0lter commented Nov 17, 2022

Hi @ikedas

It will pollute stdout especially when used multiple times in scripts.

Could you consider adding a -q (--quiet) argument (disabled by default)?

Thanks,

@ikedas
Copy link
Member

ikedas commented Nov 17, 2022

As --quiet has already been used by the other commands, I suggest -s / --silent.

-use constant _options   => qw(output|o=s@);
+use constant _options   => qw(output|o=s@ silent|s);

(BTW since stdout pollution is the problem for all commands, I'd like to make this option available for all the other commands in the future.)

@k0lter
Copy link
Contributor Author

k0lter commented Nov 17, 2022

Sounds good to me. Thanks.

@racke
Copy link
Contributor

racke commented Nov 17, 2022

Yes, but I would suggest to use "--noout" or something similar as it is easy to confuse --quiet and --silent.

@ikedas
Copy link
Member

ikedas commented Nov 17, 2022

--quiet is used not to notify the target user, but --silent is certainly confusing.

--noout is used by something including openssl and xmllint. I'm ok.

@ikedas ikedas added this to the 6.2.72 milestone Nov 18, 2022
ikedas added a commit to ikedas/sympa that referenced this pull request Nov 18, 2022
@ikedas
Copy link
Member

ikedas commented Nov 18, 2022

Though I've not tested yet, I've added the --noout option.

sympa-6.2...ikedas:sympa:k0lter/sympa-config-command-rc

@k0lter
Copy link
Contributor Author

k0lter commented Nov 19, 2022

Thanks @ikedas

@racke
Copy link
Contributor

racke commented Nov 19, 2022

Though I've not tested yet, I've added the --noout option.

sympa-6.2...ikedas:sympa:k0lter/sympa-config-command-rc

"Skip output" is easier to parse for the human brain than "No output".

ikedas added a commit to ikedas/sympa that referenced this pull request Nov 19, 2022
@ikedas
Copy link
Member

ikedas commented Nov 19, 2022

Thanks racke. I re-pushed correction and more changes.

ikedas added a commit to ikedas/sympa that referenced this pull request Nov 20, 2022
ikedas added a commit to ikedas/sympa that referenced this pull request Nov 23, 2022
ikedas added a commit that referenced this pull request Nov 23, 2022
…y k0lter & ikedas

Add --noout option to sympa command line (see #1518)
@ikedas ikedas merged commit 5b5d79b into sympa-community:sympa-6.2 Nov 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants