-
Notifications
You must be signed in to change notification settings - Fork 22
Getting packages not listed in my jss #6
Comments
Whoa! That sounds wild. I imagine it's quite possible that fileshare DP's get out of sync with the DB/Casper server. I would think that whatever you get out of the Packages page or the API page's Packages endpoint would be what it thinks you have. So that's one thing to double-check. But I would think that whatever it is spitting out to spruce is what is actually present in the database, even if the files don't exist on the DP's. I'm about to drop a big bad new Spruce that has WAY more reporting features, so look out for that soon too. |
OK will see what the new version brings, thanks. I did do a db clean up and try again, still getting jss.exceptions.JSSGetError: Response Code: 404 Response: Not Found. The server has not found anything matching the request URI but will try again when the new version comes.
|
This is from when you're trying to remove package objects that you just got spit out from the reports side of spruce? I can imagine that the names don't transfer over correctly perhaps if they have spaces or something that I didn't account for-stuff that needs quoting/escaping, like unicode or accents or umlauts or whatnot? (This is why the new version will output in plist format and use that plist for removal. For the time being, you could comment out the packages that are causing problems; you could probably even use that to determine whether it's ALL packages or just certain ones, and maybe we can narrow down why it isn't working. Our school year is starting up, so my predications for a release are all messed up! |
Ok, so tested by taking out anything with a space or '-' in it, then got ./Spruce.py -v --remove output.txt Then tried individual removes ./Spruce.py -v --remove CommonServices.pkg And that package is definitely there
|
Yeha-you won't be able to remove anything directly with the --remove arg. It uses that argument to open a file named "CommonServices.pkg" which contains the list; not to remove a package named "CommonServices.pkg". |
Haha, ok. |
That's super annoying> Hopefully the update will solve all of those issues then. (And no doubt create new ones ;) |
I'm seeing the exact same thing. List created with --report, edited, and when attempt to use it with --remove exact same error as charliwest. |
@kernsb (and @charliwest ) I'm finishing up the XML output of the testing version (actually it's in its own branch atm). After that, I'm onto writing the removal function. This time around, it will log failures to remove things (like your mystery packages that don't exist) but it won't bring the program to a halt. |
All right so a new variant on this since 2.0 ... this may warrant a separate Issue. So, similar to the previous issue, I'm still seeing issues with the removals, now specified in the XML file. It removes the first file specified in the list from the file share, but then chokes on removing it from the JSS database with a similar error as before.
Again, the end result here is that referenced file is gone from the DP, but the entry for the "Package" still exists in the JSS, and no further items are processed. |
@kernsb Do you have a JDS? Does the filename not match the display name for your packages? |
@sheagcraig We do have a JDS as well as a File Share DP. In this case (and a previous one I tried moments before) the Filename and Display Name do match. However, I have seen instances where they have not matched in this setup (I inherited this JSS and am trying to get it all in order). |
Aha! This all makes sense now. Again, I don't have a test server, so the removal algorithm is my best guess. Here's what happens:
AND I didn't catch JSSGetError's; just OSError (which is the exception you get when you try to delete a file that doesn't exist). So, if you want to try adding this:
to line 1880 (so it looks like this):
and then run again, let me know how it goes. If it works, I'll rush that out as the first 2.0 update. |
Ok, so that worked! It let it complete without error and the packages are gone from the DP. Here's the interesting thing that happened next. I opened Casper Admin to confirm that they were gone, and at open entries for many of the things I just removed were re-created. And it looks like these are the ones, as you had mentioned, where the Display Name did not match the Filename. |
It's not super clear to me what the interaction is between Display Name and Filename, and honestly I wish it would just go away! As a rule, we do NOT use different names, so this issue is a non-issue. Hopefully you can just manually remove those divergent-named packages through the web interface and get them to "stay dead". |
Sounds good. I think that will work, and it will not be a problem for me moving forward, as I don't use the Display Name. So, yes, your code handled it perfectly then! |
Long term it would be best for me to find a way to handle this. Do you know, when you do an API GET for packages, using the name, does it use filename or display name (or both)? (I would just try it through the https://yourjss.org:8443/api/ page. Do the Packages/GET/Get packages by name query and see if which of the names it works for (on a package that still exists, but has different file/display names). |
The get packages by name query on the API page works with the Display Name, but not with the Filename, when they differ. |
Indeed-looking at the xml for a package the "name" property must correspond to "display name", since there's also a "filename". I'll have to fix that in python-jss and probably here too. It may be awhile before that change gets made, so I think you'll unfortunately be best off either getting the names to match or deleting them manually. |
No problem. Thanks for all of your help! |
Try the testing branch Spruce. I just added a thing to use filename for package and script file deletion instead of display name. |
Nope. Same behavior. If I open Casper Admin after it is removed, it adds it back like before. I did notice that the entry it creates uses the original filename for both the new Display Name and Filename. I also ran Spruce against it a second time, now with the names matching, and it removed it again .... And it came back yet again. If I finally delete the recreated item using Casper Admin, it stays gone for good. I'm thinking it may be doing this with every package that was deleted and not just the mismatched name ones. I'll investigate more and let you know what I find. |
Also, may need to do something similar for Scripts (and other objects) as we did for Packages. When I remove scripts I get responses such as
for each script in the list. |
That's a strange one-that's from the very first deletion, where it tries to get the db object from the JSS and then delete it. The problem is-it uses ID, so if that script actually exists, the GET should succeed. |
Interesting. Apart from the message for each item the operation was successful - the specified scripts were deleted. |
That's weird. |
@kernsb @charliwest since this issue has sat here for 4 years and many things have changed since then, I'm going to close it, but reply if you are still experiencing the issues. |
When I run this I get packages in the output that aren't listed in my jss, then if I try and run it to remove them all I get errors.
Are there perhaps packages I'm not seeing for some reason?
The error is
./Spruce.py --remove output.txt
Traceback (most recent call last):
File "./Spruce.py", line 367, in
main()
File "./Spruce.py", line 363, in main
remove(j, removal_set)
File "./Spruce.py", line 220, in remove
j.distribution_points.delete(item)
File "/Library/Python/2.7/site-packages/python_jss-1.2.0-py2.7.egg/jss/distribution_points.py", line 246, in delete
repo.delete(filename)
File "/Library/Python/2.7/site-packages/python_jss-1.2.0-py2.7.egg/jss/distribution_points.py", line 870, in delete
self.connection['jss'].Package(filename).delete()
File "/Library/Python/2.7/site-packages/python_jss-1.2.0-py2.7.egg/jss/jss.py", line 421, in Package
return self.factory.get_object(Package, data)
File "/Library/Python/2.7/site-packages/python_jss-1.2.0-py2.7.egg/jss/jss.py", line 524, in get_object
xmldata = self.jss.get(url)
File "/Library/Python/2.7/site-packages/python_jss-1.2.0-py2.7.egg/jss/jss.py", line 231, in get
self._error_handler(JSSGetError, response)
File "/Library/Python/2.7/site-packages/python_jss-1.2.0-py2.7.egg/jss/jss.py", line 185, in _error_handler
raise exception
jss.exceptions.JSSGetError: Response Code: 404 Response: Not Found. The server has not found anything matching the request URI
The text was updated successfully, but these errors were encountered: