Generate functor to read a property
Given the dbus member class for an interface and property hosted by
inventory manager, generate the getProperty functor for retrieving that
property from inventory. This ability is only supported when using the
`PropertyIs` functor to compare a property within inventory to a given
value before triggering an action.
Example yaml:
filters:
- name: propertyIs
service: xyz.openbmc_project.Inventory.Manager
path: /system/chassis
interface: xyz.openbmc_project.Inventory.Decorator.CoolingType
property: WaterCooled
value:
value: true
type: boolean
dbusMember: "sdbusplus::xyz::openbmc_project::Inventory::\
Decorator::server::CoolingType"
Generates:
make_filter(functor::propertyIs(
"/system/chassis",
"xyz.openbmc_project.Inventory.Decorator.CoolingType",
"WaterCooled",
true,
"xyz.openbmc_project.Inventory.Manager",
make_get_property<>
(
functor::getProperty<sdbusplus::xyz::openbmc_project::
Inventory::Decorator::server::CoolingType>
(
"/system/chassis",
"xyz.openbmc_project.Inventory.Decorator.CoolingType",
&sdbusplus::xyz::openbmc_project::Inventory::
Decorator::server::CoolingType::getPropertyByName,
"WaterCooled"
)
)
))
Tested:
Code generated as expected with service name given
Code generated as expected without service name given
Resolves: openbmc/phosphor-inventory-manager#1
Change-Id: I5600854a1b0b9ce3e1511d3bcd9a452d6b1107ba
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/example/events.d/match1.yaml b/example/events.d/match1.yaml
index 3763093..6246dbd 100644
--- a/example/events.d/match1.yaml
+++ b/example/events.d/match1.yaml
@@ -78,8 +78,19 @@
- name: startup event example
description: >
- Create /createme3 at startup.
+ Create /createme3 at startup if ExampleProperty1 on /changeme
+ equals changed.
type: startup
+ filters:
+ - name: propertyIs
+ path: /changeme
+ interface: xyz.openbmc_project.Example.Iface1
+ property: ExampleProperty1
+ value:
+ value: changed
+ type: string
+ dbusMember: "sdbusplus::xyz::openbmc_project::Example::\
+ server::Iface1"
actions:
- name: createObjects
objs: