Factor out DiscoverVersion in sysinfo, use in generic_agent_test:test_masterfiles