Skip to content
This repository has been archived by the owner on Oct 29, 2024. It is now read-only.

Allow connecting to influxdb running on a path on the server #556

Merged
merged 6 commits into from
May 8, 2018

Conversation

gladhorn
Copy link
Contributor

Make it possible to connect to the databases on a path on servers.
https://someserver.com/myinfluxdb instead of the root of the server.

Make it possible to connect to the databases on a path on servers.
https://someserver.com/myinfluxdb instead of the root of the server.
@gladhorn
Copy link
Contributor Author

As far as I can tell the failures in the tests are unrelated in this change and also visible in other merge requests.

@gladhorn
Copy link
Contributor Author

Is anyone looking at these requests? And is there some way to re-run travis?

@xginn8
Copy link
Collaborator

xginn8 commented Feb 6, 2018

sorry about the delay -- looking into CI failures.

@gladhorn
Copy link
Contributor Author

gladhorn commented Feb 6, 2018

Thanks :)

):
"""Construct a new InfluxDBClient object."""
self.__host = host
self.__port = int(port)
self.__path = path if not path or path[0] == '/' else '/' + path
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you're slicing the string here, perhaps it would make sense to first cast the input to a string (similar to the above port cast)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So you'e prefer something like:

_path = str(path)
self.__path = _path if not _path or _path[0] == '/' else '/' + _path

Any other suggestion how to make this look better?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It dosen't have to be a oneliner

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, my suggestion was no longer a one-liner either. What should it be like?

@micw
Copy link

micw commented Apr 3, 2018

Any chance to get this reviewed soon? I stumbled across this issue in HomeAssistant which uses the library and I'd like to create a patch for it - but that needs this feature released ;)

Kind regards,
Michael.

Copy link

@micw micw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO it should also handle (and test) if path is None.

Copy link

@micw micw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd create another PR with path=None test.

@gladhorn
Copy link
Contributor Author

gladhorn commented Apr 4, 2018

path=None is tested in the test already, it's the default case. The newly added tests test the other cases.

@micw
Copy link

micw commented Apr 4, 2018

I beg to differ. The default is an empty string which actually works. Just added a test with None path:

        cli = InfluxDBClient(
            'host', 8086, 'username', 'password', 'database', ssl=True,
            path=None     
        )
        self.assertEqual('https://host:8086', cli._baseurl)

The test fails:

AssertionError: u'https://host:8086' != u'https://host:8086None'
- https://host:8086
+ https://host:8086None
?                  ++++

I have created a PR to your PR that adds the test and the fix (I split the expression since 3 conditions don't fit into one line anymore).

Test and fix for None path
Copy link

@sthenault sthenault left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sthenault
Copy link

would be interested in this PR too

@xginn8 xginn8 merged commit f3c6acf into influxdata:master May 8, 2018
@xginn8
Copy link
Collaborator

xginn8 commented May 8, 2018

Thanks for your contribution!

@gladhorn
Copy link
Contributor Author

gladhorn commented May 8, 2018

Thanks for taking it in :) less ugly workarounds on my side.

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

Successfully merging this pull request may close these issues.

5 participants