project-imas / mdm-server

Sample iOS MDM server
601 stars 150 forks source link

device.py about ProfileList not escape properly #13

Closed horsley closed 10 years ago

horsley commented 10 years ago

after try the command IntallProfile (I had make a ne profile about paord policy for testing, ovveride the Example.mobileconfig), the console keep throwing error persistent at server.py line 468, while web management page ajax request device list, the python function there output the device list in json, but seems that the profile field was not escape properly, cause "XXX is not json serializable" exception. c8947ae6-3ce5-456d-998a-20e742755a69

thrasr commented 10 years ago

A number of the commands contain data that doesn't play nicely with JSON. We've found and implemented fixes for 4 of them so far - but it looks like InstallProfile is another one. I'll have to check what exactly is breaking the JSON and add an exception to the device class.

For now, removing devicelist.pickle (renaming it to devicelist.pickle.bak is a safe way to do this) will reset your devices and this error won't appear unless you use InstallProfile again before it is fixed. If you have a large number of devices that you don't want, then you can try to edit the devicelist.pickle file and remove the problem data (usually a datetime or data object that cannot be serialized) by changing the string in question to a valid string of some sort.

thrasr commented 10 years ago

Should be fixed with 0a5380d9ea9534af16e8530f9f05f61cea128812.

Let me know how it works.