Patch attached.

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

From 0995aa1cabff511899d5de03972ed96818a1495f Mon Sep 17 00:00:00 2001
From: Martin Basti <mba...@redhat.com>
Date: Mon, 20 Jun 2016 12:35:45 +0200
Subject: [PATCH] Fix: undefined 'ipaconf' in replica promotion

ipaconf variable and target_fname variable must be extracted from try
block and used before

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

diff --git a/ipaserver/install/server/replicainstall.py b/ipaserver/install/server/replicainstall.py
index 3801f794998d904c0790a4bd5ad643792e13c1b9..38da85cd5fcd5ba3ad1555736bad5f2cacc00adf 100644
--- a/ipaserver/install/server/replicainstall.py
+++ b/ipaserver/install/server/replicainstall.py
@@ -1310,6 +1310,10 @@ def promote(installer):
     ccache = os.environ['KRB5CCNAME']
     remote_api = installer._remote_api
     conn = remote_api.Backend.ldap2
+    ipaconf = ipaclient.ipachangeconf.IPAChangeConf("IPA Replica Promote")
+    # Save client file and merge in server directives
+    target_fname = paths.IPA_DEFAULT_CONF
+    fstore.backup_file(target_fname)
     try:
         conn.connect(ccache=installer._ccache)
 
@@ -1319,10 +1323,6 @@ def promote(installer):
                 host=[unicode(api.env.host)],
             )
 
-        # Save client file and merge in server directives
-        target_fname = paths.IPA_DEFAULT_CONF
-        fstore.backup_file(target_fname)
-        ipaconf = ipaclient.ipachangeconf.IPAChangeConf("IPA Replica Promote")
         ipaconf.setOptionAssignment(" = ")
         ipaconf.setSectionNameDelimiters(("[", "]"))
 
-- 
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

Reply via email to