diff --git a/doc/source/cli/nova.rst b/doc/source/cli/nova.rst index 75f6ee90e..eada5c693 100644 --- a/doc/source/cli/nova.rst +++ b/doc/source/cli/nova.rst @@ -1177,6 +1177,33 @@ nova console-log Get console log output of a server. +**Locale encoding issues** + +If you encounter an error such as: + +.. code-block:: console + + UnicodeEncodeError: 'ascii' codec can't encode characters in position + +The solution to these problems is different depending on which locale your +computer is running in. + +For instance, if you have a German Linux machine, you can fix the problem by +exporting the locale to de_DE.utf-8: + +.. code-block:: console + + export LC_ALL=de_DE.utf-8 + export LANG=de_DE.utf-8 + +If you are on a US machine, en_US.utf-8 is the encoding of choice. On some +newer Linux systems, you could also try C.UTF-8 as the locale: + +.. code-block:: console + + export LC_ALL=C.UTF-8 + export LANG=C.UTF-8 + **Positional arguments:** ```` diff --git a/novaclient/tests/unit/v2/test_shell.py b/novaclient/tests/unit/v2/test_shell.py index e2297699a..bf7a86674 100644 --- a/novaclient/tests/unit/v2/test_shell.py +++ b/novaclient/tests/unit/v2/test_shell.py @@ -3553,6 +3553,12 @@ class ShellTest(utils.TestCase): self.run_command('availability-zone-list') self.assert_called('GET', '/os-availability-zone/detail') + def test_console_log(self): + out = self.run_command('console-log --length 20 1234')[0] + self.assert_called('POST', '/servers/1234/action', + body={'os-getConsoleOutput': {'length': '20'}}) + self.assertIn('foo', out) + def test_server_security_group_add(self): self.run_command('add-secgroup sample-server testgroup') self.assert_called('POST', '/servers/1234/action',