#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (C) 2019 tribe29 GmbH - License: GNU General Public License v2
# This file is part of Checkmk (https://checkmk.com). It is subject to the terms and
# conditions defined in the file COPYING, which is part of this source code package.

# win_computersystem is executed after win_system
# and we overwrite some data.
# Assumption: it's more precise

# Example output:
# <<<win_computersystem:sep(58)>>>
# Manufacturer: FUJITSU
# Model: PRIMERGY RX100 S7
# Name: <WINDOWSHOST>


def inv_win_computersystem(info):
    node = inv_tree("hardware.system.")
    for line in info:
        key = line[0]
        value = " ".join(line[1:])
        if key == "Manufacturer":
            node["manufacturer"] = value
        elif key == "Model":
            node["model"] = value
        elif key == "Name":
            node["family"] = value


inv_info["win_computersystem"] = {
    "inv_function": inv_win_computersystem,
}
