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

Cadvisor object url protocol not validated correctly #1

Open
cgmcintyr opened this issue Dec 29, 2017 · 1 comment
Open

Cadvisor object url protocol not validated correctly #1

cgmcintyr opened this issue Dec 29, 2017 · 1 comment

Comments

@cgmcintyr
Copy link
Owner

Initialising a Cadvisor object without a protocol can result in errors when making requests to paths joined onto url.

For example:

from cadvisor import Cadvisor

cad = Cadvisor('127.0.0.1:8080', '1.3')

Results in that Cadvisor instance's 'get' methods trying to urljoin a string onto 127.0.0.1:8080.

For example calling cad.get_machine_info():

def get_machine_info(self):
data = self.__get_json_data(api.machine_info_url(self.api_url))
return MachineInfo(data)

In this instance would result in callling api.machine_info_url with base_url arg set to 127.0.0.1:8080

def machine_info_url(base_url):
return urljoin(base_url, 'machine')

Which would return the string 'machine/', which leads to a MissingSchema: Invalid URL 'machine' when this string is passed as argument into self.__get_json_data.

@cgmcintyr
Copy link
Owner Author

cgmcintyr commented Dec 29, 2017

First step would be to create a test case. After this look at adding http:// to start of url cadvisor is being initialised with if there is no procotol given.

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

No branches or pull requests

1 participant