blob: 1ee95d773512f10f589977ad2c012c5a32fdce17 [file] [log] [blame]
Brad Bishop2ad7ce32017-07-09 23:41:49 -04001# Common code for recipes that modify the phosphor-mapper
2# configuration.
3#
4# Typically it is not desired to monitor all dbus traffic
5# on a system and as such, the phosphor-mapper has command
6# line options to control what path namespaces and dbus
7# interfaces it will keep track of.
8#
9# The Phosphor layer by default configures the mapper to
Brad Bishop711ae0e2018-10-22 22:52:33 -040010# watch xyz.openbmc_project services and interfaces only.
11# This configuration file is intended to be inherited by
12# native recipes in other layers that wish to add namespaces
Brad Bishop2ad7ce32017-07-09 23:41:49 -040013# or interfaces to the mapper watchlist.
14
Brad Bishop4f045d02018-10-22 20:48:49 -040015# Add service namespaces to be monitored:
Patrick Williams12fc9392021-08-06 09:16:53 -050016# PHOSPHOR_MAPPER_SERVICE:append = " foo.bar"
Brad Bishop4f045d02018-10-22 20:48:49 -040017
Brad Bishop2ad7ce32017-07-09 23:41:49 -040018# Add interfaces to be monitored:
Patrick Williams12fc9392021-08-06 09:16:53 -050019# PHOSPHOR_MAPPER_INTERFACE:append = " foo.bar"
Brad Bishop2ad7ce32017-07-09 23:41:49 -040020
Brad Bishop4f045d02018-10-22 20:48:49 -040021# Blacklist services from being monitored:
Patrick Williams12fc9392021-08-06 09:16:53 -050022# PHOSPHOR_MAPPER_SERVICE_BLACKLIST:append = " foo.bar"
Brad Bishop4f045d02018-10-22 20:48:49 -040023
Brad Bishop2ad7ce32017-07-09 23:41:49 -040024inherit phosphor-mapperdir
Brad Bishop02f9a522018-03-09 16:51:57 -050025inherit obmc-phosphor-utils
Brad Bishop2ad7ce32017-07-09 23:41:49 -040026
27python phosphor_mapper_do_postinst() {
28 def process_var(d, var, dir):
29 for p in listvar_to_list(d, var):
30 parent = d.getVar('D', True) + d.getVar(dir, True)
31 if not os.path.exists(parent):
32 os.makedirs(parent)
33 path = os.path.join(
34 parent,
Brad Bishop9b3beee2017-08-03 15:56:09 -040035 '-'.join(p.split(os.sep)))
Brad Bishop2ad7ce32017-07-09 23:41:49 -040036 with open(path, 'w+') as fd:
37 pass
38
Brad Bishop4f045d02018-10-22 20:48:49 -040039 process_var(d, 'PHOSPHOR_MAPPER_SERVICE', 'service_dir')
Brad Bishop2ad7ce32017-07-09 23:41:49 -040040 process_var(d, 'PHOSPHOR_MAPPER_INTERFACE', 'interface_dir')
Brad Bishop4f045d02018-10-22 20:48:49 -040041 process_var(d, 'PHOSPHOR_MAPPER_SERVICE_BLACKLIST', 'serviceblacklist_dir')
Brad Bishop2ad7ce32017-07-09 23:41:49 -040042}
43
Brad Bishop4f045d02018-10-22 20:48:49 -040044do_install[vardeps] += "PHOSPHOR_MAPPER_SERVICE"
Brad Bishop2ad7ce32017-07-09 23:41:49 -040045do_install[vardeps] += "PHOSPHOR_MAPPER_INTERFACE"
Brad Bishop4f045d02018-10-22 20:48:49 -040046do_install[vardeps] += "PHOSPHOR_MAPPER_SERVICE_BLACKLIST"
Brad Bishop2ad7ce32017-07-09 23:41:49 -040047do_install[postfuncs] += "phosphor_mapper_do_postinst"