Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switching on sniff mode triggers ValueError #358

Closed
grepsr opened this issue Feb 17, 2016 · 3 comments
Closed

Switching on sniff mode triggers ValueError #358

grepsr opened this issue Feb 17, 2016 · 3 comments

Comments

@grepsr
Copy link

grepsr commented Feb 17, 2016

I think there is a bug in the latest version. It related to not being able to parse response properly from Elasticsearch when sniffing?

If you enable Sniff mode, then you get the following error. There is an "]" bracket on the value that comes with the port string (probably from), and when the library tries to do an int("9200]"), it gives a ValueError and crashes. Details below:

ValueError: invalid literal for int() with base 10: '9200]'
Traceback (most recent call last): File "/usr/local/lib/python2.7/site-packages/elasticsearch/client/__init__.py", line 150, in __init__ self.transport = transport_class(_normalize_hosts(hosts), **kwargs) File "/usr/local/lib/python2.7/site-packages/elasticsearch/transport.py", line 126, in __init__ self.sniff_hosts(True) File "/usr/local/lib/python2.7/site-packages/elasticsearch/transport.py", line 250, in sniff_hosts host['port'] = int(port) ValueError: invalid literal for int() with base 10: '9200]'

@grepsr
Copy link
Author

grepsr commented Feb 17, 2016

To give more details, the sniff result from Elasticsearch on my Elasticsearch is as follows (its Elasticsearch inside a Docker container)

{
"cluster_name": "mycluster",
"nodes": {
"wsOfrxfBQEC5kU1aL_Hmlw": {
"name": "Crown",
"transport_address": "inet[/192.168.1.5:9300]",
"host": "elasticsearch",
"ip": "172.17.0.9",
"version": "1.6.2",
"build": "6220391",
"http_address": "inet[/192.168.1.5:9200]"
}
}
}

So I think the bug is in the part where one tries to split the host using a ":", but there is a trailing "]"

@grepsr
Copy link
Author

grepsr commented Feb 17, 2016

Looks like this could be because I was using 2.x library on 1.6 server. Sniffing is not compatible.

If its not important to add compatibility, then this can be closed.

@honzakral
Copy link
Contributor

The 2.x version of the library is only compatible with 2.x server versions, this isn't expected to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant