Re: [Freeipa-devel] [PATCH] 390 Do not crash on unknown services in installutils.stopped_service
Dne 13.1.2015 v 18:55 Jan Cholasta napsal(a): Dne 13.1.2015 v 18:46 David Kupka napsal(a): On 01/13/2015 05:55 PM, Jan Cholasta wrote: Dne 13.1.2015 v 12:12 Jan Cholasta napsal(a): Hi, the attached patch fixes https://fedorahosted.org/freeipa/ticket/4835. Honza Modified the fix to create only one service object in stopped_service. Updated patch attached. ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel Hi! Thanks for the patch. Works for me, ACK. Thanks, pushed to: master: 5bf1c9a6f7d734c296c8eb987cfc4f7e2a345130 ipa-4-1: 065e2bbc9f2260d8c60c55f92a386513727576da Posting additional patch 393 which is necessary to properly fix this. David, could you take a look please? -- Jan Cholasta From 92b37953087d5e396b1c3bf0a3b776558d6b894c Mon Sep 17 00:00:00 2001 From: Jan Cholasta jchol...@redhat.com Date: Tue, 20 Jan 2015 09:38:43 + Subject: [PATCH] Do not assume certmonger is running in httpinstance https://fedorahosted.org/freeipa/ticket/4835 --- ipaserver/install/httpinstance.py | 48 +++ 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/ipaserver/install/httpinstance.py b/ipaserver/install/httpinstance.py index 2fb315b..cda85ab 100644 --- a/ipaserver/install/httpinstance.py +++ b/ipaserver/install/httpinstance.py @@ -39,6 +39,7 @@ from ipaserver.install import sysupgrade from ipalib import api from ipaplatform.tasks import tasks from ipaplatform.paths import paths +from ipaplatform import services SELINUX_BOOLEAN_SETTINGS = dict( @@ -228,25 +229,34 @@ class HTTPInstance(service.Service): print Adding Include conf.d/ipa-rewrite to %s failed. % paths.HTTPD_NSS_CONF def configure_certmonger_renewal_guard(self): -bus = dbus.SystemBus() -obj = bus.get_object('org.fedorahosted.certmonger', - '/org/fedorahosted/certmonger') -iface = dbus.Interface(obj, 'org.fedorahosted.certmonger') -path = iface.find_ca_by_nickname('IPA') -if path: -ca_obj = bus.get_object('org.fedorahosted.certmonger', path) -ca_iface = dbus.Interface(ca_obj, - 'org.freedesktop.DBus.Properties') -helper = ca_iface.Get('org.fedorahosted.certmonger.ca', - 'external-helper') -if helper: -args = shlex.split(helper) -if args[0] != paths.IPA_SERVER_GUARD: -self.backup_state('certmonger_ipa_helper', helper) -args = [paths.IPA_SERVER_GUARD] + args -helper = ' '.join(pipes.quote(a) for a in args) -ca_iface.Set('org.fedorahosted.certmonger.ca', - 'external-helper', helper) +certmonger = services.knownservices.certmonger +certmonger_stopped = not certmonger.is_running() + +if certmonger_stopped: +certmonger.start() +try: +bus = dbus.SystemBus() +obj = bus.get_object('org.fedorahosted.certmonger', + '/org/fedorahosted/certmonger') +iface = dbus.Interface(obj, 'org.fedorahosted.certmonger') +path = iface.find_ca_by_nickname('IPA') +if path: +ca_obj = bus.get_object('org.fedorahosted.certmonger', path) +ca_iface = dbus.Interface(ca_obj, + 'org.freedesktop.DBus.Properties') +helper = ca_iface.Get('org.fedorahosted.certmonger.ca', + 'external-helper') +if helper: +args = shlex.split(helper) +if args[0] != paths.IPA_SERVER_GUARD: +self.backup_state('certmonger_ipa_helper', helper) +args = [paths.IPA_SERVER_GUARD] + args +helper = ' '.join(pipes.quote(a) for a in args) +ca_iface.Set('org.fedorahosted.certmonger.ca', + 'external-helper', helper) +finally: +if certmonger_stopped: +certmonger.stop() def __setup_ssl(self): fqdn = self.fqdn -- 2.1.0 ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel
Re: [Freeipa-devel] [PATCH] 390 Do not crash on unknown services in installutils.stopped_service
On 01/20/2015 10:49 AM, Jan Cholasta wrote: Dne 13.1.2015 v 18:55 Jan Cholasta napsal(a): Dne 13.1.2015 v 18:46 David Kupka napsal(a): On 01/13/2015 05:55 PM, Jan Cholasta wrote: Dne 13.1.2015 v 12:12 Jan Cholasta napsal(a): Hi, the attached patch fixes https://fedorahosted.org/freeipa/ticket/4835. Honza Modified the fix to create only one service object in stopped_service. Updated patch attached. ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel Hi! Thanks for the patch. Works for me, ACK. Thanks, pushed to: master: 5bf1c9a6f7d734c296c8eb987cfc4f7e2a345130 ipa-4-1: 065e2bbc9f2260d8c60c55f92a386513727576da Posting additional patch 393 which is necessary to properly fix this. David, could you take a look please? Just looking at this patch, I am thinking it would be great to have @contextmanager also for started_service (we already have stopped_service) and use it (not required for this patch though). Martin ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel
Re: [Freeipa-devel] [PATCH] 390 Do not crash on unknown services in installutils.stopped_service
On 01/20/2015 12:07 PM, Martin Kosek wrote: On 01/20/2015 10:49 AM, Jan Cholasta wrote: Dne 13.1.2015 v 18:55 Jan Cholasta napsal(a): Dne 13.1.2015 v 18:46 David Kupka napsal(a): On 01/13/2015 05:55 PM, Jan Cholasta wrote: Dne 13.1.2015 v 12:12 Jan Cholasta napsal(a): Hi, the attached patch fixes https://fedorahosted.org/freeipa/ticket/4835. Honza Modified the fix to create only one service object in stopped_service. Updated patch attached. ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel Hi! Thanks for the patch. Works for me, ACK. Thanks, pushed to: master: 5bf1c9a6f7d734c296c8eb987cfc4f7e2a345130 ipa-4-1: 065e2bbc9f2260d8c60c55f92a386513727576da Posting additional patch 393 which is necessary to properly fix this. David, could you take a look please? Just looking at this patch, I am thinking it would be great to have @contextmanager also for started_service (we already have stopped_service) and use it (not required for this patch though). It would be handy. And there is an other solution for this specific case. Certmonger could be started with incoming DBus message. This will improve the usability not only with freeipa but also with command-line tools like getcert. I've filled a ticket for certmonger: https://fedorahosted.org/certmonger/ticket/38 Martin -- David Kupka ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel
Re: [Freeipa-devel] [PATCH] 390 Do not crash on unknown services in installutils.stopped_service
On 01/20/2015 12:19 PM, David Kupka wrote: On 01/20/2015 12:07 PM, Martin Kosek wrote: On 01/20/2015 10:49 AM, Jan Cholasta wrote: Dne 13.1.2015 v 18:55 Jan Cholasta napsal(a): Dne 13.1.2015 v 18:46 David Kupka napsal(a): On 01/13/2015 05:55 PM, Jan Cholasta wrote: Dne 13.1.2015 v 12:12 Jan Cholasta napsal(a): Hi, the attached patch fixes https://fedorahosted.org/freeipa/ticket/4835. Honza Modified the fix to create only one service object in stopped_service. Updated patch attached. ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel Hi! Thanks for the patch. Works for me, ACK. Thanks, pushed to: master: 5bf1c9a6f7d734c296c8eb987cfc4f7e2a345130 ipa-4-1: 065e2bbc9f2260d8c60c55f92a386513727576da Posting additional patch 393 which is necessary to properly fix this. David, could you take a look please? Just looking at this patch, I am thinking it would be great to have @contextmanager also for started_service (we already have stopped_service) and use it (not required for this patch though). It would be handy. And there is an other solution for this specific case. Certmonger could be started with incoming DBus message. This will improve the usability not only with freeipa but also with command-line tools like getcert. I've filled a ticket for certmonger: https://fedorahosted.org/certmonger/ticket/38 Right. But this needs more testing and care. Currently, we need to stabilize and fix a bug in FreeIPA that is also requested from downstream platform. Jan's patch/approach will be good for now. Martin ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel
Re: [Freeipa-devel] [PATCH] 390 Do not crash on unknown services in installutils.stopped_service
On 01/20/2015 10:49 AM, Jan Cholasta wrote: Dne 13.1.2015 v 18:55 Jan Cholasta napsal(a): Dne 13.1.2015 v 18:46 David Kupka napsal(a): On 01/13/2015 05:55 PM, Jan Cholasta wrote: Dne 13.1.2015 v 12:12 Jan Cholasta napsal(a): Hi, the attached patch fixes https://fedorahosted.org/freeipa/ticket/4835. Honza Modified the fix to create only one service object in stopped_service. Updated patch attached. ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel Hi! Thanks for the patch. Works for me, ACK. Thanks, pushed to: master: 5bf1c9a6f7d734c296c8eb987cfc4f7e2a345130 ipa-4-1: 065e2bbc9f2260d8c60c55f92a386513727576da Posting additional patch 393 which is necessary to properly fix this. David, could you take a look please? Pushed to: master: 82ab0eabf8b963023611ceb42f87244f40651c05 ipa-4-1: f204b28da316f60d85c6a6a0578e78ac74397fac Martin ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel
Re: [Freeipa-devel] [PATCH] 390 Do not crash on unknown services in installutils.stopped_service
On 01/20/2015 10:49 AM, Jan Cholasta wrote: Dne 13.1.2015 v 18:55 Jan Cholasta napsal(a): Dne 13.1.2015 v 18:46 David Kupka napsal(a): On 01/13/2015 05:55 PM, Jan Cholasta wrote: Dne 13.1.2015 v 12:12 Jan Cholasta napsal(a): Hi, the attached patch fixes https://fedorahosted.org/freeipa/ticket/4835. Honza Modified the fix to create only one service object in stopped_service. Updated patch attached. ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel Hi! Thanks for the patch. Works for me, ACK. Thanks, pushed to: master: 5bf1c9a6f7d734c296c8eb987cfc4f7e2a345130 ipa-4-1: 065e2bbc9f2260d8c60c55f92a386513727576da Posting additional patch 393 which is necessary to properly fix this. David, could you take a look please? Hi! Thanks for the patch. We know that there are better ways how to do it but this works as expected and we need the fix now, ACK. -- David Kupka ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel
Re: [Freeipa-devel] [PATCH] 390 Do not crash on unknown services in installutils.stopped_service
On 01/13/2015 05:55 PM, Jan Cholasta wrote: Dne 13.1.2015 v 12:12 Jan Cholasta napsal(a): Hi, the attached patch fixes https://fedorahosted.org/freeipa/ticket/4835. Honza Modified the fix to create only one service object in stopped_service. Updated patch attached. ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel Hi! Thanks for the patch. Works for me, ACK. -- David Kupka ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel
Re: [Freeipa-devel] [PATCH] 390 Do not crash on unknown services in installutils.stopped_service
Dne 13.1.2015 v 18:46 David Kupka napsal(a): On 01/13/2015 05:55 PM, Jan Cholasta wrote: Dne 13.1.2015 v 12:12 Jan Cholasta napsal(a): Hi, the attached patch fixes https://fedorahosted.org/freeipa/ticket/4835. Honza Modified the fix to create only one service object in stopped_service. Updated patch attached. ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel Hi! Thanks for the patch. Works for me, ACK. Thanks, pushed to: master: 5bf1c9a6f7d734c296c8eb987cfc4f7e2a345130 ipa-4-1: 065e2bbc9f2260d8c60c55f92a386513727576da -- Jan Cholasta ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel
[Freeipa-devel] [PATCH] 390 Do not crash on unknown services in installutils.stopped_service
Hi, the attached patch fixes https://fedorahosted.org/freeipa/ticket/4835. Honza -- Jan Cholasta From 09155e3546adbeededbd025dea631c2a5ac39cc6 Mon Sep 17 00:00:00 2001 From: Jan Cholasta jchol...@redhat.com Date: Tue, 13 Jan 2015 10:59:08 + Subject: [PATCH] Do not crash on unknown services in installutils.stopped_service https://fedorahosted.org/freeipa/ticket/4835 --- ipaserver/install/installutils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ipaserver/install/installutils.py b/ipaserver/install/installutils.py index 64578f7..6955edf 100644 --- a/ipaserver/install/installutils.py +++ b/ipaserver/install/installutils.py @@ -867,19 +867,19 @@ def stopped_service(service, instance_name=): log_instance_name) # Figure out if the service is running, if not, yield -if not services.knownservices[service].is_running(instance_name): +if not services.service(service).is_running(instance_name): root_logger.debug('Service %s%s is not running, continue.', service, log_instance_name) yield else: # Stop the service, do the required stuff and start it again root_logger.debug('Stopping %s%s.', service, log_instance_name) -services.knownservices[service].stop(instance_name) +services.service(service).stop(instance_name) try: yield finally: root_logger.debug('Starting %s%s.', service, log_instance_name) -services.knownservices[service].start(instance_name) +services.service(service).start(instance_name) def check_entropy(): ''' -- 2.1.0 ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel
Re: [Freeipa-devel] [PATCH] 390 Do not crash on unknown services in installutils.stopped_service
Dne 13.1.2015 v 12:12 Jan Cholasta napsal(a): Hi, the attached patch fixes https://fedorahosted.org/freeipa/ticket/4835. Honza Modified the fix to create only one service object in stopped_service. Updated patch attached. -- Jan Cholasta From 2048ecf51b1bc40566abe7f267563aed7d46575e Mon Sep 17 00:00:00 2001 From: Jan Cholasta jchol...@redhat.com Date: Tue, 13 Jan 2015 10:59:08 + Subject: [PATCH] Do not crash on unknown services in installutils.stopped_service https://fedorahosted.org/freeipa/ticket/4835 --- ipaserver/install/installutils.py | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ipaserver/install/installutils.py b/ipaserver/install/installutils.py index 64578f7..2492d0f 100644 --- a/ipaserver/install/installutils.py +++ b/ipaserver/install/installutils.py @@ -866,20 +866,22 @@ def stopped_service(service, instance_name=): 'the next set of commands is being executed.', service, log_instance_name) +service_obj = services.service(service) + # Figure out if the service is running, if not, yield -if not services.knownservices[service].is_running(instance_name): +if not service_obj.is_running(instance_name): root_logger.debug('Service %s%s is not running, continue.', service, log_instance_name) yield else: # Stop the service, do the required stuff and start it again root_logger.debug('Stopping %s%s.', service, log_instance_name) -services.knownservices[service].stop(instance_name) +service_obj.stop(instance_name) try: yield finally: root_logger.debug('Starting %s%s.', service, log_instance_name) -services.knownservices[service].start(instance_name) +service_obj.start(instance_name) def check_entropy(): ''' -- 2.1.0 ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel