| 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 | 
| Brad Bishop | 711ae0e | 2018-10-22 22:52:33 -0400 | [diff] [blame] | 10 | # 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 Bishop | 2ad7ce3 | 2017-07-09 23:41:49 -0400 | [diff] [blame] | 13 | # or interfaces to the mapper watchlist. | 
|  | 14 |  | 
| Brad Bishop | 4f045d0 | 2018-10-22 20:48:49 -0400 | [diff] [blame] | 15 | # Add service namespaces to be monitored: | 
|  | 16 | # PHOSPHOR_MAPPER_SERVICE_append = " foo.bar" | 
|  | 17 |  | 
| Brad Bishop | 2ad7ce3 | 2017-07-09 23:41:49 -0400 | [diff] [blame] | 18 | # Add interfaces to be monitored: | 
|  | 19 | # PHOSPHOR_MAPPER_INTERFACE_append = " foo.bar" | 
|  | 20 |  | 
| Brad Bishop | 4f045d0 | 2018-10-22 20:48:49 -0400 | [diff] [blame] | 21 | # Blacklist services from being monitored: | 
|  | 22 | # PHOSPHOR_MAPPER_SERVICE_BLACKLIST_append = " foo.bar" | 
|  | 23 |  | 
| Brad Bishop | 2ad7ce3 | 2017-07-09 23:41:49 -0400 | [diff] [blame] | 24 | inherit phosphor-mapperdir | 
| Brad Bishop | 02f9a52 | 2018-03-09 16:51:57 -0500 | [diff] [blame] | 25 | inherit obmc-phosphor-utils | 
| Brad Bishop | 2ad7ce3 | 2017-07-09 23:41:49 -0400 | [diff] [blame] | 26 |  | 
|  | 27 | python 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 Bishop | 9b3beee | 2017-08-03 15:56:09 -0400 | [diff] [blame] | 35 | '-'.join(p.split(os.sep))) | 
| Brad Bishop | 2ad7ce3 | 2017-07-09 23:41:49 -0400 | [diff] [blame] | 36 | with open(path, 'w+') as fd: | 
|  | 37 | pass | 
|  | 38 |  | 
| Brad Bishop | 4f045d0 | 2018-10-22 20:48:49 -0400 | [diff] [blame] | 39 | process_var(d, 'PHOSPHOR_MAPPER_SERVICE', 'service_dir') | 
| Brad Bishop | 2ad7ce3 | 2017-07-09 23:41:49 -0400 | [diff] [blame] | 40 | process_var(d, 'PHOSPHOR_MAPPER_INTERFACE', 'interface_dir') | 
| Brad Bishop | 4f045d0 | 2018-10-22 20:48:49 -0400 | [diff] [blame] | 41 | process_var(d, 'PHOSPHOR_MAPPER_SERVICE_BLACKLIST', 'serviceblacklist_dir') | 
| Brad Bishop | 2ad7ce3 | 2017-07-09 23:41:49 -0400 | [diff] [blame] | 42 | } | 
|  | 43 |  | 
| Brad Bishop | 4f045d0 | 2018-10-22 20:48:49 -0400 | [diff] [blame] | 44 | do_install[vardeps] += "PHOSPHOR_MAPPER_SERVICE" | 
| Brad Bishop | 2ad7ce3 | 2017-07-09 23:41:49 -0400 | [diff] [blame] | 45 | do_install[vardeps] += "PHOSPHOR_MAPPER_INTERFACE" | 
| Brad Bishop | 4f045d0 | 2018-10-22 20:48:49 -0400 | [diff] [blame] | 46 | do_install[vardeps] += "PHOSPHOR_MAPPER_SERVICE_BLACKLIST" | 
| Brad Bishop | 2ad7ce3 | 2017-07-09 23:41:49 -0400 | [diff] [blame] | 47 | do_install[postfuncs] += "phosphor_mapper_do_postinst" |