Pass flag to skip restart of units for certificate object

During bootup Certificate objects are created by
loading the existing certificates in the system.

At present system is restarting/reloading units
after a certificate object is created, but the
units to restart/reload might not be up yet
causing failure.

Reloading of services is required only when a new
certificate is installed/replaced onto the system.

Modified to not to reload the specified units for
the certificate objects created for existing
certificates in the system.

Change-Id: I211a8386de1a5aa0a42d11cb89945bafa6792ba4
Signed-off-by: Marri Devender Rao <devenrao@in.ibm.com>
diff --git a/certificate.cpp b/certificate.cpp
index 15f9367..3ae85a1 100644
--- a/certificate.cpp
+++ b/certificate.cpp
@@ -71,7 +71,8 @@
                          const CertificateType& type,
                          const UnitsToRestart& unit,
                          const CertInstallPath& installPath,
-                         const CertUploadPath& uploadPath) :
+                         const CertUploadPath& uploadPath,
+                         bool isSkipUnitReload) :
     CertIfaces(bus, objPath.c_str(), true),
     bus(bus), objectPath(objPath), certType(type), unitToRestart(unit),
     certInstallPath(installPath)
@@ -86,7 +87,7 @@
     typeFuncMap[SERVER] = installHelper;
     typeFuncMap[CLIENT] = installHelper;
     typeFuncMap[AUTHORITY] = [](auto filePath) {};
-    install(uploadPath);
+    install(uploadPath, isSkipUnitReload);
     this->emit_object_added();
 }
 
@@ -105,10 +106,10 @@
 
 void Certificate::replace(const std::string filePath)
 {
-    install(filePath);
+    install(filePath, false);
 }
 
-void Certificate::install(const std::string& filePath)
+void Certificate::install(const std::string& filePath, bool isSkipUnitReload)
 {
     log<level::INFO>("Certificate install ",
                      entry("FILEPATH=%s", filePath.c_str()));
@@ -258,10 +259,14 @@
                         entry("DST=%s", certInstallPath.c_str()));
         elog<InternalFailure>();
     }
-    // restart the units
-    if (!unitToRestart.empty())
+
+    if (!isSkipUnitReload)
     {
-        reloadOrReset(unitToRestart);
+        // restart the units
+        if (!unitToRestart.empty())
+        {
+            reloadOrReset(unitToRestart);
+        }
     }
 
     // Parse the certificate file and populate properties