Re: [Freeipa-devel] [PATCH 0033] Fix CA being presented as running even if it weren't
On 02.06.2016 19:21, Martin Basti wrote: On 31.05.2016 16:32, Stanislav Laznicka wrote: On 05/31/2016 11:40 AM, Stanislav Laznicka wrote: On 05/31/2016 10:22 AM, Stanislav Laznicka wrote: On 05/30/2016 12:54 PM, Jan Cholasta wrote: On 30.5.2016 12:36, Martin Basti wrote: On 26.05.2016 19:31, Stanislav Laznicka wrote: Self NACK. I should not post patches when tired, sorry. Minor fix is attached. On 05/26/2016 07:21 PM, Stanislav Laznicka wrote: Hello, Please, see the attached patch. Fixes https://fedorahosted.org/freeipa/ticket/5898 Standa LGTM, if nobody is against this, I will push it in 2 days NACK, please add `wait` argument and call self.wait_until_running(), same as in start() and restart(). A pretty good point, please see the modified patch. Self.NACK - can't add 'wait' agrument to service.Service.is_running this easy. Should be fixed now. works for me, can be pushed if Honza agree Martin^2 ACK Pushed to master: fb4e19713d509a0a14acb7eee37f5fee7a9fb375 -- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code
Re: [Freeipa-devel] [PATCH 0033] Fix CA being presented as running even if it weren't
On 31.05.2016 16:32, Stanislav Laznicka wrote: On 05/31/2016 11:40 AM, Stanislav Laznicka wrote: On 05/31/2016 10:22 AM, Stanislav Laznicka wrote: On 05/30/2016 12:54 PM, Jan Cholasta wrote: On 30.5.2016 12:36, Martin Basti wrote: On 26.05.2016 19:31, Stanislav Laznicka wrote: Self NACK. I should not post patches when tired, sorry. Minor fix is attached. On 05/26/2016 07:21 PM, Stanislav Laznicka wrote: Hello, Please, see the attached patch. Fixes https://fedorahosted.org/freeipa/ticket/5898 Standa LGTM, if nobody is against this, I will push it in 2 days NACK, please add `wait` argument and call self.wait_until_running(), same as in start() and restart(). A pretty good point, please see the modified patch. Self.NACK - can't add 'wait' agrument to service.Service.is_running this easy. Should be fixed now. works for me, can be pushed if Honza agree Martin^2 -- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code
Re: [Freeipa-devel] [PATCH 0033] Fix CA being presented as running even if it weren't
On 05/31/2016 11:40 AM, Stanislav Laznicka wrote: On 05/31/2016 10:22 AM, Stanislav Laznicka wrote: On 05/30/2016 12:54 PM, Jan Cholasta wrote: On 30.5.2016 12:36, Martin Basti wrote: On 26.05.2016 19:31, Stanislav Laznicka wrote: Self NACK. I should not post patches when tired, sorry. Minor fix is attached. On 05/26/2016 07:21 PM, Stanislav Laznicka wrote: Hello, Please, see the attached patch. Fixes https://fedorahosted.org/freeipa/ticket/5898 Standa LGTM, if nobody is against this, I will push it in 2 days NACK, please add `wait` argument and call self.wait_until_running(), same as in start() and restart(). A pretty good point, please see the modified patch. Self.NACK - can't add 'wait' agrument to service.Service.is_running this easy. Should be fixed now. From 7de58955f4876a3c9cfbfb22b38931b9dd95062e Mon Sep 17 00:00:00 2001 From: Stanislav Laznicka Date: Thu, 26 May 2016 15:24:15 +0200 Subject: [PATCH] Fixes CA always being presented as running Even after manually stopping the pki-tomcatd service instance the service's is_running() method would still return True. https://fedorahosted.org/freeipa/ticket/5898 --- ipaplatform/base/services.py | 4 ++-- ipaplatform/redhat/services.py | 17 + ipaserver/install/service.py | 4 ++-- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/ipaplatform/base/services.py b/ipaplatform/base/services.py index 641a654183c52c0330cb4ece2a54c6bd0a96394c..a36b2f4ff7f325f882bdb9974e59259656b9a10e 100644 --- a/ipaplatform/base/services.py +++ b/ipaplatform/base/services.py @@ -148,7 +148,7 @@ class PlatformService(object): def restart(self, instance_name="", capture_output=True, wait=True): return -def is_running(self, instance_name=""): +def is_running(self, instance_name="", wait=True): return False def is_installed(self): @@ -303,7 +303,7 @@ class SystemdService(PlatformService): if wait and self.is_running(instance_name): self.wait_for_open_ports(self.service_instance(instance_name)) -def is_running(self, instance_name=""): +def is_running(self, instance_name="", wait=True): instance = self.service_instance(instance_name, 'is-active') while True: diff --git a/ipaplatform/redhat/services.py b/ipaplatform/redhat/services.py index 92dae452a31a0b3680e9c407eccb120881cc9e25..849737059d54df5af47ae288ef97b933d9e869fe 100644 --- a/ipaplatform/redhat/services.py +++ b/ipaplatform/redhat/services.py @@ -222,6 +222,23 @@ class RedHatCAService(RedHatService): if wait: self.wait_until_running() +def is_running(self, instance_name="", wait=True): +if instance_name: +return super(RedHatCAService, self).is_running(instance_name) +try: +status = dogtag.ca_status() +if status == 'running': +return True +elif status == 'starting' and wait: +# Exception is raised if status is 'starting' even after wait +self.wait_until_running() +return True +except Exception as e: +root_logger.debug( +'Failed to check CA status: {err}'.format(err=e) +) +return False + # Function that constructs proper Red Hat OS family-specific server classes for # services of specified name diff --git a/ipaserver/install/service.py b/ipaserver/install/service.py index 40767acd57d5e1fa8126144ca64f6951848ce214..c09dc9013b091e6eebcf9b297fef8337671ce40e 100644 --- a/ipaserver/install/service.py +++ b/ipaserver/install/service.py @@ -346,8 +346,8 @@ class Service(object): def restart(self, instance_name="", capture_output=True, wait=True): self.service.restart(instance_name, capture_output=capture_output, wait=wait) -def is_running(self): -return self.service.is_running() +def is_running(self, instance_name="", wait=True): +return self.service.is_running(instance_name, wait) def install(self): self.service.install() -- 2.5.5 -- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code
Re: [Freeipa-devel] [PATCH 0033] Fix CA being presented as running even if it weren't
On 05/31/2016 10:22 AM, Stanislav Laznicka wrote: On 05/30/2016 12:54 PM, Jan Cholasta wrote: On 30.5.2016 12:36, Martin Basti wrote: On 26.05.2016 19:31, Stanislav Laznicka wrote: Self NACK. I should not post patches when tired, sorry. Minor fix is attached. On 05/26/2016 07:21 PM, Stanislav Laznicka wrote: Hello, Please, see the attached patch. Fixes https://fedorahosted.org/freeipa/ticket/5898 Standa LGTM, if nobody is against this, I will push it in 2 days NACK, please add `wait` argument and call self.wait_until_running(), same as in start() and restart(). A pretty good point, please see the modified patch. Self.NACK - can't add 'wait' agrument to service.Service.is_running this easy. -- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code
Re: [Freeipa-devel] [PATCH 0033] Fix CA being presented as running even if it weren't
On 05/30/2016 12:54 PM, Jan Cholasta wrote: On 30.5.2016 12:36, Martin Basti wrote: On 26.05.2016 19:31, Stanislav Laznicka wrote: Self NACK. I should not post patches when tired, sorry. Minor fix is attached. On 05/26/2016 07:21 PM, Stanislav Laznicka wrote: Hello, Please, see the attached patch. Fixes https://fedorahosted.org/freeipa/ticket/5898 Standa LGTM, if nobody is against this, I will push it in 2 days NACK, please add `wait` argument and call self.wait_until_running(), same as in start() and restart(). A pretty good point, please see the modified patch. From bce6e608e3b952a61ecb49542d43f576689a93aa Mon Sep 17 00:00:00 2001 From: Stanislav Laznicka Date: Thu, 26 May 2016 15:24:15 +0200 Subject: [PATCH] Fixes CA always being presented as running Even after manually stopping the pki-tomcatd service instance the service's is_running() method would still return True. https://fedorahosted.org/freeipa/ticket/5898 --- ipaplatform/redhat/services.py | 17 + ipaserver/install/service.py | 4 ++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/ipaplatform/redhat/services.py b/ipaplatform/redhat/services.py index 92dae452a31a0b3680e9c407eccb120881cc9e25..849737059d54df5af47ae288ef97b933d9e869fe 100644 --- a/ipaplatform/redhat/services.py +++ b/ipaplatform/redhat/services.py @@ -222,6 +222,23 @@ class RedHatCAService(RedHatService): if wait: self.wait_until_running() +def is_running(self, instance_name="", wait=True): +if instance_name: +return super(RedHatCAService, self).is_running(instance_name) +try: +status = dogtag.ca_status() +if status == 'running': +return True +elif status == 'starting' and wait: +# Exception is raised if status is 'starting' even after wait +self.wait_until_running() +return True +except Exception as e: +root_logger.debug( +'Failed to check CA status: {err}'.format(err=e) +) +return False + # Function that constructs proper Red Hat OS family-specific server classes for # services of specified name diff --git a/ipaserver/install/service.py b/ipaserver/install/service.py index 40767acd57d5e1fa8126144ca64f6951848ce214..c09dc9013b091e6eebcf9b297fef8337671ce40e 100644 --- a/ipaserver/install/service.py +++ b/ipaserver/install/service.py @@ -346,8 +346,8 @@ class Service(object): def restart(self, instance_name="", capture_output=True, wait=True): self.service.restart(instance_name, capture_output=capture_output, wait=wait) -def is_running(self): -return self.service.is_running() +def is_running(self, instance_name="", wait=True): +return self.service.is_running(instance_name, wait) def install(self): self.service.install() -- 2.5.5 -- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code
Re: [Freeipa-devel] [PATCH 0033] Fix CA being presented as running even if it weren't
On 30.5.2016 12:36, Martin Basti wrote: On 26.05.2016 19:31, Stanislav Laznicka wrote: Self NACK. I should not post patches when tired, sorry. Minor fix is attached. On 05/26/2016 07:21 PM, Stanislav Laznicka wrote: Hello, Please, see the attached patch. Fixes https://fedorahosted.org/freeipa/ticket/5898 Standa LGTM, if nobody is against this, I will push it in 2 days NACK, please add `wait` argument and call self.wait_until_running(), same as in start() and restart(). -- Jan Cholasta -- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code
Re: [Freeipa-devel] [PATCH 0033] Fix CA being presented as running even if it weren't
On 26.05.2016 19:31, Stanislav Laznicka wrote: Self NACK. I should not post patches when tired, sorry. Minor fix is attached. On 05/26/2016 07:21 PM, Stanislav Laznicka wrote: Hello, Please, see the attached patch. Fixes https://fedorahosted.org/freeipa/ticket/5898 Standa LGTM, if nobody is against this, I will push it in 2 days -- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code
Re: [Freeipa-devel] [PATCH 0033] Fix CA being presented as running even if it weren't
Self NACK. I should not post patches when tired, sorry. Minor fix is attached. On 05/26/2016 07:21 PM, Stanislav Laznicka wrote: Hello, Please, see the attached patch. Fixes https://fedorahosted.org/freeipa/ticket/5898 Standa From b42146384771d95761cbeaab516f559ee87b66cc Mon Sep 17 00:00:00 2001 From: Stanislav Laznicka Date: Thu, 26 May 2016 15:24:15 +0200 Subject: [PATCH] Fixes CA always being presented as running Even after manually stopping the pki-tomcatd service instance the service the is_running() method would still return True. https://fedorahosted.org/freeipa/ticket/5898 --- ipaplatform/redhat/services.py | 18 ++ ipaserver/install/service.py | 4 ++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/ipaplatform/redhat/services.py b/ipaplatform/redhat/services.py index 92dae452a31a0b3680e9c407eccb120881cc9e25..6f8ac2cb41c8b716d8fa13869565d9dc047d2cc4 100644 --- a/ipaplatform/redhat/services.py +++ b/ipaplatform/redhat/services.py @@ -222,6 +222,24 @@ class RedHatCAService(RedHatService): if wait: self.wait_until_running() +def is_running(self, instance_name=""): +if instance_name: +return super(RedHatCAService, self).is_running(instance_name) +while True: +try: +status = dogtag.ca_status() +except Exception as e: +root_logger.debug( +'Failed to check CA status: {err}'.format(err=e) +) +return False +if status == 'running': +return True +elif status == 'starting': +time.sleep(1) +else: +return False + # Function that constructs proper Red Hat OS family-specific server classes for # services of specified name diff --git a/ipaserver/install/service.py b/ipaserver/install/service.py index 40767acd57d5e1fa8126144ca64f6951848ce214..e1361c2fb339c73dd36028257ed862d02d9411e3 100644 --- a/ipaserver/install/service.py +++ b/ipaserver/install/service.py @@ -346,8 +346,8 @@ class Service(object): def restart(self, instance_name="", capture_output=True, wait=True): self.service.restart(instance_name, capture_output=capture_output, wait=wait) -def is_running(self): -return self.service.is_running() +def is_running(self, instance_name=""): +return self.service.is_running(instance_name) def install(self): self.service.install() -- 2.5.5 -- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code