summaryrefslogtreecommitdiffstats
path: root/meta-phosphor/classes/phosphor-mapper.bbclass
diff options
context:
space:
mode:
authorBrad Bishop <bradleyb@fuzziesquirrel.com>2017-07-09 23:41:49 -0400
committerPatrick Williams <patrick@stwcx.xyz>2017-07-18 01:05:16 +0000
commit2ad7ce334819f2f2d1e8bd06b160126b41591d07 (patch)
treebda977018f73bbbf78a87668bef46f4807ab0a5a /meta-phosphor/classes/phosphor-mapper.bbclass
parent0ead07ae105a71b1ab7140bf2ecbdcfb0e66f2c6 (diff)
downloadtalos-openbmc-2ad7ce334819f2f2d1e8bd06b160126b41591d07.tar.gz
talos-openbmc-2ad7ce334819f2f2d1e8bd06b160126b41591d07.zip
mapper: Generate an environment file
Mapper will soon consume four command line arguments that limit the scope of watched path and interface namespaces. Add tooling to generate this environment file based on a new bitbake variables. Add xyz-openbmc_project and org-openbmc by default in the Phosphor layer and other layers can add additional namespaces as needed. Change-Id: I1c03aa91b75d03652a8a8fb80737553fef224fdf Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Diffstat (limited to 'meta-phosphor/classes/phosphor-mapper.bbclass')
-rw-r--r--meta-phosphor/classes/phosphor-mapper.bbclass52
1 files changed, 52 insertions, 0 deletions
diff --git a/meta-phosphor/classes/phosphor-mapper.bbclass b/meta-phosphor/classes/phosphor-mapper.bbclass
new file mode 100644
index 000000000..26f369b14
--- /dev/null
+++ b/meta-phosphor/classes/phosphor-mapper.bbclass
@@ -0,0 +1,52 @@
+# Common code for recipes that modify the phosphor-mapper
+# configuration.
+#
+# Typically it is not desired to monitor all dbus traffic
+# on a system and as such, the phosphor-mapper has command
+# line options to control what path namespaces and dbus
+# interfaces it will keep track of.
+#
+# The Phosphor layer by default configures the mapper to
+# watch xyz.openbmc_project interfaces and paths only. This
+# configuration file is intended to be inherited by
+# native recipes in other layers that wish to add namespaces
+# or interfaces to the mapper watchlist.
+
+# Add path namespaces to be monitored:
+# PHOSPHOR_MAPPER_NAMESPACE_append = " /foo/bar"
+
+# Add interfaces to be monitored:
+# PHOSPHOR_MAPPER_INTERFACE_append = " foo.bar"
+
+# Blacklist paths from being monitored:
+# PHOSPHOR_MAPPER_NAMESPACE_BLACKLIST_append = " /foo/bar/baz"
+
+# Blacklist interfaces from being monitored:
+# PHOSPHOR_MAPPER_INTERFACE_BLACKLIST_append = " foo.bar.baz"
+
+inherit phosphor-mapperdir
+
+python phosphor_mapper_do_postinst() {
+ def process_var(d, var, dir):
+ for p in listvar_to_list(d, var):
+ parent = d.getVar('D', True) + d.getVar(dir, True)
+ if not os.path.exists(parent):
+ os.makedirs(parent)
+ path = os.path.join(
+ parent,
+ '-'.join(p[1:].split(os.sep)))
+ with open(path, 'w+') as fd:
+ pass
+
+ process_var(d, 'PHOSPHOR_MAPPER_NAMESPACE', 'namespace_dir')
+ process_var(d, 'PHOSPHOR_MAPPER_INTERFACE', 'interface_dir')
+ process_var(d, 'PHOSPHOR_MAPPER_NAMESPACE_BLACKLIST', 'blacklist_dir')
+ process_var(
+ d, 'PHOSPHOR_MAPPER_INTERFACE_BLACKLIST', 'interfaceblacklist_dir')
+}
+
+do_install[vardeps] += "PHOSPHOR_MAPPER_NAMESPACE"
+do_install[vardeps] += "PHOSPHOR_MAPPER_INTERFACE"
+do_install[vardeps] += "PHOSPHOR_MAPPER_NAMESPACE_BLACKLIST"
+do_install[vardeps] += "PHOSPHOR_MAPPER_INTERFACE_BLACKLIST"
+do_install[postfuncs] += "phosphor_mapper_do_postinst"
OpenPOWER on IntegriCloud