-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improvements and fixes in CIM object tomof() methods
* General changes: - Added a new internal scalar_to_mof() function that generates MOF syntax for a scalar value. - Changed the MOF_INDENT variable from 4 to 3 (the general intentation level) for consistency with the formatting of the CIM Schema MOF. - Fixed an error in the internal _indent_str() function, which returned a minimum of one space even when called with indent=0. It now returns an empty string when called with indent=0. - The line break after the qualifier list generated by _makequalifiers() is now added inside of the function, avoiding the empty line created previously with an empty qualifier list. * CIMClass.tomof(): - WIP: Converted testcases to py.test and added testcases. * CIMParameter.tomof(): - Converted testcases to py.test (from CIMClassMethodToMOF) and added testcases. - Added a default value of 0 for the 'indent' argument of tomof(). * CIMQualifier.tomof(): - Added testcases (they did not exist previously). - Fixed that qualifier values were generated incorrectly. Previously, a half-baked local function valstr() was used, causing for example strings or datetime without double quotes in some cases, or "None" for "NULL". Now, the new scalar_to_mof() function is used. - Ensured there is a single space inside of parenthesis or curly braces around values. * CIMQualifierDeclaration.tomof(): - Added testcases (they did not exist previously). - Fixed that default qualifier values were generated incorrectly. Previously, atomic_to_cimxml(tocimobj(value)) was used, causing for example strings without double quotes. Now, the new scalar_to_mof() function is used. - Now generating the scope list in a defined order, consistent with qualifiers in CIM schema. - Now generating a flavor only if it is defined. A value of `None` for the corresponding attribute causes the flavor not to be generated. - Added a newline at the end of the generated MOF string (it ended without a newline, so far). Signed-off-by: Andreas Maier <maiera@de.ibm.com>
- Loading branch information
1 parent
a7c9929
commit 5bc38d2
Showing
3 changed files
with
1,354 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.