diff options
author | Michal Minar <miminar@redhat.com> | 2014-02-26 14:38:50 +0100 |
---|---|---|
committer | Michal Minar <miminar@redhat.com> | 2014-02-26 14:38:50 +0100 |
commit | d5ac1e691373fd9e0df607739380c3b1b3224564 (patch) | |
tree | 5be0865fad5f4ea251f03efc5c03230af630581e /commands | |
parent | e29c72de5a461b208e06ef34d4e1143a717c9703 (diff) | |
parent | e43345d191426c266b8049bc616b57ea70cdb4c7 (diff) | |
download | openlmi-scripts-d5ac1e691373fd9e0df607739380c3b1b3224564.tar.gz openlmi-scripts-d5ac1e691373fd9e0df607739380c3b1b3224564.tar.xz openlmi-scripts-d5ac1e691373fd9e0df607739380c3b1b3224564.zip |
Merge pull request #64 from pschiffe/master
System: added OS info
Diffstat (limited to 'commands')
-rw-r--r-- | commands/system/lmi/scripts/system/__init__.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/commands/system/lmi/scripts/system/__init__.py b/commands/system/lmi/scripts/system/__init__.py index bdec7c8..c3e6d3f 100644 --- a/commands/system/lmi/scripts/system/__init__.py +++ b/commands/system/lmi/scripts/system/__init__.py @@ -106,6 +106,7 @@ def get_system_info(ns): """ result = get_hostname(ns) result += get_hwinfo(ns) + result += get_osinfo(ns) return result def get_hostname(ns): @@ -154,3 +155,25 @@ def get_hwinfo(ns): ('Processors:', cpus_str), ('Memory:', memory_size)] return result + +def get_osinfo(ns): + """ + :returns: Tabular data of system OS info. + :rtype: List of tuples + """ + # OS + os = get_single_instance(ns, 'PG_OperatingSystem') + os_str = '' + kernel_str = '' + if os: + os_str = os.Caption + kernel_str = os.Version + if not os_str: + os_str = 'N/A' + if not kernel_str: + kernel_str = 'N/A' + # Result + result = [ + ('OS:', os_str), + ('Kernel:', kernel_str)] + return result |