On 17/12/15 12:14, Petr Vobornik wrote:
On 12/16/2015 02:31 PM, David Kupka wrote:
https://www.redhat.com/archives/freeipa-users/2015-December/msg00203.html


please link the patch to https://fedorahosted.org/freeipa/ticket/5556

Updated patches attached.

--
David Kupka
From 9920cae3e7938f3d5c8d65ab2794b87a7c6e6e89 Mon Sep 17 00:00:00 2001
From: David Kupka <dku...@redhat.com>
Date: Wed, 16 Dec 2015 12:43:13 +0000
Subject: [PATCH 1/2] installer: Propagate option values from components
 instead of copying them.

https://fedorahosted.org/freeipa/ticket/5556
---
 ipapython/install/core.py          |  7 +++++++
 ipaserver/install/server/common.py | 28 ----------------------------
 2 files changed, 7 insertions(+), 28 deletions(-)

diff --git a/ipapython/install/core.py b/ipapython/install/core.py
index 6b2da05d31d26bd3b7222e237c8646fa80ab5290..62756da39c012bda4f7b77e5d0b2716c67ec013b 100644
--- a/ipapython/install/core.py
+++ b/ipapython/install/core.py
@@ -528,6 +528,13 @@ class Composite(Configurable):
             for order, owner_cls, name in result:
                 yield owner_cls, name
 
+    def __getattr__(self, name):
+        for owner_cls, knob_name in self.knobs():
+            for component in self.__components:
+                if isinstance(component, owner_cls):
+                    return getattr(component, knob_name)
+        raise AttributeError(name)
+
     def _reset(self):
         self.__components = list(self._get_components())
 
diff --git a/ipaserver/install/server/common.py b/ipaserver/install/server/common.py
index 3eb7279d200ffd6ab33d8d914c8d4f13e567a171..948aac842951dc3cef9dace87b28a92d3f98dea3 100644
--- a/ipaserver/install/server/common.py
+++ b/ipaserver/install/server/common.py
@@ -409,34 +409,6 @@ class BaseServer(common.Installable, common.Interactive, core.Composite):
         # Automatically disable pkinit w/ dogtag until that is supported
         self.no_pkinit = True
 
-        self.external_ca = self.ca.external_ca
-        self.external_ca_type = self.ca.external_ca_type
-        self.external_cert_files = self.ca.external_cert_files
-        self.dirsrv_cert_files = self.ca.dirsrv_cert_files
-        self.http_cert_files = self.ca.http_cert_files
-        self.pkinit_cert_files = self.ca.pkinit_cert_files
-        self.dirsrv_pin = self.ca.dirsrv_pin
-        self.http_pin = self.ca.http_pin
-        self.pkinit_pin = self.ca.pkinit_pin
-        self.dirsrv_cert_name = self.ca.dirsrv_cert_name
-        self.http_cert_name = self.ca.http_cert_name
-        self.pkinit_cert_name = self.ca.pkinit_cert_name
-        self.ca_cert_files = self.ca.ca_cert_files
-        self.subject = self.ca.subject
-        self.ca_signing_algorithm = self.ca.ca_signing_algorithm
-        self.skip_schema_check = self.ca.skip_schema_check
-
-        self.forwarders = self.dns.forwarders
-        self.no_forwarders = self.dns.no_forwarders
-        self.reverse_zones = self.dns.reverse_zones
-        self.no_reverse = self.dns.no_reverse
-        self.no_dnssec_validation = self.dns.no_dnssec_validation
-        self.dnssec_master = self.dns.dnssec_master
-        self.disable_dnssec_master = self.dns.disable_dnssec_master
-        self.kasp_db_file = self.dns.kasp_db_file
-        self.force = self.dns.force
-        self.zonemgr = self.dns.zonemgr
-
         self.unattended = not self.interactive
 
     ca = core.Component(BaseServerCA)
-- 
2.5.0

From 50300b478e3838e7f98d541277aec28c6c76d869 Mon Sep 17 00:00:00 2001
From: David Kupka <dku...@redhat.com>
Date: Wed, 16 Dec 2015 12:43:13 +0000
Subject: [PATCH 1/2] installer: Propagate option values from components
 instead of copying them.

https://fedorahosted.org/freeipa/ticket/5556
---
 ipapython/install/core.py          |  7 +++++++
 ipaserver/install/server/common.py | 31 -------------------------------
 2 files changed, 7 insertions(+), 31 deletions(-)

diff --git a/ipapython/install/core.py b/ipapython/install/core.py
index 2f62b8568fea129255e42b404789fd29b70dca7c..3eb38d3783a7cad5d07f6dc6c669e82695e322f2 100644
--- a/ipapython/install/core.py
+++ b/ipapython/install/core.py
@@ -531,6 +531,13 @@ class Composite(Configurable):
             for order, owner_cls, name in result:
                 yield owner_cls, name
 
+    def __getattr__(self, name):
+        for owner_cls, knob_name in self.knobs():
+            for component in self.__components:
+                if isinstance(component, owner_cls):
+                    return getattr(component, knob_name)
+        raise AttributeError(name)
+
     def _reset(self):
         self.__components = list(self._get_components())
 
diff --git a/ipaserver/install/server/common.py b/ipaserver/install/server/common.py
index 19a1cc8210cb652b6e00ef6eb8f0d66b214ca398..00b05c9b34abac159d6fcf9277dfe29197025334 100644
--- a/ipaserver/install/server/common.py
+++ b/ipaserver/install/server/common.py
@@ -461,37 +461,6 @@ class BaseServer(common.Installable, common.Interactive, core.Composite):
         # Automatically disable pkinit w/ dogtag until that is supported
         self.no_pkinit = True
 
