Brad Bishop | 2ad7ce3 | 2017-07-09 23:41:49 -0400 | [diff] [blame] | 1 | # 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 |
| 10 | # watch xyz.openbmc_project interfaces and paths only. This |
| 11 | # configuration file is intended to be inherited by |
| 12 | # native recipes in other layers that wish to add namespaces |
| 13 | # or interfaces to the mapper watchlist. |
| 14 | |
| 15 | # Add path namespaces to be monitored: |
| 16 | # PHOSPHOR_MAPPER_NAMESPACE_append = " /foo/bar" |
| 17 | |
| 18 | # Add interfaces to be monitored: |
| 19 | # PHOSPHOR_MAPPER_INTERFACE_append = " foo.bar" |
| 20 | |
| 21 | # Blacklist paths from being monitored: |
| 22 | # PHOSPHOR_MAPPER_NAMESPACE_BLACKLIST_append = " /foo/bar/baz" |
| 23 | |
| 24 | # Blacklist interfaces from being monitored: |
| 25 | # PHOSPHOR_MAPPER_INTERFACE_BLACKLIST_append = " foo.bar.baz" |
| 26 | |
| 27 | inherit phosphor-mapperdir |
| 28 | |
| 29 | python phosphor_mapper_do_postinst() { |
| 30 | def process_var(d, var, dir): |
| 31 | for p in listvar_to_list(d, var): |
| 32 | parent = d.getVar('D', True) + d.getVar(dir, True) |
| 33 | if not os.path.exists(parent): |
| 34 | os.makedirs(parent) |
| 35 | path = os.path.join( |
| 36 | parent, |
Brad Bishop | 9b3beee | 2017-08-03 15:56:09 -0400 | [diff] [blame] | 37 | '-'.join(p.split(os.sep))) |
Brad Bishop | 2ad7ce3 | 2017-07-09 23:41:49 -0400 | [diff] [blame] | 38 | with open(path, 'w+') as fd: |
| 39 | pass |
| 40 | |
| 41 | process_var(d, 'PHOSPHOR_MAPPER_NAMESPACE', 'namespace_dir') |
| 42 | process_var(d, 'PHOSPHOR_MAPPER_INTERFACE', 'interface_dir') |
| 43 | process_var(d, 'PHOSPHOR_MAPPER_NAMESPACE_BLACKLIST', 'blacklist_dir') |
| 44 | process_var( |
| 45 | d, 'PHOSPHOR_MAPPER_INTERFACE_BLACKLIST', 'interfaceblacklist_dir') |
| 46 | } |
| 47 | |
| 48 | do_install[vardeps] += "PHOSPHOR_MAPPER_NAMESPACE" |
| 49 | do_install[vardeps] += "PHOSPHOR_MAPPER_INTERFACE" |
| 50 | do_install[vardeps] += "PHOSPHOR_MAPPER_NAMESPACE_BLACKLIST" |
| 51 | do_install[vardeps] += "PHOSPHOR_MAPPER_INTERFACE_BLACKLIST" |
| 52 | do_install[postfuncs] += "phosphor_mapper_do_postinst" |