david-caro / python-foreman

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

Unable to run against Foreman 1.9 #61

Closed fatmcgav closed 8 years ago

fatmcgav commented 8 years ago

When attempting to use against a Foreman 1.9 installation, I'm getting the following error when trying to use f.index_hosts().

There is a conflict trying to redefine method (available_storage_domains): apipie_resource: compute_resources new_api: <resource:compute_resources, name:available_storage_domains> new_url: /api/compute_resources/:id/available_storage_domains old_api: <resource:compute_resources, name:available_storage_domains> old_url: /api/compute_resources/:id/available_storage_domains

I'm guessing it's due to there being no definitions in foreman/definitions for Foreman versions > 1.7.2...

If they're easily obtainable then I'll grab them and add them in?

Cheers Gav

david-caro commented 8 years ago

Mmm, that means that the json that you get from foreman has a duplicated definition on it (that's a bug in foreman itself usually), you can also send a pull request with the 1.9 definitions (check ~/.python-foreman dir).

It should not be failing anyhow, just showing the warning (you can turn it off tweaking the logging level from python logging mod).

If you send the pull, I'll take a look see if it's really a foreman issue or it's the lib that's not parsing the definitions correctly

fatmcgav commented 8 years ago

@david-caro Hmm, ok...

I've created a gist here: https://gist.github.com/fatmcgav/018a26acdf0aeb99b655 which shows the test script, script output and foreman production.log.

Any pointers appreciated...

Edit: Have just added the 1.9.2-v2.json file to the gist pulled from ~/.python-foreman directory :)

Cheers Gav

fatmcgav commented 8 years ago

Apologies, looks like my Python fu isn't up to scratch atm...

It looks like it is indeed working, I just needed to assign f.index_hosts() to a variable and print that variable out...

However worth exploring the API error I guess :)

david-caro commented 8 years ago

okok, opened the bug in foreman, seems simple enough (and they are very responsive) so it will be fixed soon :), thanks a lot for your help!