-        self.external_ca = self.ca.external_ca
-        self.external_ca_type = self.ca.external_ca_type
-        self.external_cert_files = self.ca.external_cert_files
-        self.dirsrv_cert_files = self.ca.dirsrv_cert_files
-        self.http_cert_files = self.ca.http_cert_files
-        self.pkinit_cert_files = self.ca.pkinit_cert_files
-        self.dirsrv_pin = self.ca.dirsrv_pin
-        self.http_pin = self.ca.http_pin
-        self.pkinit_pin = self.ca.pkinit_pin
-        self.dirsrv_cert_name = self.ca.dirsrv_cert_name
-        self.http_cert_name = self.ca.http_cert_name
-        self.pkinit_cert_name = self.ca.pkinit_cert_name
-        self.ca_cert_files = self.ca.ca_cert_files
-        self.subject = self.ca.subject
-        self.ca_signing_algorithm = self.ca.ca_signing_algorithm
-        self.skip_schema_check = self.ca.skip_schema_check
-
-        self.forwarders = self.dns.forwarders
-        self.auto_forwarders = self.dns.auto_forwarders
-        self.no_forwarders = self.dns.no_forwarders
-        self.reverse_zones = self.dns.reverse_zones
-        self.no_reverse = self.dns.no_reverse
-        self.auto_reverse = self.dns.auto_reverse
-        self.allow_zone_overlap = self.dns.allow_zone_overlap
-        self.no_dnssec_validation = self.dns.no_dnssec_validation
-        self.dnssec_master = self.dns.dnssec_master
-        self.disable_dnssec_master = self.dns.disable_dnssec_master
-        self.kasp_db_file = self.dns.kasp_db_file
-        self.force = self.dns.force
-        self.zonemgr = self.dns.zonemgr
-
         self.unattended = not self.interactive
 
     ca = core.Component(BaseServerCA)
-- 
2.5.0

From 651379db646b8db07569e5270d04f2c12bc2215c Mon Sep 17 00:00:00 2001
From: David Kupka <dku...@redhat.com>
Date: Wed, 16 Dec 2015 12:45:24 +0000
Subject: [PATCH 2/2] installer: Fix logic of reading option values from cache.

Only options explicitly set must be stored before installer exits first step
of external CA setup. When installer continues all stored option values must
be restored.

https://fedorahosted.org/freeipa/ticket/5556
---
 ipaserver/install/server/install.py | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/ipaserver/install/server/install.py b/ipaserver/install/server/install.py
index 7bd8994f9074d6f3de16c1cb7e7fc46da0f8e086..5c64fab14c56f73e5dc603b1e0053119b9ba20db 100644
--- a/ipaserver/install/server/install.py
+++ b/ipaserver/install/server/install.py
@@ -337,9 +337,7 @@ def install_check(installer):
             sys.exit("Directory Manager password required")
         try:
             cache_vars = read_cache(dm_password)
-            for name, value in cache_vars.iteritems():
-                if name not in options.__dict__:
-                    options.__dict__[name] = value
+            options.__dict__.update(cache_vars)
             if cache_vars.get('external_ca', False):
                 options.external_ca = False
                 options.interactive = False
@@ -761,7 +759,8 @@ def install(installer):
             options.host_name = host_name
             options.forwarders = dns.dns_forwarders
             options.reverse_zones = dns.reverse_zones
-            cache_vars = {n: getattr(options, n) for o, n in installer.knobs()}
+            cache_vars = {n: options.__dict__[n] for o, n in installer.knobs()
+                          if n in options.__dict__}
             write_cache(cache_vars)
 
         ca.install_step_0(False, None, options)
-- 
2.5.0

From 2aacfaaa6802f975670140b3104cfe2d46dad24f Mon Sep 17 00:00:00 2001
From: David Kupka <dku...@redhat.com>
Date: Wed, 16 Dec 2015 12:45:24 +0000
Subject: [PATCH 2/2] installer: Fix logic of reading option values from cache.

Only options explicitly set must be stored before installer exits first step
of external CA setup. When installer continues all stored option values must
be restored.

https://fedorahosted.org/freeipa/ticket/5556
---
 ipaserver/install/server/install.py | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/ipaserver/install/server/install.py b/ipaserver/install/server/install.py
index a07ca664e263a1bb49c6f5e18bc888fa66e56b55..2da1e3d04742f0fcb05470aff49a39b7850fa4b0 100644
--- a/ipaserver/install/server/install.py
+++ b/ipaserver/install/server/install.py
@@ -444,9 +444,7 @@ def install_check(installer):
             sys.exit("Directory Manager password required")
         try:
             cache_vars = read_cache(dm_password)
-            for name, value in cache_vars.items():
-                if name not in options.__dict__:
-                    options.__dict__[name] = value
+            options.__dict__.update(cache_vars)
             if cache_vars.get('external_ca', False):
                 options.external_ca = False
                 options.interactive = False
@@ -867,7 +865,8 @@ def install(installer):
             options.admin_password = admin_password
             options.host_name = host_name
             options.reverse_zones = dns.reverse_zones
-            cache_vars = {n: getattr(options, n) for o, n in installer.knobs()}
+            cache_vars = {n: options.__dict__[n] for o, n in installer.knobs()
+                          if n in options.__dict__}
             write_cache(cache_vars)
 
         ca.install_step_0(False, None, options)
-- 
2.5.0

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

Reply via email to