Change in mom[master]: Add valid function to the policy parser

alitke at redhat.com alitke at redhat.com
Wed Nov 12 17:37:39 UTC 2014


Adam Litke has submitted this change and it was merged.

Change subject: Add valid function to the policy parser
......................................................................


Add valid function to the policy parser

This new valid function accepts any number of arguments and returns
True when none of the arguments evaluates to nil (None). It returns
False in all other cases.

The Common Lisp way of doing this is by using higher order functions
like this:

(every #'null my-list)

Our parser lacks support for such constructs so I decided to add
the new function.

This will allow us to escape parts of the policy with checks for
the presence of optional collector fields.

For example:

(if (valid guest.balloon_min guest.balloon_cur) (process_ballooning))

Change-Id: I5aa31886811593860c75cf13bf7743e85fde7358
Related-To: https://bugzilla.redhat.com/1143992
Signed-off-by: Martin Sivak <msivak at redhat.com>
Reviewed-on: http://gerrit.ovirt.org/34791
Reviewed-by: Adam Litke <alitke at redhat.com>
---
M mom/Policy/Parser.py
M tests/ParserTests.py
2 files changed, 60 insertions(+), 1 deletion(-)

Approvals:
  Adam Litke: Looks good to me, approved
  Martin Sivák: Verified



-- 
To view, visit http://gerrit.ovirt.org/34791
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I5aa31886811593860c75cf13bf7743e85fde7358
Gerrit-PatchSet: 5
Gerrit-Project: mom
Gerrit-Branch: master
Gerrit-Owner: Martin Sivák <msivak at redhat.com>
Gerrit-Reviewer: Adam Litke <alitke at redhat.com>
Gerrit-Reviewer: Martin Sivák <msivak at redhat.com>
Gerrit-Reviewer: Roy Golan <rgolan at redhat.com>
Gerrit-Reviewer: automation at ovirt.org



More information about the Engine-commits mailing list