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

Foreman.puppetclasses.show() returns inconsistent types #45

Open
tmclaugh opened this issue May 15, 2015 · 2 comments
Open

Foreman.puppetclasses.show() returns inconsistent types #45

tmclaugh opened this issue May 15, 2015 · 2 comments

Comments

@tmclaugh
Copy link

Tracked down an inconsistency while troubleshooting an error in my app. After getting the data back from Foreman I was expecting to interact with a dictionary but was unexpectedly interacting with a list.

In [112]: type(foreman_client.puppetclasses.show('apache'))
Out[112]: dict

In [113]: type(foreman_client.puppetclasses.show('apache1'))
Out[113]: list

@david-caro
Copy link
Owner

On 05/14, Tom McLaughlin wrote:

Tracked down an inconsistency while troubleshooting an error in my app. After getting the data back from Foreman I was expecting to interact with a dictionary but was unexpectedly interacting with a list.

In [112]: type(foreman_client.puppetclasses.show('apache'))
Out[112]: dict

In [113]: type(foreman_client.puppetclasses.show('apache1'))
Out[113]: list

This is returning an empty list?

The data that foreman returns has changed from apiv1 to 2, and now it's a dict,
but when getting 404 not found the methods forge the response (the same for api
1 and 2) and return [].

I'll look into it.

Please, correct me if that's not the case.


Reply to this email directly or view it on GitHub:
#45

@tmclaugh
Copy link
Author

Sorry, wrote up the PR a little too fast. I was using the V2 API and when searching for a class that exists I get a dict. When searching for a non-existent class I get an empty list.

Sent from my iPhone

On May 15, 2015, at 4:09 AM, David [email protected] wrote:

On 05/14, Tom McLaughlin wrote:

Tracked down an inconsistency while troubleshooting an error in my app. After getting the data back from Foreman I was expecting to interact with a dictionary but was unexpectedly interacting with a list.

In [112]: type(foreman_client.puppetclasses.show('apache'))
Out[112]: dict

In [113]: type(foreman_client.puppetclasses.show('apache1'))
Out[113]: list

This is returning an empty list?

The data that foreman returns has changed from apiv1 to 2, and now it's a dict,
but when getting 404 not found the methods forge the response (the same for api
1 and 2) and return [].

I'll look into it.

Please, correct me if that's not the case.


Reply to this email directly or view it on GitHub:
#45

Reply to this email directly or view it on GitHub.

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

No branches or pull requests

2 participants