From e0ff82c884356a6c9fcd0fef66580de30ec5af87 Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Mon, 26 Oct 2020 12:49:04 -0400 Subject: [PATCH] Change the return codes of ipa-acme-manage Traditionally in IPA 0 = success, 1 = error and then specific error messages follow from that. Shift the ipa-acme-manage return codes for "not installed" and "not a CA" up by one. https://pagure.io/freeipa/issue/8498 Signed-off-by: Rob Crittenden Reviewed-By: Fraser Tweedale Reviewed-By: Mohammad Rizwan --- install/tools/man/ipa-acme-manage.1 | 4 +++- ipaserver/install/ipa_acme_manage.py | 2 +- ipatests/test_integration/test_acme.py | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/install/tools/man/ipa-acme-manage.1 b/install/tools/man/ipa-acme-manage.1 index 6d8447ac0..07ee48d6f 100644 --- a/install/tools/man/ipa-acme-manage.1 +++ b/install/tools/man/ipa-acme-manage.1 @@ -31,6 +31,8 @@ Display the status of the ACME service. .SH "EXIT STATUS" 0 if the command was successful -1 if the host is not a CA server +1 if an error occurred 2 if the host is not a FreeIPA server + +3 if the host is not a CA server diff --git a/ipaserver/install/ipa_acme_manage.py b/ipaserver/install/ipa_acme_manage.py index a1b969d60..955f7c979 100644 --- a/ipaserver/install/ipa_acme_manage.py +++ b/ipaserver/install/ipa_acme_manage.py @@ -104,7 +104,7 @@ class IPAACMEManage(AdminTool): if not cainstance.is_ca_installed_locally(): print("CA is not installed on this server.") - return 1 + return 3 api.bootstrap(in_server=True, confdir=paths.ETC_IPA) api.finalize() diff --git a/ipatests/test_integration/test_acme.py b/ipatests/test_integration/test_acme.py index a4f9b74a4..aa4c14ae7 100644 --- a/ipatests/test_integration/test_acme.py +++ b/ipatests/test_integration/test_acme.py @@ -327,7 +327,7 @@ class TestACMECALess(IntegrationTest): # check status of acme on replica, result: CA is not installed result = self.replicas[0].run_command(['ipa-acme-manage', 'status'], raiseonerr=False) - assert result.returncode == 1 + assert result.returncode == 3 # Install CA on replica tasks.install_ca(self.replicas[0])