Re: [Freeipa-devel] [PATCHES 0191-0194] Fix restoring states of services after uninstalling

2015-02-17 Thread David Kupka

On 02/11/2015 05:13 PM, Martin Basti wrote:

https://fedorahosted.org/freeipa/ticket/4869

Fixes:
- enable/start a service after uninstallation if the service was
enabled/running before in correct way
- store status of service before disable/stop/start/enable operation
- run uninstall only for configured services

Uninstall for ipa-dnskeysyncd is not executed because of
https://fedorahosted.org/freeipa/ticket/4901

Patches attached.



___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


Hi,
thanks for patches. The code looks good to me but I found 2 issues:

1. httpd is left in non-working state after installing and uninstalling 
ipa-server.
Tried on clean Fedora 21, the httpd was not configured before ipa-server 
installation.


2. Patch 191 needs (trivial) rebase.

--
David Kupka

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


Re: [Freeipa-devel] [PATCHES 0191-0194] Fix restoring states of services after uninstalling

2015-02-17 Thread Martin Basti

On 17/02/15 12:18, David Kupka wrote:

On 02/11/2015 05:13 PM, Martin Basti wrote:

https://fedorahosted.org/freeipa/ticket/4869

Fixes:
- enable/start a service after uninstallation if the service was
enabled/running before in correct way
- store status of service before disable/stop/start/enable operation
- run uninstall only for configured services

Uninstall for ipa-dnskeysyncd is not executed because of
https://fedorahosted.org/freeipa/ticket/4901

Patches attached.



___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


Hi,
thanks for patches. The code looks good to me but I found 2 issues:

1. httpd is left in non-working state after installing and 
uninstalling ipa-server.
Tried on clean Fedora 21, the httpd was not configured before 
ipa-server installation.


2. Patch 191 needs (trivial) rebase.


Thanks,

Updated patches attached.

--
Martin Basti

From ab7c9a9762de4e15c91a07cccab881411ecc2f0e Mon Sep 17 00:00:00 2001
From: Martin Basti 
Date: Tue, 27 Jan 2015 11:04:03 +0100
Subject: [PATCH 1/4] Fix restoring services status during uninstall

Services hasn't been restored correctly, which causes disabling already
disabled services, or some service did not start. This patch fix these
issues.

Ticket: https://fedorahosted.org/freeipa/ticket/4869
---
 ipaserver/install/bindinstance.py| 11 +--
 ipaserver/install/cainstance.py  |  6 --
 ipaserver/install/dnskeysyncinstance.py  | 19 ++-
 ipaserver/install/dsinstance.py  |  5 +++--
 ipaserver/install/httpinstance.py| 15 +++
 ipaserver/install/krbinstance.py |  9 +
 ipaserver/install/ntpinstance.py | 14 --
 ipaserver/install/odsexporterinstance.py | 14 ++
 ipaserver/install/opendnssecinstance.py  | 10 +-
 ipaserver/install/service.py | 15 +--
 10 files changed, 58 insertions(+), 60 deletions(-)

diff --git a/ipaserver/install/bindinstance.py b/ipaserver/install/bindinstance.py
index 4e630e8ddfed524d021d19016f48615fc8c0ab9d..cd1c7e7a67895808efdb29df963731edb2a2340e 100644
--- a/ipaserver/install/bindinstance.py
+++ b/ipaserver/install/bindinstance.py
@@ -1179,8 +1179,6 @@ class BindInstance(service.Service):
 
 self.dns_backup.clear_records(api.Backend.ldap2.isconnected())
 
-if not running is None:
-self.stop()
 
 for f in [NAMED_CONF, RESOLV_CONF]:
 try:
@@ -1189,11 +1187,12 @@ class BindInstance(service.Service):
 root_logger.debug(error)
 pass
 
-if not enabled is None and not enabled:
-self.disable()
+# disabled by default, by ldap_enable()
+if enabled:
+self.enable()
 
-if not running is None and running:
-self.start()
+if running:
+self.restart()
 
 self.named_regular.unmask()
 if named_regular_enabled:
diff --git a/ipaserver/install/cainstance.py b/ipaserver/install/cainstance.py
index a61534d50db0c811f314ff60fb6dc1825e70c137..8ba6e4616647746fce15a98f3e707cc04d349b0d 100644
--- a/ipaserver/install/cainstance.py
+++ b/ipaserver/install/cainstance.py
@@ -1273,8 +1273,10 @@ class CAInstance(DogtagInstance):
 
 def uninstall(self):
 enabled = self.restore_state("enabled")
-if not enabled is None and not enabled:
-self.disable()
+
+# disabled by default, by ldap_enable()
+if enabled:
+self.enable()
 
 if self.dogtag_constants.DOGTAG_VERSION >= 10:
 DogtagInstance.uninstall(self)
diff --git a/ipaserver/install/dnskeysyncinstance.py b/ipaserver/install/dnskeysyncinstance.py
index 5da65d87b1471710b762f90b9a33c453c7d809b7..1396d01a7842623f30f863fd8a2330cab26fe5a2 100644
--- a/ipaserver/install/dnskeysyncinstance.py
+++ b/ipaserver/install/dnskeysyncinstance.py
@@ -124,8 +124,6 @@ class DNSKeySyncInstance(service.Service):
 self.fqdn = fqdn
 self.realm = realm_name
 self.suffix = ipautil.realm_to_suffix(self.realm)
