[Systeminfo] Return partial results for STORAGE if dbus fail 32/79932/2
authorPiotr Kosko <p.kosko@samsung.com>
Wed, 13 Jul 2016 12:21:11 +0000 (14:21 +0200)
committerPiotr Kosko <p.kosko@samsung.com>
Wed, 13 Jul 2016 12:36:10 +0000 (14:36 +0200)
[Feature] If dbus call failed, results was empty. Now returned array
  will hold as much data as it is possible, internal storage information would be
  returned. DBUS fails would be silent.

[Verification] Code compiles without errors.
  TCT passrate is 100%.

Change-Id: I65a98a95ab69416af5c61737eb93f98a7d7c3625
Signed-off-by: Piotr Kosko <p.kosko@samsung.com>
src/common/filesystem/filesystem_provider_deviced.cc

index 81bb570..3c22667 100644 (file)
@@ -231,6 +231,11 @@ Storages FilesystemProviderDeviced::GetStorages() {
     return Storages();
   }
 
+  // internal storages are gathered with storage api
+  Storages internal = virtual_roots_provider_.GetStorages();
+
+  // external storages are gathered using deviced implementation
+  Storages result;
   GError* error = nullptr;
   GVariant* variant = g_dbus_connection_call_sync(dbus_,
                                                   kBus,
@@ -246,12 +251,10 @@ Storages FilesystemProviderDeviced::GetStorages() {
   if (!variant || error) {
     std::string message = error ? error->message : "";
     LoggerE("Failed to call GetDeviceList method - %s", message.c_str());
-    return Storages();
+  } else {
+    LoggerD("GetDeviceList succeed - handling result");
+    result = GetStoragesFromGVariant(variant);
   }
-  // internal storages are gathered with storage api
-  Storages internal = virtual_roots_provider_.GetStorages();
-  // external storages are gathered using deviced implementation
-  Storages result = GetStoragesFromGVariant(variant);
 
   // merging internal and external results together, but internal on the beginning
   result.insert(result.begin(), internal.begin(), internal.end());