jssimporter / Spruce

Spruce is deprecated. Please see the wiki for alternatives.
GNU General Public License v3.0
148 stars 22 forks source link

Error when using --remove option #14

Closed quovadimus closed 8 years ago

quovadimus commented 8 years ago

Hoping you may be able to provide some insight on an error I'm getting when I attempt to use the --remove option with an xml file. This is what I'm seeing:

computername:~ username$ ~/Desktop/spruce.py --remove ~/Desktop/test3.xml 
Are you sure you want to continue deleting objects from https://jssaddress.company.com? (Y or N): y
ComputerGroup object 999: Name of a Computer Group deleted.
Traceback (most recent call last):
  File "/Users/username/Desktop/spruce.py", line 1949, in <module>
    main()
  File "/Users/username/Desktop/spruce.py", line 1943, in main
    remove(removal_tree)
  File "/Users/username/Desktop/spruce.py", line 1873, in remove
    if item.tag in needs_file_removal and file_type_removals:
UnboundLocalError: local variable 'needs_file_removal' referenced before assignment

It results in the first item in the list being removed and then stopping with the above error.

Thanks!

kitzy commented 8 years ago

I'm seeing identical behavior.

ComputerGroup object 28: Microsoft Outlook - Update deleted. Traceback (most recent call last): File "/Users/username/Desktop/spruce.py", line 1931, in main() File "/Users/username/Desktop/spruce.py", line 1925, in main remove(removal_tree) File "/Users/username/Desktop/spruce.py", line 1873, in remove if item.tag in needs_file_removal and file_type_removals: UnboundLocalError: local variable 'needs_file_removal' referenced before assignment

homebysix commented 8 years ago

Yes, I'm seeing this too. I actually think it may be the same root cause as #15, because in both cases the failure happens after the first object is removed.

sheagcraig commented 8 years ago

Uh oh! Thanks for the input folks. I'll take a look at this soon. I'm sure it's some poor coding on my part that needs_file_removal can get to that line without existing. If anyone wants to send a PR, that would definitely get it fixed even quicker!

homebysix commented 8 years ago

Ask and ye shall receive.

sheagcraig commented 8 years ago

Those folks on this issue, can we close this now?

homebysix commented 8 years ago

OK to close.