-self.backup_state("enabled", self.is_enabled())
-self.backup_state("running", self.is_running())
 try:
 self.stop()
 except:
@@ -417,7 +415,6 @@ class DNSKeySyncInstance(service.Service):
  self.suffix, self.extra_config)
 except errors.DuplicateEntry:
 self.logger.error("DNSKeySync service already exists")
-self.enable()
 
 def __setup_principal(self):
 assert self.ods_gid is not None
@@ -480,11 +477,13 @@ class DNSKeySyncInstance(service.Service):
 
 self.print_msg("Unconfiguring %s" % self.service_name)
 
-running = self.restore_state("running")
-enabled = self.restore_state("enabled")
+# Just eat states
+self.restore_state("running")
+self.restore_st

Re: [Freeipa-devel] [PATCH 0039] Add test case for unsupported arg for ipa-advise

2015-02-17 Thread Gabe Alford
Hello,

I was wondering if I could get a review of this patch.

Thanks,

Gabe

On Thursday, January 29, 2015, Gabe Alford  wrote:

> Hello,
>
>Here is a patch for https://fedorahosted.org/freeipa/ticket/4029 I
> added test cases for valid and invalid advice.
>
> Thanks,
>
> Gabe
>
> On Wed, Jan 14, 2015 at 10:23 AM, Tomas Babej  > wrote:
>
>>
>> On 01/14/2015 06:13 PM, Gabe Alford wrote:
>>
>>  On Wed, Jan 14, 2015 at 10:05 AM, Tomas Babej > > wrote:
>>
>>>
>>> On 01/14/2015 06:00 PM, Tomas Babej wrote:
>>>
>>>
>>> On 01/14/2015 05:37 PM, Tomas Babej wrote:
>>>
>>>
>>> On 01/14/2015 02:55 PM, Gabe Alford wrote:
>>>
>>>   Hello,
>>>
>>> In looking into https://fedorahosted.org/freeipa/ticket/4029 I
>>> am wondering if there should be separate ipa-advise test, Yes/No? Could be
>>> handy in the future to test more ipa-advise output? Or should this test be
>>> added to the test_legacy_clients.py?
>>>
>>>  Thanks,
>>>
>>>  Gabe
>>>
>>> On Tue, Dec 2, 2014 at 9:21 PM, Gabe Alford >> > wrote:
>>>
  Hello,

 I was going to try my hand at attempting a patch for ipa-tests. However
 in wanting to test my patch, I am not sure how to run ipa-tests to check if
 it works or not. Documentation is not really clear on what needs to be done
 to start a test and run a test. This is for
 https://fedorahosted.org/freeipa/ticket/4029

  I have attached the patch that I have yet to really test with
 ipa-test. Any help on how to test the patch running ipa-tests would be
 great. Of course, if one of the reviewers looks at the patch and looks
 good, then I would be happy with that as well.

  Thanks,

 Gabe

>>>
>>>
>>>
>>> ___
>>> Freeipa-devel mailing listfreeipa-de...@redhat.com 
>>> https://www.redhat.com/mailman/listinfo/freeipa-devel
>>>
>>>
>>> Hello,
>>>
>>> TL;DR: feel free to create a separate ipa-advise test file. Test
>>> requested in this ticket really does not belong to the legacy clients
>>> feature test.
>>>
>>> As for the any new tests that might come: I think tests for ipa-advise
>>> that are specific to that particular feature should be tested with that
>>> feature, more so, if they contain parts that are supposed to work
>>> copy-pasted. If a tests, however, tests a general behaviour of ipa-advise,
>>> it should live in the ipa-advise namespace, hence separate test file.
>>>
>>> HTH,
>>>
>>> --
>>> Tomas Babej
>>> Associate Software Engineer | Red Hat | Identity Management
>>> RHCE | Brno Site | IRC: tbabej | freeipa.org
>>>
>>>
>>>  The attached patch looks fine, although, please also test for a
>>> non-zero return code number.
>>>
>>>
>>> Upon hitting send I noticed you did not include raiseonerr=False into
>>> the run_command call. You need to do that, otherwise a exception will be
>>> raised, since ipa-advise exited with non-zero return code.
>>>
>> Thanks Tomas.
>>
>>  Which do you prefer: a test_advise.py or an update to the existing
>> patch?
>>
>>
>> A new test file, as I pointed out in the second email :) sorry for
>> splitting.
>>
>> However, it would be the best if you could spin up a positive test as
>> well (maybe listing out available advices), not just this negative one, to
>> justify the overhead reinstalling IPA for testing this feature.
>>
>>
>>
>>> --
>>> Tomas Babej
>>> Associate Software Engineer | Red Hat | Identity Management
>>> RHCE | Brno Site | IRC: tbabej | freeipa.org
>>>
>>>
>>> --
>>> Tomas Babej
>>> Associate Software Engineer | Red Hat | Identity Management
>>> RHCE | Brno Site | IRC: tbabej | freeipa.org
>>>
>>>
>>
>> --
>> Tomas Babej
>> Associate Software Engineer | Red Hat | Identity Management
>> RHCE | Brno Site | IRC: tbabej | freeipa.org
>>
>>
>
___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel