Re: [Freeipa-devel] [PATCH 0064] Check if IPA is configured before attempting a winsync migration

2015-11-23 Thread Martin Babinsky

On 11/20/2015 07:10 PM, Gabe Alford wrote:

Thanks. Updated patch attached.


Gabe

On Fri, Nov 20, 2015 at 10:36 AM, Martin Babinsky > wrote:

On 11/20/2015 04:02 PM, Gabe Alford wrote:

Hello,

Fix for https://fedorahosted.org/freeipa/ticket/5470

Thanks,

Gabe


Hi Gabe,

patch looks good. IMHO it would be better if you moved the check
before API initialization like so:

"""
@@ -340,6 +340,12 @@ class WinsyncMigrate(admintool.AdminTool):
  the plumbing.
  """

+# Check if the IPA server is configured before attempting
to migrate
+try:
+installutils.check_server_configuration()
+except RuntimeError as e:
+sys.exit(e)
+
  # Finalize API
  api.bootstrap(in_server=True, context='server')
  api.finalize()
"""

There's no point in initializing API if there is no server installed.

--
Martin^3 Babinsky



Thanks, ACK.

--
Martin^3 Babinsky

--
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 0064] Check if IPA is configured before attempting a winsync migration

2015-11-23 Thread Tomas Babej


On 11/23/2015 12:11 PM, Martin Babinsky wrote:
> On 11/20/2015 07:10 PM, Gabe Alford wrote:
>> Thanks. Updated patch attached.
>>
>>
>> Gabe
>>
>> On Fri, Nov 20, 2015 at 10:36 AM, Martin Babinsky > > wrote:
>>
>> On 11/20/2015 04:02 PM, Gabe Alford wrote:
>>
>> Hello,
>>
>> Fix for https://fedorahosted.org/freeipa/ticket/5470
>>
>> Thanks,
>>
>> Gabe
>>
>>
>> Hi Gabe,
>>
>> patch looks good. IMHO it would be better if you moved the check
>> before API initialization like so:
>>
>> """
>> @@ -340,6 +340,12 @@ class WinsyncMigrate(admintool.AdminTool):
>>   the plumbing.
>>   """
>>
>> +# Check if the IPA server is configured before attempting
>> to migrate
>> +try:
>> +installutils.check_server_configuration()
>> +except RuntimeError as e:
>> +sys.exit(e)
>> +
>>   # Finalize API
>>   api.bootstrap(in_server=True, context='server')
>>   api.finalize()
>> """
>>
>> There's no point in initializing API if there is no server installed.
>>
>> --
>> Martin^3 Babinsky
>>
>>
> Thanks, ACK.
> 

Pushed to:
master: 84e479edaaeb64567f4cfc847aa735bbd106220d
ipa-4-2: dbc442cc608a49726bcca9749b01dcd363b3ed8f

-- 
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 0064] Check if IPA is configured before attempting a winsync migration

2015-11-20 Thread Gabe Alford
Thanks. Updated patch attached.


Gabe

On Fri, Nov 20, 2015 at 10:36 AM, Martin Babinsky 
wrote:

> On 11/20/2015 04:02 PM, Gabe Alford wrote:
>
>> Hello,
>>
>> Fix for https://fedorahosted.org/freeipa/ticket/5470
>>
>> Thanks,
>>
>> Gabe
>>
>>
>> Hi Gabe,
>
> patch looks good. IMHO it would be better if you moved the check before
> API initialization like so:
>
> """
> @@ -340,6 +340,12 @@ class WinsyncMigrate(admintool.AdminTool):
>  the plumbing.
>  """
>
> +# Check if the IPA server is configured before attempting to
> migrate
> +try:
> +installutils.check_server_configuration()
> +except RuntimeError as e:
> +sys.exit(e)
> +
>  # Finalize API
>  api.bootstrap(in_server=True, context='server')
>  api.finalize()
> """
>
> There's no point in initializing API if there is no server installed.
>
> --
> Martin^3 Babinsky
>
From 62c89fb0bf760bf721d15a309497635a45a98077 Mon Sep 17 00:00:00 2001
From: Gabe 
Date: Fri, 20 Nov 2015 11:06:55 -0700
Subject: [PATCH] Check if IPA is configured before attempting a winsync
 migration

https://fedorahosted.org/freeipa/ticket/5470
---
 ipaserver/install/ipa_winsync_migrate.py | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/ipaserver/install/ipa_winsync_migrate.py b/ipaserver/install/ipa_winsync_migrate.py
index 87e23fb3698bac0a0371a198d95994ed921ee011..bbd029c81e7a093b3559e374189b79d12395b79c 100644
--- a/ipaserver/install/ipa_winsync_migrate.py
+++ b/ipaserver/install/ipa_winsync_migrate.py
@@ -29,7 +29,7 @@ from ipapython.dn import DN
 from ipapython.ipautil import realm_to_suffix, posixify
 from ipapython.ipa_log_manager import log_mgr
 from ipaserver.plugins.ldap2 import ldap2
-from ipaserver.install import replication
+from ipaserver.install import replication, installutils
 
 if six.PY3:
 unicode = str
@@ -340,6 +340,12 @@ class WinsyncMigrate(admintool.AdminTool):
 the plumbing.
 """
 
+# Check if the IPA server is configured before attempting to migrate
+try:
+installutils.check_server_configuration()
+except RuntimeError as e:
+sys.exit(e)
+
 # Finalize API
 api.bootstrap(in_server=True, context='server')
 api.finalize()
-- 
1.8.3.1

-- 
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 0064] Check if IPA is configured before attempting a winsync migration

2015-11-20 Thread Martin Babinsky

On 11/20/2015 04:02 PM, Gabe Alford wrote:

Hello,

Fix for https://fedorahosted.org/freeipa/ticket/5470

Thanks,

Gabe



Hi Gabe,

patch looks good. IMHO it would be better if you moved the check before 
API initialization like so:


"""
@@ -340,6 +340,12 @@ class WinsyncMigrate(admintool.AdminTool):
 the plumbing.
 """

+# Check if the IPA server is configured before attempting to 
migrate

+try:
+installutils.check_server_configuration()
+except RuntimeError as e:
+sys.exit(e)
+
 # Finalize API
 api.bootstrap(in_server=True, context='server')
 api.finalize()
"""

There's no point in initializing API if there is no server installed.

--
Martin^3 Babinsky

--
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