Allow segment description to be multiline
This patch allows user to pass a multiline description for a failover segment. Closes-Bug: #1776385 Change-Id: I25afb76aec10a507312b8d99b0c882ca9f6bcd81
This commit is contained in:
parent
7f76081ccf
commit
d7f47f2627
@ -116,7 +116,7 @@ def _build_regex_range(ws=True, invert=False, exclude=None):
|
||||
return regex
|
||||
|
||||
|
||||
valid_description_regex_base = '^[%s]*$'
|
||||
valid_description_regex_base = '^[\n%s]*$'
|
||||
|
||||
valid_name_regex_base = '^(?![%s])[%s]*(?<![%s])$'
|
||||
|
||||
|
@ -130,6 +130,21 @@ class FailoverSegmentTestCase(test.TestCase):
|
||||
result = result['segment']
|
||||
self._assert_segment_data(FAILOVER_SEGMENT, _make_segment_obj(result))
|
||||
|
||||
@mock.patch.object(ha_api.FailoverSegmentAPI, 'create_segment')
|
||||
def test_create_with_multiline_description(self, mock_create):
|
||||
body = {
|
||||
"segment": {
|
||||
"name": "segment1",
|
||||
"service_type": "COMPUTE",
|
||||
"recovery_method": "auto",
|
||||
"description": "failover_segment\nfor\ncompute"
|
||||
}
|
||||
}
|
||||
mock_create.return_value = FAILOVER_SEGMENT
|
||||
result = self.controller.create(self.req, body=body)
|
||||
result = result['segment']
|
||||
self._assert_segment_data(FAILOVER_SEGMENT, _make_segment_obj(result))
|
||||
|
||||
@mock.patch.object(ha_api.FailoverSegmentAPI, 'create_segment')
|
||||
def test_create_with_duplicate_segment_name(self, mock_create):
|
||||
body = {
|
||||
|
5
releasenotes/notes/bug-1776385-0bcf0a0b3fad359e.yaml
Normal file
5
releasenotes/notes/bug-1776385-0bcf0a0b3fad359e.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
Allows segment description to contain new line characters.
|
||||
`LP#1776385 <https://launchpad.net/bugs/1776385>`__
|
Loading…
Reference in New Issue
Block a user