Make sure to import Posh-Ohai module in PowerShell
While PowerShell version 3 will load the module automatically, PowerShell version 2 requires you to be more explicit. This was missing in from 239fa1e3c7aa. We discovered this in interactive debugging session with Hounsou Dansou. Change-Id: I88db408c00b8d880cec08a14086e605e99ff8799
This commit is contained in:
parent
239fa1e3c7
commit
2ff8166355
@ -67,7 +67,8 @@ def system_info(client, with_install=False):
|
||||
perform_install(client)
|
||||
|
||||
if client.is_windows():
|
||||
powershell_command = 'Get-ComputerConfiguration'
|
||||
powershell_command = ('Import-Module -Name Posh-Ohai;'
|
||||
'Get-ComputerConfiguration')
|
||||
output = client.execute(powershell_command)
|
||||
unicode_output = "%s" % output
|
||||
load_clean_json = lambda output: json.loads(get_json(output))
|
||||
|
@ -38,7 +38,8 @@ class TestSystemInfo(utils.TestCase):
|
||||
def test_system_info(self):
|
||||
self.client.execute.return_value = "{}"
|
||||
posh_ohai.system_info(self.client)
|
||||
self.client.execute.assert_called_with("Get-ComputerConfiguration")
|
||||
self.client.execute.assert_called_with("Import-Module -Name Posh-Ohai;"
|
||||
"Get-ComputerConfiguration")
|
||||
|
||||
def test_system_info_json(self):
|
||||
self.client.execute.return_value = '{"foo": 123}'
|
||||
|
Loading…
x
Reference in New Issue
Block a user