PEL: Fix possible D-Bus race condition

In a few places in the code, a D-Bus property read was being done before
adding the watch for the interfacesAdded signal.  This opens the (very
small) window that the interfacesAdded signal would fire after the
property read and before the match object was created, leading to the
property never being successfully read.

Change the order of this code to add the interfacesAdded match object
before doing the property read to close this window.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I80b11e743925143de183df98dca4ccafdc987d55
diff --git a/extensions/openpower-pels/dbus_watcher.hpp b/extensions/openpower-pels/dbus_watcher.hpp
index b511e0c..c674abb 100644
--- a/extensions/openpower-pels/dbus_watcher.hpp
+++ b/extensions/openpower-pels/dbus_watcher.hpp
@@ -105,15 +105,6 @@
         DBusWatcher(path, interface),
         _name(propertyName), _setFunc(func)
     {
-        try
-        {
-            read(dataIface, service);
-        }
-        catch (const SdBusError& e)
-        {
-            // Path doesn't exist now
-        }
-
         _matches.emplace_back(
             bus, match_rules::propertiesChanged(_path, _interface),
             std::bind(std::mem_fn(&PropertyWatcher::propChanged), this,
@@ -124,6 +115,15 @@
             match_rules::interfacesAdded() + match_rules::argNpath(0, _path),
             std::bind(std::mem_fn(&PropertyWatcher::interfaceAdded), this,
                       std::placeholders::_1));
+
+        try
+        {
+            read(dataIface, service);
+        }
+        catch (const SdBusError& e)
+        {
+            // Path doesn't exist now
+        }
     }
 
     /**
@@ -285,15 +285,6 @@
         DBusWatcher(path, interface),
         _setFunc(func)
     {
-        try
-        {
-            read(dataIface);
-        }
-        catch (const SdBusError& e)
-        {
-            // Path doesn't exist now
-        }
-
         _matches.emplace_back(
             bus, match_rules::propertiesChanged(_path, _interface),
             std::bind(std::mem_fn(&InterfaceWatcher::propChanged), this,
@@ -304,6 +295,15 @@
             match_rules::interfacesAdded() + match_rules::argNpath(0, _path),
             std::bind(std::mem_fn(&InterfaceWatcher::interfaceAdded), this,
                       std::placeholders::_1));
+
+        try
+        {
+            read(dataIface);
+        }
+        catch (const SdBusError& e)
+        {
+            // Path doesn't exist now
+        }
     }
 
     /**