-
Notifications
You must be signed in to change notification settings - Fork 41
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
add_criterion method returning errors #34
Comments
Thanks! Looking over the code, I can see what the issue is, and it's not you! Python raises AttributeError, rightly so, because indeed the ComputerGroup has no attribute 'criteria'. This attribute is set in the new() method, but not for a ComputerGroup that you pull from the server. I'll have to fix that! In the meantime, if you add the attribute as a list, you'll be good to go.
|
I'm sorry, that's actually wrong.
You should be able to do this to "find" it and assign it to
|
Bingo! Works like a charm. |
I'm going to keep this open so I remember to fix it! |
I am able to insert criteria with the add_criterion method, but all added criteria are set to and/or="and" even if I use "or" when I call it. The smartGroup.save() actually sets all criteria in the smart group to "and", even ones that were previously created on the JSS. |
@sbrosnihan I just added in the code to (at least) handle your first question about this issue. It's in testing now-should get released in the next 24 hours to production/master. As for the issue about "or" getting switched to "and", I just tried it on jss v9.6 and it successfully lets me set "or" for the "and_or" part of a criterion. Just playing around, I did see that I could add a criterion with wacky values and it just smoothes them over. For example:
results in a smart group with the above criteria's and_or value set to "and", despite clearly being asked to set it to tacos. I'm sure this is a dumb question, but are you sure you're setting the and_or to the string value "or"? The python_jss end of it does zero validation, so it will happily let you assign any value to and_or, and it appears that the JSS will happily accept anything, and just turn it into "and". Why this would then "and" all of your other criteria, I'm not sure! If this is still an issue for you, let's open another issue to handle it, since the initial one here is now solved. Thanks! |
Thanks for all the hard work on this. It sure makes interacting with the JSS API easier! I have a problem that may be related to improper usage by me or a bug. I've created a variable:
When trying to add criteria to smartGroup (which is a smart group), I get the following error:
I can see the contents of the group and criteria, also inspect.getargspec(smartGroup.add_criterion)
returns this:
The text was updated successfully, but these errors were encountered: