david-caro / python-foreman

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

Generate foreman sdk from api documentation #13

Closed lukas-bednar closed 9 years ago

lukas-bednar commented 10 years ago
david-caro commented 10 years ago

Can you make it compatible with the previous version? I mean, for example, adding the generated json here so you don't need to enable the develop option for the apipie gem on the foreman server. Right now it will just fail with no json could be decoded.

Also I have added tox tests, so you can just install python-tox, and run tox on the dir and it will create the virtualenvs with the pep8 version from the travis tests.

lukas-bednar commented 10 years ago

Thank you David for your time!

I am kind torn about that backward compatibility with definitions.py . In case you can not get json definitions you are going to lose part of functionality of sdk, so it will fail on missing attribute.

On other hand we can keep json definitions per each major version of Forman or something. But it breaks the idea itself to generate sdk from specific Forman instance including installed plugins ...

I will think about it and try to fit your requirements.

Have a nice weekend, Lukas. Dne 11.4.2014 17:41 "David" notifications@github.com napsal(a):

Can you make it compatible with the previous version? I mean, for example, adding the generated json here so you don't need to enable the develop option for the apipie gem on the foreman server. Right now it will just fail with no json could be decoded.

Also I have added tox tests, so you can just install python-tox, and run tox on the dir and it will create the virtualenvs with the pep8 version from the travis tests.

Reply to this email directly or view it on GitHubhttps://github.com/david-caro/python-foreman/pull/13#issuecomment-40217877 .

david-caro commented 10 years ago

Well, the idea I had was to have one definitions.py (or json, the format is not so relevant) for each major version, and for each api version. And use that as a fallback if not able to generate from the server, or specified explicitly.

Right now you can't even login without enabling the devel mode on the apipie gem, so for me is a blocker (right now at least).

On Fri, Apr 11, 2014 at 7:39 PM, Lukas Bednar notifications@github.comwrote:

Thank you David for your time!

I am kind torn about that backward compatibility with definitions.py . In case you can not get json definitions you are going to lose part of functionality of sdk, so it will fail on missing attribute.

On other hand we can keep json definitions per each major version of Forman or something. But it breaks the idea itself to generate sdk from specific Forman instance including installed plugins ...

I will think about it and try to fit your requirements.

Have a nice weekend, Lukas. Dne 11.4.2014 17:41 "David" notifications@github.com napsal(a):

Can you make it compatible with the previous version? I mean, for example, adding the generated json here so you don't need to enable the develop option for the apipie gem on the foreman server. Right now it will just fail with no json could be decoded.

Also I have added tox tests, so you can just install python-tox, and run tox on the dir and it will create the virtualenvs with the pep8 version from the travis tests.

Reply to this email directly or view it on GitHub< https://github.com/david-caro/python-foreman/pull/13#issuecomment-40217877

.

Reply to this email directly or view it on GitHubhttps://github.com/david-caro/python-foreman/pull/13#issuecomment-40229592 .

david-caro commented 10 years ago

Hey Lukas, I've been working on a rewrite of this patch and I've created the apiv2 branch, it includes your changes but maintaines the default behavior, and allows you to select both, foreman and api version.

Can you take a look and tell me if it's good for you? (to use the foreman live api definitions you have to pass the use_cache=False parameter to the client)

lukas-bednar commented 10 years ago

Hi David, that is great, I appreciate your effort! I looks good to me, I will test it on our env soon.

Thanks, Lukas.

david-caro commented 9 years ago

Pushed the apiv2 already, has been working for some time on our env, thanks for everything Lukas!! Let me know if you have any issues :)