summaryrefslogtreecommitdiffstats
path: root/meta-phosphor/classes/phosphor-mapper.bbclass
blob: 29107638638c0953e258723b0969a83b2f4e24ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# 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
inherit obmc-phosphor-utils

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.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