kopia lustrzana https://github.com/wagtail/wagtail
Merge branch 'kaedroho-issue-786'
commit
434597c859
|
@ -14,6 +14,7 @@ Changelog
|
||||||
* Fix: Page system check for on_delete actions of ForeignKeys was throwing false positives when page class decends from an abstract class (Alejandro Giacometti)
|
* Fix: Page system check for on_delete actions of ForeignKeys was throwing false positives when page class decends from an abstract class (Alejandro Giacometti)
|
||||||
* Fixed a regression where form builder submissions containing a number field would fail with a JSON serialisation error
|
* Fixed a regression where form builder submissions containing a number field would fail with a JSON serialisation error
|
||||||
* Fix: Resizing an image with a focal point equal to the image size would result in a divide-by-zero error
|
* Fix: Resizing an image with a focal point equal to the image size would result in a divide-by-zero error
|
||||||
|
* Fix: Elasticsearch configuration now supports specifying HTTP authentication parameters as part of the URL, and defaults to ports 80 (HTTP) and 443 (HTTPS) if port number not specified
|
||||||
|
|
||||||
|
|
||||||
0.8.1 (05.11.2014)
|
0.8.1 (05.11.2014)
|
||||||
|
|
|
@ -18,3 +18,13 @@ Bug fixes
|
||||||
* Page system check for on_delete actions of ForeignKeys was throwing false positives when page class decends from an abstract class (Alejandro Giacometti)
|
* Page system check for on_delete actions of ForeignKeys was throwing false positives when page class decends from an abstract class (Alejandro Giacometti)
|
||||||
* Fixed a regression where form builder submissions containing a number field would fail with a JSON serialisation error
|
* Fixed a regression where form builder submissions containing a number field would fail with a JSON serialisation error
|
||||||
* Resizing an image with a focal point equal to the image size would result in a divide-by-zero error
|
* Resizing an image with a focal point equal to the image size would result in a divide-by-zero error
|
||||||
|
* Elasticsearch configuration now supports specifying HTTP authentication parameters as part of the URL, and defaults to ports 80 (HTTP) and 443 (HTTPS) if port number not specified
|
||||||
|
|
||||||
|
|
||||||
|
Upgrade considerations
|
||||||
|
======================
|
||||||
|
|
||||||
|
Port number must be specified when running Elasticsearch on port 9200
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
In previous versions, an Elasticsearch connection URL in ``WAGTAILSEARCH_BACKENDS`` without an explicit port number (e.g. ``http://localhost/``) would be treated as port 9200 (the Elasticsearch default) whereas the correct behaviour would be to use the default http/https port of 80/443. This behaviour has now been fixed, so sites running Elasticsearch on port 9200 must now specify this explicitly - e.g. ``http://localhost:9200``. (Projects using the default settings, or the settings given in the Wagtail documentation, are unaffected.)
|
||||||
|
|
|
@ -339,11 +339,19 @@ class ElasticSearch(BaseSearch):
|
||||||
for url in self.es_urls:
|
for url in self.es_urls:
|
||||||
parsed_url = urlparse(url)
|
parsed_url = urlparse(url)
|
||||||
|
|
||||||
|
use_ssl = parsed_url.scheme == 'https'
|
||||||
|
port = parsed_url.port or (443 if use_ssl else 80)
|
||||||
|
|
||||||
|
http_auth = None
|
||||||
|
if parsed_url.username is not None and parsed_url.password is not None:
|
||||||
|
http_auth = (parsed_url.username, parsed_url.password)
|
||||||
|
|
||||||
self.es_hosts.append({
|
self.es_hosts.append({
|
||||||
'host': parsed_url.hostname,
|
'host': parsed_url.hostname,
|
||||||
'port': parsed_url.port or 9200,
|
'port': port,
|
||||||
'url_prefix': parsed_url.path,
|
'url_prefix': parsed_url.path,
|
||||||
'use_ssl': parsed_url.scheme == 'https',
|
'use_ssl': use_ssl,
|
||||||
|
'http_auth': http_auth,
|
||||||
})
|
})
|
||||||
|
|
||||||
# Get ElasticSearch interface
|
# Get ElasticSearch interface
|
||||||
|
|
|
@ -508,13 +508,29 @@ class TestBackendConfiguration(TestCase):
|
||||||
def test_urls(self):
|
def test_urls(self):
|
||||||
# This test backwards compatibility with old URLS setting
|
# This test backwards compatibility with old URLS setting
|
||||||
backend = self.ElasticSearch(params={
|
backend = self.ElasticSearch(params={
|
||||||
'URLS': ['http://localhost:12345', 'https://127.0.0.1:54321'],
|
'URLS': [
|
||||||
|
'http://localhost:12345',
|
||||||
|
'https://127.0.0.1:54321',
|
||||||
|
'http://username:password@elasticsearch.mysite.com',
|
||||||
|
'https://elasticsearch.mysite.com/hello',
|
||||||
|
],
|
||||||
})
|
})
|
||||||
|
|
||||||
self.assertEqual(len(backend.es_hosts), 2)
|
self.assertEqual(len(backend.es_hosts), 4)
|
||||||
self.assertEqual(backend.es_hosts[0]['host'], 'localhost')
|
self.assertEqual(backend.es_hosts[0]['host'], 'localhost')
|
||||||
self.assertEqual(backend.es_hosts[0]['port'], 12345)
|
self.assertEqual(backend.es_hosts[0]['port'], 12345)
|
||||||
self.assertEqual(backend.es_hosts[0]['use_ssl'], False)
|
self.assertEqual(backend.es_hosts[0]['use_ssl'], False)
|
||||||
|
|
||||||
self.assertEqual(backend.es_hosts[1]['host'], '127.0.0.1')
|
self.assertEqual(backend.es_hosts[1]['host'], '127.0.0.1')
|
||||||
self.assertEqual(backend.es_hosts[1]['port'], 54321)
|
self.assertEqual(backend.es_hosts[1]['port'], 54321)
|
||||||
self.assertEqual(backend.es_hosts[1]['use_ssl'], True)
|
self.assertEqual(backend.es_hosts[1]['use_ssl'], True)
|
||||||
|
|
||||||
|
self.assertEqual(backend.es_hosts[2]['host'], 'elasticsearch.mysite.com')
|
||||||
|
self.assertEqual(backend.es_hosts[2]['port'], 80)
|
||||||
|
self.assertEqual(backend.es_hosts[2]['use_ssl'], False)
|
||||||
|
self.assertEqual(backend.es_hosts[2]['http_auth'], ('username', 'password'))
|
||||||
|
|
||||||
|
self.assertEqual(backend.es_hosts[3]['host'], 'elasticsearch.mysite.com')
|
||||||
|
self.assertEqual(backend.es_hosts[3]['port'], 443)
|
||||||
|
self.assertEqual(backend.es_hosts[3]['use_ssl'], True)
|
||||||
|
self.assertEqual(backend.es_hosts[3]['url_prefix'], '/hello')
|
||||||
|
|
Ładowanie…
Reference in New Issue