Fix the filtered characters list from console-log
In fffcaea1 ^M was added to the list of characters to filter from the
console-log output but, because of a typo in the regexp, the
character '-' was added to that list too and has been removed since
then.
Fixes bug #1194032
Change-Id: Ia02b0b4c7027cbd09a51042ca1b5d28890413626
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import string
|
||||
import webob
|
||||
|
||||
from nova.compute import api as compute_api
|
||||
@@ -39,6 +40,10 @@ def fake_get_console_output_not_ready(self, _context, _instance, tail_length):
|
||||
raise exception.InstanceNotReady(instance_id=_instance["uuid"])
|
||||
|
||||
|
||||
def fake_get_console_output_all_characters(self, _ctx, _instance, _tail_len):
|
||||
return string.printable
|
||||
|
||||
|
||||
def fake_get(self, context, instance_uuid):
|
||||
return {'uuid': instance_uuid}
|
||||
|
||||
@@ -94,6 +99,20 @@ class ConsoleOutputExtensionTest(test.TestCase):
|
||||
self.assertEqual(res.status_int, 200)
|
||||
self.assertEqual(output, {'output': '2\n3\n4'})
|
||||
|
||||
def test_get_console_output_filtered_characters(self):
|
||||
self.stubs.Set(compute_api.API, 'get_console_output',
|
||||
fake_get_console_output_all_characters)
|
||||
body = {'os-getConsoleOutput': {}}
|
||||
req = webob.Request.blank('/v2/fake/servers/1/action')
|
||||
req.method = "POST"
|
||||
req.body = jsonutils.dumps(body)
|
||||
req.headers["content-type"] = "application/json"
|
||||
res = req.get_response(self.app)
|
||||
output = jsonutils.loads(res.body)
|
||||
self.assertEqual(res.status_int, 200)
|
||||
expect = string.digits + string.letters + string.punctuation + ' \t\n'
|
||||
self.assertEqual(output, {'output': expect})
|
||||
|
||||
def test_get_console_output_with_non_integer_length(self):
|
||||
body = {'os-getConsoleOutput': {'length': 'NaN'}}
|
||||
req = webob.Request.blank('/v2/fake/servers/1/action')
|
||||
|
||||
Reference in New Issue
Block a user