serverspec/specinfra — pull request #146 by smontanari (2014-07-07 07:42:03+00:00)
Title: Cache os based on host and port

At the moment the DetectOS module caches the detected os data based on ssh.host configuration, i.e. if the current ssh connection is to the same host then specinfra keeps using the same os. I found myself using vagrant with multiple vm running at the same time, and with different operating systems (e.g. redhat and ubuntu). Vagrant allows you to specify different ssh ports to use when connecting to its running instances.

With this change the DetectOS module also considers the port number of the ssh connection in order to retrieve the cached os, i.e. it uniquely identifies a server using both the hostname and the port number used for the ssh connection. This allows me to run multiple specs at the same time against different vagrant machines (with different os) running on my host