summaryrefslogtreecommitdiffstats
path: root/phosphor-ldap-config/main.cpp
diff options
context:
space:
mode:
authorNagaraju Goruganti <ngorugan@in.ibm.com>2018-11-08 03:07:25 -0600
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2018-11-19 21:37:57 -0500
commitd514e5dc3de8dcd305328783ae11ee8e56b27d9a (patch)
tree5b19fa0d8f6a34ded5cfa5576b3f27dba84dd687 /phosphor-ldap-config/main.cpp
parent3e7a72eaaca9819f28e48fbf676bf67eb408287d (diff)
downloadphosphor-user-manager-d514e5dc3de8dcd305328783ae11ee8e56b27d9a.tar.gz
phosphor-user-manager-d514e5dc3de8dcd305328783ae11ee8e56b27d9a.zip
phosphor-ldap-conf: add unit tests
Added uinit tests to create and to restore config file. Change-Id: Idf5231d46542cda1ff84241aa67aadd91a4788d6 Signed-off-by: Nagaraju Goruganti <ngorugan@in.ibm.com> Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com> Signed-off-by: Nagaraju Goruganti <ngorugan@in.ibm.com>
Diffstat (limited to 'phosphor-ldap-config/main.cpp')
-rw-r--r--phosphor-ldap-config/main.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/phosphor-ldap-config/main.cpp b/phosphor-ldap-config/main.cpp
index 6bba619..e285786 100644
--- a/phosphor-ldap-config/main.cpp
+++ b/phosphor-ldap-config/main.cpp
@@ -11,11 +11,12 @@ int main(int argc, char* argv[])
using namespace phosphor::logging;
using namespace sdbusplus::xyz::openbmc_project::Common::Error;
namespace fs = std::experimental::filesystem;
+ fs::path configDir = fs::path(LDAP_CONFIG_FILE).parent_path();
- if (!fs::exists(phosphor::ldap::defaultNslcdFile) ||
- !fs::exists(phosphor::ldap::nsSwitchFile) ||
- (!fs::exists(phosphor::ldap::LDAPNsSwitchFile) &&
- !fs::exists(phosphor::ldap::linuxNsSwitchFile)))
+ if (!fs::exists(configDir / phosphor::ldap::defaultNslcdFile) ||
+ !fs::exists(configDir / phosphor::ldap::nsSwitchFile) ||
+ (!fs::exists(configDir / phosphor::ldap::LDAPNsSwitchFile) &&
+ !fs::exists(configDir / phosphor::ldap::linuxNsSwitchFile)))
{
log<level::ERR>("Error starting LDAP Config App, configfile(s) are "
"missing, exiting!!!");
@@ -26,7 +27,7 @@ int main(int argc, char* argv[])
// Add sdbusplus ObjectManager for the 'root' path of the LDAP config.
sdbusplus::server::manager::manager objManager(bus, LDAP_CONFIG_ROOT);
- phosphor::ldap::ConfigMgr mgr(bus, LDAP_CONFIG_ROOT);
+ phosphor::ldap::ConfigMgr mgr(bus, LDAP_CONFIG_ROOT, LDAP_CONFIG_FILE);
bus.request_name(LDAP_CONFIG_BUSNAME);
OpenPOWER on IntegriCloud