timsutton/mcxToProfile

Bullets in Key Names Causes Script Error

Closed this issue · 2 comments

When importing MCX from a Directory Service (Apple OD), a key with a bullet in the name causes the script to fail:

admin:~ admin$ /Users/admin/Desktop/mcxToProfile-master/mcxToProfile.py --dsobject /LDAPv3/theodserver.ad.mdp.com/Computers/guest --identifier MyBasePreferences
Traceback (most recent call last):
File "/Users/admin/Desktop/mcxToProfile-master/mcxToProfile.py", line 450, in
main()
File "/Users/admin/Desktop/mcxToProfile-master/mcxToProfile.py", line 441, in main
mcx_data = getMCXData(options.dsobject)
File "/Users/admin/Desktop/mcxToProfile-master/mcxToProfile.py", line 304, in getMCXData
mcx_item_data = readPlistFromString(str(mcx_item))
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2022' in position 462: ordinal not in range(128)

The key in question is an old set of keys under the com.apple.internetconfig domain from years past:

http://pastie.org/8153682

Deleting the domain allows the script to work normally.

@foigus, just committed a small fix (ea0f23f) that resolved it on my end, using a constructed ds record based on yours. Can you test against yours and post here if it fixed it?

Looks like that did it--thanks!