Open NickyNewp opened 8 years ago
Do you have any mobile devices in your JSS? Did the asset tags import for the computers?
Yes, we have a lot of mobile devices. My spreadsheet only had three asset tags and serials in it, which were all mobile devices. I was just testing the script with a few. The account I created looks like it has the correct permissions for mobile devices.
If you comment the computers() line with a # it should run ok. I will add some better error handling and the ability to turn off one of the functions if it is not in use.
I tried that and still received an error, but it did import. This is what came back to me.
Traceback (most recent call last):
File "jss-assettag.py", line 227 in
Should I continue with the full import even with the error?
I think it is now displaying that because the asset tags you have in the sheet have been imported. I am fairly confident it is displaying that because the list is empty. I need to add some error handling for that.
Brad Schmidt
On Tue, Feb 2, 2016 at 1:11 PM, NickyNewp notifications@github.com wrote:
Should I continue with the full import even with the error?
— Reply to this email directly or view it on GitHub https://github.com/bradschm/jss-assettag-importer/issues/1#issuecomment-178764484 .
I updated the code to include those checks. It will now tell you if the group is empty and you can also turn on/off computer/mobile device modes. Let me know if that will work in your environment.
I will give it a shot tomorrow and let you know. I really appreciate all of your help!
Thanks for the code Brad! Sorry to bring up an old post, but I think I found out why it didn't work for NickyNewp.
I'm running JSS 9.92 and I ran into the same issue with v.2, but I was only looking to update computers not mobile devices. I left "computersMode = True" and commented out the others. On the JSS I manually created a "_API-Asset-Tag-Importer" smart group and set the criteria to "(blank) Asset Tag (is)
The script ran through all through my computer assets that didn't have asset tags and updated everything correctly. It still choked at the end on the mobile devices with the same errors as the top of the post, but I didn't need/create a smart group for mobile, so all was good.
I haven't figured out why the smart groups weren't created in the first place, but I'll check into it some more since I want to see if I can expand the code to update user and location information as well.
Hi @packetrich,
Did you comment the false line out too? That might be the error on that.
I think I see the issue with the group creation, I had it looking for length on a NoneType. I'll switch the logic and do a commit.
Thanks for the feedback!
Hi @packetrich and @NickyNewp,
Please give the new code a try. I cleaned it up and fixed it so it will create the group properly.
Let me know how it goes.
Thanks, Brad
@bradschm I tried to use the new code but it throws an error:
Traceback (most recent call last):
File "jss-assettag-importer.py", line 3, in
@packetrich You will need the requests library. You can get that by running:
If you have pip installed, type: sudo pip install -r requirements.txt If you don't have pip you can use easyInstall to get pip: sudo easy_install pip then run sudo pip install -r requirements.txt
Thanks!
I could use some help figuring out what I am doing wrong here. I heard you speak about this at JNUC and just got around to trying it and I'm having issues. Here is what I am getting back.
---Finished importing asset tags for Computers--- Traceback (most recent call last): File "jss-assettag-importer.py", line 226, in
computers()
File "jss-assettag-importer.py", line 119, in computers
computersTotal = len(computers)
TypeError: object of type 'NoneType' has no len()