[Release] wrt-installer_0.1.114
[framework/web/wrt-installer.git] / src / jobs / widget_uninstall / task_uninstall_ospsvc.cpp
index 187d958..20a6027 100644 (file)
@@ -41,19 +41,20 @@ TaskUninstallOspsvc::TaskUninstallOspsvc(UninstallerContext& context) :
     DPL::TaskDecl<TaskUninstallOspsvc>(this),
     m_context(context)
 {
+    AddStep(&TaskUninstallOspsvc::StartStep);
     AddStep(&TaskUninstallOspsvc::StepUninstallOspsvc);
+    AddStep(&TaskUninstallOspsvc::EndStep);
 }
 
 TaskUninstallOspsvc::~TaskUninstallOspsvc()
-{
-}
+{}
 
 void TaskUninstallOspsvc::StepUninstallOspsvc()
 {
-    LogInfo("Step : Uninstall Osp service ");
+    LogDebug("Step : Uninstall Osp service ");
 
     std::ostringstream commStr;
-    commStr << OSP_INSTALL_STR << BashUtils::escape_arg(m_context.pkgname);
+    commStr << OSP_INSTALL_STR << BashUtils::escape_arg(m_context.tzPkgid);
     LogDebug("osp uninstall command : " << commStr.str());
 
     char readBuf[MAX_BUF_SIZE];
@@ -61,24 +62,43 @@ void TaskUninstallOspsvc::StepUninstallOspsvc()
     fd = popen(commStr.str().c_str(), "r");
     if (NULL == fd) {
         LogError("Failed to uninstalltion osp service");
-        ThrowMsg(Exceptions::UninstallOspSvcFailed, "Error occurs during\
+        ThrowMsg(Exceptions::UninstallOspSvcFailed,
+                 "Error occurs during\
+                uninstall osp service");
+    }
+
+    if(fgets(readBuf, MAX_BUF_SIZE, fd) == NULL)
+    {
+        LogError("Failed to uninstalltion osp service\
+                        Inability of reading file.");
+        ThrowMsg(Exceptions::UninstallOspSvcFailed,
+                "Error occurs during\
                 uninstall osp service");
     }
-    fgets( readBuf, MAX_BUF_SIZE, fd);
     LogDebug("return value : " << readBuf);
 
     int result = atoi(readBuf);
     if (0 != result) {
-        ThrowMsg(Exceptions::UninstallOspSvcFailed, "Error occurs during\
+        ThrowMsg(Exceptions::UninstallOspSvcFailed,
+                 "Error occurs during\
                 install osp service");
     }
 
     pclose(fd);
-    
-    LogInfo("Widget Can be uninstalled. Pkgname : " << m_context.pkgname);
+
+    LogDebug("Widget Can be uninstalled. Pkgname : " << m_context.tzPkgid);
     m_context.job->UpdateProgress(UninstallerContext::UNINSTALL_REMOVE_OSPSVC,
                                   "Uninstall OSP service finished");
 }
 
+void TaskUninstallOspsvc::StartStep()
+{
+    LogDebug("--------- <TaskUninstallOspsvc> : START ----------");
+}
+
+void TaskUninstallOspsvc::EndStep()
+{
+    LogDebug("--------- <TaskUninstallOspsvc> : END ----------");
+}
 } //namespace WidgetUninstall
 } //namespace Jobs