mapper: Add missing parent paths in ifaces-added

On an InterfacesAdded signal, a new path may have just been
created with 2 or more new path segments. For example /A/B/C/D
was just created and only /A/B exists so far.  In this case, the
current code never adds /A/B/C to the mapper, so trying to call
GetObject or GetSubTree on that path would fail.

To fix that, in the signal handler, check if all of the
parent paths are already in the interface map, and add
them if they aren't.  It will take a shortcut and just add
the three org.freedesktop.DBus interfaces Introspectable, Peer,
and Properties, instead of calling the D-Bus introspect method
since that is all it would find anyway.

A big usecase of this is the REST server, where people try to
do things like GET /xyz/openbmc_project/logging/entry/enumerate,
which will fail if no logs existed when the mapper started since
nothing explicitly created that exact path.

Resolves openbmc/openbmc#3450

Tested:  Created /xyz/openbmc_project/logging/entry/1,
when previously only /xyz/openbmc_project/logging existed.
Verify calling GetObject and GetSubTree now work on the
/xyz/openbmc_project/logging/entry path.

Change-Id: Id24f78beef9a34245d88de25a65006745fbda992
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
1 file changed
tree: 212cca4557c1c8b8f82da504839294c9004e8fde
  1. fail-monitor/
  2. libmapper/
  3. obmc/
  4. src/
  5. .clang-format
  6. .gitignore
  7. bootstrap.sh
  8. configure.ac
  9. LICENSE
  10. MAINTAINERS
  11. Makefile.am
  12. phosphor-mapper
  13. README.md
  14. setup.cfg
  15. setup.py.in
README.md

To Build

To build this package, do the following steps:

    1. ./bootstrap.sh
    2. ./configure ${CONFIGURE_FLAGS}
    3. make

To clean the repository run `./bootstrap.sh clean`.