summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Spinler <spinler@us.ibm.com>2017-11-01 10:48:02 -0500
committerMatt Spinler <spinler@us.ibm.com>2017-11-14 11:14:53 -0600
commit1d6ca484ee58c9ab44b4efc66c5b7dfc89b0c2f1 (patch)
treedf06b6ead4b55d080ada945577c05de73e5a6dca
parentf55c1eed445c28d3e666223cecbcde759b0cfb0e (diff)
downloadphosphor-dbus-monitor-1d6ca484ee58c9ab44b4efc66c5b7dfc89b0c2f1.zip
phosphor-dbus-monitor-1d6ca484ee58c9ab44b4efc66c5b7dfc89b0c2f1.tar.gz
Add resolve callout rule support to YAML parser
The callout to resolve is specified in the YAML. Change-Id: If613fae1959c6a54279b2a50c7d858f3e7d831b9 Signed-off-by: Matt Spinler <spinler@us.ibm.com>
-rw-r--r--src/Makefile.am3
-rwxr-xr-xsrc/pdmgen.py16
-rw-r--r--src/templates/generated.mako.hpp1
-rw-r--r--src/templates/resolve_errors.mako.cpp1
4 files changed, 20 insertions, 1 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 29a4ba7..c20b9dd 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -31,7 +31,8 @@ TEMPLATES = \
templates/journal.mako.cpp \
templates/elog.mako.cpp \
templates/errors.mako.hpp \
- templates/method.mako.cpp
+ templates/method.mako.cpp \
+ templates/resolve_errors.mako.cpp
generated.hpp: $(PDMGEN) $(YAML_PATH) $(TEMPLATES)
$(AM_V_GEN)$(PYTHON) ${PDMGEN} \
diff --git a/src/pdmgen.py b/src/pdmgen.py
index 693b149..9ed27cd 100755
--- a/src/pdmgen.py
+++ b/src/pdmgen.py
@@ -699,6 +699,21 @@ class Elog(Callback, Renderer):
indent=indent)
+class ResolveCallout(Callback, Renderer):
+ '''Handle the 'resolve callout' callback config file directive.'''
+
+ def __init__(self, *a, **kw):
+ self.callout = kw.pop('callout')
+ super(ResolveCallout, self).__init__(**kw)
+
+ def construct(self, loader, indent):
+ return self.render(
+ loader,
+ 'resolve_errors.mako.cpp',
+ c=self,
+ indent=indent)
+
+
class Method(ConfigEntry, Renderer):
'''Handle the method callback config file directive.'''
@@ -869,6 +884,7 @@ class Everything(Renderer):
'elog': Elog,
'group': GroupOfCallbacks,
'method': Method,
+ 'resolve callout': ResolveCallout,
},
'condition': {
'count': CountCondition,
diff --git a/src/templates/generated.mako.hpp b/src/templates/generated.mako.hpp
index 04f2bde..740acfa 100644
--- a/src/templates/generated.mako.hpp
+++ b/src/templates/generated.mako.hpp
@@ -12,6 +12,7 @@
#include "errors.hpp"
#include "method.hpp"
#include "propertywatchimpl.hpp"
+#include "resolve_errors.hpp"
#include "sdbusplus.hpp"
#include "sdevent.hpp"
diff --git a/src/templates/resolve_errors.mako.cpp b/src/templates/resolve_errors.mako.cpp
new file mode 100644
index 0000000..8b49031
--- /dev/null
+++ b/src/templates/resolve_errors.mako.cpp
@@ -0,0 +1 @@
+std::make_unique<ResolveCallout>("${c.callout}")\
OpenPOWER on IntegriCloud