New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New api to read and check specific label in context of the given file #2197
Conversation
Currently there are only methods to get and set the context of the given file. There are usecases to check for specific labels in the context of the file. This commit introduces new method to do the same. Signed-off-by: Srikanth Aithal <sraithal@linux.vnet.ibm.com>
4c252aa
to
629eb19
Compare
test results of case when context of filename is returned empty:
|
@xutian thanks for reviewing. I have updated right version here. Results are as well posted @ autotest/tp-libvirt#2279 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me,
logging.debug("Context of shared filename '%s' is '%s'" % | ||
(filename, se_label)) | ||
if label not in se_label: | ||
return False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return label not in se_label
else: | ||
logging.warning("Context of shared filename '%s' is None" % filename) | ||
return False | ||
return True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return bool(se_label)
Let's merge this, we can take minor changes as separate PR. |
Currently there are only methods to get and set the context of the
given file. There are usecases to check for specific labels in the
context of the file. This commit introduces new method to do the same.
Signed-off-by: Srikanth Aithal sraithal@linux.vnet.ibm.com