david-caro / python-foreman

Small low level python wrapper around Foreman API
GNU General Public License v2.0
58 stars 37 forks source link

ForemanVersionException: No suitable cache found for version=1.5.0 api_version=2. #14

Closed magnus919 closed 10 years ago

magnus919 commented 10 years ago

Trying out the latest python-foreman from github (0.2) against Foreman 1.5.0, interactively inside of ipython and python 2.7:

In [1]: from getpass import getpass

In [2]: from foreman.client import Foreman

In [3]: f = Foreman('https://foreman.example.com/', ('username', getpass()))

Password:

ForemanVersionException Traceback (most recent call last)

in () ----> 1 f = Foreman('https://foreman.example.com/', ('username', getpass())) /Library/Python/2.7/site-packages/foreman/client.pyc in **init**(self, url, auth, version, api_version, use_cache) 315 if version is None: 316 version = self.get_foreman_version() --> 317 self._generate_api_defs(version, api_version, use_cache) 318 319 # Instantiate plugins /Library/Python/2.7/site-packages/foreman/client.pyc in _generate_api_defs(self, version, api_version, use_cache) 368 def _generate_api_defs(self, version, api_version, use_cache=True): 369 if use_cache: --> 370 data = self._get_local_defs(version, api_version) 371 else: 372 res = self.session.get( /Library/Python/2.7/site-packages/foreman/client.pyc in _get_local_defs(self, version, api_version) 364 "No suitable cache found for version=%s api_version=%s." 365 "\nAvailable: %s" --> 366 % (version, api_version, '\n\t' + '\n\t'.join(files))) 367 368 def _generate_api_defs(self, version, api_version, use_cache=True): ForemanVersionException: No suitable cache found for version=1.5.0 api_version=2. Available:
david-caro commented 10 years ago

Can you try the latest commit for the apiv2 branch? Should solve that issue and other introduced by that commit.

I'm also testing it mysqlg as much as I can to avoid that mistake again.

Thanks for the feedback!!

magnus919 commented 10 years ago

Different error:

Traceback (most recent call last): File "./foo", line 5, in f = Foreman('https://foreman.example.com/', ('username', getpass())) File "/Library/Python/2.7/site-packages/foreman/client.py", line 331, in init self._generate_api_defs(use_cache) File "/Library/Python/2.7/site-packages/foreman/client.py", line 436, in _generate_api_defs data = self._get_remote_defs(self.api_version, self.version) TypeError: _get_remote_defs() takes at most 2 arguments (3 given)

david-caro commented 10 years ago

I see two things here, those extra parameters and the fact that I'm missing the *json files in the stup.py when building the package, I'll fix them today or tomorrow. Is it blocking you anyhow?

magnus919 commented 10 years ago

No, not a blocker. Thank you for the concern, though. My Python-fu is a little young at heart right now but I have some good use for this module when this passes. Thanks so much!

david-caro commented 10 years ago

Ok, fixed the issues, can you give it another try? (you'll have to manually remove the rpm, as the version has not changed)

magnus919 commented 10 years ago

Success!

Thanks for solving this!