URL: https://github.com/freeipa/freeipa/pull/1428
Author: felipevolpone
 Title: #1428: Check if replication exist before enable it
Action: opened

PR body:
"""
If the replication does not exist a custom exception is raised explaining the 
problem.

Fixes: #7201
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/1428/head:pr1428
git checkout pr1428
From 012592b67a55534bbd155f1a8436ad6d2aa7b404 Mon Sep 17 00:00:00 2001
From: Felipe Barreto <fbarr...@redhat.com>
Date: Tue, 2 Jan 2018 21:40:49 -0200
Subject: [PATCH] Check if replication exists before enable it

If the replication does not exists a custom exception
is raised explaining the problem.

Fixes: #7201
---
 ipaserver/install/replication.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/ipaserver/install/replication.py b/ipaserver/install/replication.py
index 8aae90c0a9..6d13c3bf06 100644
--- a/ipaserver/install/replication.py
+++ b/ipaserver/install/replication.py
@@ -1561,6 +1561,9 @@ def enable_agreement(self, hostname):
         Note: for replication to work it needs to be enabled both ways.
         """
         entry = self.get_replication_agreement(hostname)
+        if not entry:
+            raise errors.NotFound(
+                reason="Replication agreement for %s not found" % hostname)
         entry['nsds5ReplicaEnabled'] = 'on'
 
         try:
_______________________________________________
FreeIPA-devel mailing list -- freeipa-devel@lists.fedorahosted.org
To unsubscribe send an email to freeipa-devel-le...@lists.fedorahosted.org

Reply via email to