cache sysinfo (we use it a lot, it will not change)

bug/bundler_fix
Brent Cook 2016-07-25 07:16:12 -05:00 committed by Brent Cook
parent 9cb4880747
commit 3987c2c0d8
1 changed files with 12 additions and 9 deletions

View File

@ -87,16 +87,19 @@ class Config
#
def sysinfo
request = Packet.create_request('stdapi_sys_config_sysinfo')
response = client.send_request(request)
if @sysinfo.nil?
response = client.send_request(request)
{
'Computer' => response.get_tlv_value(TLV_TYPE_COMPUTER_NAME),
'OS' => response.get_tlv_value(TLV_TYPE_OS_NAME),
'Architecture' => response.get_tlv_value(TLV_TYPE_ARCHITECTURE),
'System Language' => response.get_tlv_value(TLV_TYPE_LANG_SYSTEM),
'Domain' => response.get_tlv_value(TLV_TYPE_DOMAIN),
'Logged On Users' => response.get_tlv_value(TLV_TYPE_LOGGED_ON_USER_COUNT)
}
@sysinfo = {
'Computer' => response.get_tlv_value(TLV_TYPE_COMPUTER_NAME),
'OS' => response.get_tlv_value(TLV_TYPE_OS_NAME),
'Architecture' => response.get_tlv_value(TLV_TYPE_ARCHITECTURE),
'System Language' => response.get_tlv_value(TLV_TYPE_LANG_SYSTEM),
'Domain' => response.get_tlv_value(TLV_TYPE_DOMAIN),
'Logged On Users' => response.get_tlv_value(TLV_TYPE_LOGGED_ON_USER_COUNT)
}
end
@sysinfo
end
#