versioncheck¶
Package with utilities for checking availability of profiles or CIM classes. Version requirements can also be specified.
- lmi.scripts.common.versioncheck.cmp_profiles(fst, snd)[source]¶
Compare two profiles by their version.
Returns: - -1 if the fst profile has lower version than snd
- 0 if their versions are equal
- 1 otherwise
Return type: int
- lmi.scripts.common.versioncheck.eval_respl(expr, conn, namespace=None, cache=None)[source]¶
Evaluate LMIReSpL expression on particular broker.
Parameters: - expr (string) – Expression to evaluate.
- conn – Connection object.
- namespace (string) – Optional CIM namespace where CIM classes will be searched.
- cache (dictionary) – Optional cache speeding up evaluation.
Returns: True if requirements in expression are satisfied.
Return type: boolean
- lmi.scripts.common.versioncheck.get_class_version(conn, name, namespace=None, cache=None)[source]¶
Query broker for version of particular CIM class. Version is stored in Version qualifier of particular CIM class.
Parameters: - conn – Connection object.
- name (string) – Name of class to query.
- namespace (string) – Optional CIM namespace. Defaults to configured namespace.
- cache (dictionary) – Optional cache used to speed up expression prrocessing.
Returns: Version of CIM matching class. Empty string if class is registered but is missing Version qualifier and None if it is not registered.
Return type: string
- lmi.scripts.common.versioncheck.get_profile_version(conn, name, cache=None)[source]¶
Get version of registered profile on particular broker. Queries CIM_RegisteredProfile and CIM_RegisteredSubProfile. The latter comes in question only when CIM_RegisteredProfile does not yield any matching result.
Parameters: - conn – Connection object.
- name (string) – Name of the profile which must match value of RegisteredName property.
- cache (dictionary) – Optional cache where the result will be stored for later use. This greatly speeds up evaluation of several expressions refering to same profiles or classes.
Returns: Version of matching profile found. If there were more of them, the highest version will be returned. None will be returned when no matching profile or subprofile is found.
Return type: string