URL: https://github.com/freeipa/freeipa/pull/180
Author: tiran
 Title: #180: Make api.env.nss_dir relative to api.env.confdir
Action: opened

PR body:
"""
api.env.nss_dir is no longer hard-coded to paths.IPA_NSSDB_DIR. Instead
the path is calculated relatively to api.env.confdir. The default value
is still /etc/ipa/nssdb. The change makes it a bit easier to run
FreeIPA's API with a custom configuration directory.

See https://fedorahosted.org/freeipa/ticket/6386

Signed-off-by: Christian Heimes <chei...@redhat.com>
"""

To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/180/head:pr180
git checkout pr180
From 0896691f12a4a9393ad87b35d38d42dc44be7cb1 Mon Sep 17 00:00:00 2001
From: Christian Heimes <chei...@redhat.com>
Date: Mon, 24 Oct 2016 09:39:49 +0200
Subject: [PATCH] Make api.env.nss_dir relative to api.env.confdir

api.env.nss_dir is no longer hard-coded to paths.IPA_NSSDB_DIR. Instead
the path is calculated relatively to api.env.confdir. The default value
is still /etc/ipa/nssdb. The change makes it a bit easier to run
FreeIPA's API with a custom configuration directory.

See https://fedorahosted.org/freeipa/ticket/6386

Signed-off-by: Christian Heimes <chei...@redhat.com>
---
 ipalib/config.py    | 3 +++
 ipalib/constants.py | 3 +--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/ipalib/config.py b/ipalib/config.py
index a273e3d..3046e75 100644
--- a/ipalib/config.py
+++ b/ipalib/config.py
@@ -472,6 +472,9 @@ def _bootstrap(self, **overrides):
         if 'conf_default' not in self:
             self.conf_default = self._join('confdir', 'default.conf')
 
+        if 'nss_dir' not in self:
+            self.nss_dir = self._join('confdir', 'nssdb')
+
         # Set plugins_on_demand:
         if 'plugins_on_demand' not in self:
             self.plugins_on_demand = (self.context == 'cli')
diff --git a/ipalib/constants.py b/ipalib/constants.py
index c423117..7328c28 100644
--- a/ipalib/constants.py
+++ b/ipalib/constants.py
@@ -133,8 +133,6 @@
 
     ('rpc_protocol', 'jsonrpc'),
 
-    ('nss_dir', paths.IPA_NSSDB_DIR),
-
     # Define an inclusive range of SSL/TLS version support
     ('tls_version_min', 'tls1.0'),
     ('tls_version_max', 'tls1.2'),
@@ -229,6 +227,7 @@
     ('conf', object),  # File containing context specific config
     ('conf_default', object),  # File containing context independent config
     ('plugins_on_demand', object),  # Whether to finalize plugins on-demand (bool)
+    ('nss_dir', object),  # Path to nssdb, default {confdir}/nssdb
 
     # Set in Env._finalize_core():
     ('in_server', object),  # Whether or not running in-server (bool)
-- 
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