summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2014-09-30 12:16:20 +0000
committerGerrit Code Review <review@openstack.org>2014-09-30 12:16:20 +0000
commiteaf4c3d9deec01d398682ce55e46a52150deabd0 (patch)
tree8a39a9c3e3b8d6caa5296ece150e81c3abcbc653
parentb39125dd8b87d2d8bc410b91f6e17d96b6f70669 (diff)
parent8ba03ed0bcd078edd7f5979b89c82a57671c95a2 (diff)
downloadironic-eaf4c3d9deec01d398682ce55e46a52150deabd0.tar.gz
Merge "Force the SSH commands to use their default language"
-rw-r--r--ironic/drivers/modules/ssh.py8
-rw-r--r--ironic/tests/drivers/test_ssh.py21
2 files changed, 15 insertions, 14 deletions
diff --git a/ironic/drivers/modules/ssh.py b/ironic/drivers/modules/ssh.py
index 87a968697..d6fbd774b 100644
--- a/ironic/drivers/modules/ssh.py
+++ b/ironic/drivers/modules/ssh.py
@@ -110,7 +110,7 @@ def _get_boot_device_map(virt_type):
def _get_command_sets(virt_type):
if virt_type == 'vbox':
return {
- 'base_cmd': '/usr/bin/VBoxManage',
+ 'base_cmd': 'LC_ALL=C /usr/bin/VBoxManage',
'start_cmd': 'startvm {_NodeName_}',
'stop_cmd': 'controlvm {_NodeName_} poweroff',
'reboot_cmd': 'controlvm {_NodeName_} reset',
@@ -126,7 +126,7 @@ def _get_command_sets(virt_type):
}
elif virt_type == 'vmware':
return {
- 'base_cmd': '/bin/vim-cmd',
+ 'base_cmd': 'LC_ALL=C /bin/vim-cmd',
'start_cmd': 'vmsvc/power.on {_NodeName_}',
'stop_cmd': 'vmsvc/power.off {_NodeName_}',
'reboot_cmd': 'vmsvc/power.reboot {_NodeName_}',
@@ -151,7 +151,7 @@ def _get_command_sets(virt_type):
# Change-Id: I160e4202952b7551b855dc7d91784d6a184cb0ed
# for more detail.
virsh_cmds = {
- 'base_cmd': '/usr/bin/virsh',
+ 'base_cmd': 'LC_ALL=C /usr/bin/virsh',
'start_cmd': 'start {_NodeName_}',
'stop_cmd': 'destroy {_NodeName_}',
'reboot_cmd': 'reset {_NodeName_}',
@@ -176,7 +176,7 @@ def _get_command_sets(virt_type):
return virsh_cmds
elif virt_type == 'parallels':
return {
- 'base_cmd': '/usr/bin/prlctl',
+ 'base_cmd': 'LC_ALL=C /usr/bin/prlctl',
'start_cmd': 'start {_NodeName_}',
'stop_cmd': 'stop {_NodeName_} --kill',
'reboot_cmd': 'reset {_NodeName_}',
diff --git a/ironic/tests/drivers/test_ssh.py b/ironic/tests/drivers/test_ssh.py
index d25f501d9..c96745bdc 100644
--- a/ironic/tests/drivers/test_ssh.py
+++ b/ironic/tests/drivers/test_ssh.py
@@ -171,7 +171,7 @@ class SSHValidateParametersTestCase(base.TestCase):
def test__parse_driver_info_with_custom_libvirt_uri(self):
CONF.set_override('libvirt_uri', 'qemu:///foo', 'ssh')
- expected_base_cmd = "/usr/bin/virsh --connect qemu:///foo"
+ expected_base_cmd = "LC_ALL=C /usr/bin/virsh --connect qemu:///foo"
node = obj_utils.get_test_node(
self.context,
@@ -806,7 +806,7 @@ class SSHDriverTestCase(db_base.DbTestCase):
with task_manager.acquire(self.context, self.node.uuid) as task:
task.node['driver_info']['ssh_virt_type'] = 'vbox'
self.driver.management.set_boot_device(task, boot_devices.PXE)
- expected_cmd = ('/usr/bin/VBoxManage modifyvm %s '
+ expected_cmd = ('LC_ALL=C /usr/bin/VBoxManage modifyvm %s '
'--boot1 net') % fake_name
mock_exc.assert_called_once_with(mock.ANY, expected_cmd)
@@ -822,7 +822,7 @@ class SSHDriverTestCase(db_base.DbTestCase):
with task_manager.acquire(self.context, self.node.uuid) as task:
task.node['driver_info']['ssh_virt_type'] = 'parallels'
self.driver.management.set_boot_device(task, boot_devices.PXE)
- expected_cmd = ('/usr/bin/prlctl set %s '
+ expected_cmd = ('LC_ALL=C /usr/bin/prlctl set %s '
'--device-bootorder "net0"') % fake_name
mock_exc.assert_called_once_with(mock.ANY, expected_cmd)
@@ -840,7 +840,7 @@ class SSHDriverTestCase(db_base.DbTestCase):
self.driver.management.set_boot_device(task, boot_devices.PXE)
expected_cmd = ('EDITOR="sed -i \'/<boot \\(dev\\|order\\)=*\\>'
'/d;/<\\/os>/i\\<boot dev=\\"network\\"/>\'" '
- '/usr/bin/virsh --connect qemu:///system '
+ 'LC_ALL=C /usr/bin/virsh --connect qemu:///system '
'edit %s') % fake_name
mock_exc.assert_called_once_with(mock.ANY, expected_cmd)
@@ -883,7 +883,8 @@ class SSHDriverTestCase(db_base.DbTestCase):
task.node['driver_info']['ssh_virt_type'] = 'vbox'
result = self.driver.management.get_boot_device(task)
self.assertEqual(boot_devices.PXE, result['boot_device'])
- expected_cmd = ('/usr/bin/VBoxManage showvminfo --machinereadable %s '
+ expected_cmd = ('LC_ALL=C /usr/bin/VBoxManage showvminfo '
+ '--machinereadable %s '
'| awk -F \'"\' \'/boot1/{print $2}\'') % fake_name
mock_exc.assert_called_once_with(mock.ANY, expected_cmd)
@@ -901,7 +902,7 @@ class SSHDriverTestCase(db_base.DbTestCase):
task.node['driver_info']['ssh_virt_type'] = 'parallels'
result = self.driver.management.get_boot_device(task)
self.assertEqual(boot_devices.PXE, result['boot_device'])
- expected_cmd = ('/usr/bin/prlctl list -i %s '
+ expected_cmd = ('LC_ALL=C /usr/bin/prlctl list -i %s '
'| awk \'/^Boot order:/ {print $3}\'') % fake_name
mock_exc.assert_called_once_with(mock.ANY, expected_cmd)
@@ -919,10 +920,10 @@ class SSHDriverTestCase(db_base.DbTestCase):
task.node['driver_info']['ssh_virt_type'] = 'virsh'
result = self.driver.management.get_boot_device(task)
self.assertEqual(boot_devices.PXE, result['boot_device'])
- expected_cmd = ('/usr/bin/virsh --connect qemu:///system dumpxml '
- '%s | awk \'/boot dev=/ { gsub( ".*dev=" Q, "" ); '
- 'gsub( Q ".*", "" ); print; }\' Q="\'" RS="[<>]" | '
- 'head -1') % fake_name
+ expected_cmd = ('LC_ALL=C /usr/bin/virsh --connect '
+ 'qemu:///system dumpxml %s | awk \'/boot dev=/ '
+ '{ gsub( ".*dev=" Q, "" ); gsub( Q ".*", "" ); '
+ 'print; }\' Q="\'" RS="[<>]" | head -1') % fake_name
mock_exc.assert_called_once_with(mock.ANY, expected_cmd)
@mock.patch.object(ssh, '_get_connection')