Adds implementation of get_distribution_and_version for Windows

* Adds the get_distribution_and_version method to the windows_client
* Added get_distribution_and_version to the base remote client to
  enforce its implementation in child clients

Change-Id: I9a91d04018709dfd92325a64af85d2c37fc4d99b
This commit is contained in:
Daryl Walleck 2014-11-11 01:32:54 -06:00
parent 6516690031
commit d13e97e3b7
2 changed files with 19 additions and 0 deletions

View File

@ -57,3 +57,7 @@ class RemoteInstanceClient(BaseClient):
def can_authenticate(self):
"""Verifies a remote connection can be made to the server."""
raise NotImplementedError
def get_distribution_and_version(self):
"""Gets the distribution and version of a server."""
raise NotImplementedError

View File

@ -485,11 +485,26 @@ class WindowsClient(RemoteInstanceClient):
output = self.client.execute_command(command)
return output.std_out[0]
def get_distribution_and_version(self):
"""
Gets the distribution and version of a server
@return: Full name of the distribution
@rtype: str
"""
output = self.client.execute_command(
'powershell gwmi win32_operatingsystem |% caption')
if output.std_out:
return output.std_out
else:
return ''
def filesystem_sync(self):
# This works as a non-powershell command, but it may not
# be installed on all versions of windows.
self.client.execute_command('sync')
# gwmi
@staticmethod
def _convert_powershell_list_to_dict(response):
data = {}