lindegroup / autopkgr

AutoPkgr is a free Mac app that makes it easy to install and configure AutoPkg.
http://www.lindegroup.com/autopkgr
Apache License 2.0
535 stars 51 forks source link

Returned non-zero exit status 97 #231

Closed gerardweese closed 9 years ago

gerardweese commented 9 years ago

When running Autopkgr I am currently getting [Error] subprocess.CalledProcessError: Command '['mount', '-t', 'afp', 'afp://casperadmin:Some%20Pass%20Word!@the.casper.server:548/CasperShare', '/Volumes/CasperShare']' returned non-zero exit status 97.

I can post the entire traceback if that helps.

eahrold commented 9 years ago

@gerardweese, Not sure if this is the case, but recently jss-autopkg-addon started automatically url encoding password. Did you manually encoded your password before entering it into AutoPkgr? If so it may just be an issue that it's getting double encoded, and you should be able to enter it unaltered now.

gerardweese commented 9 years ago

@eahrold If your talking about what I think you are, I'm aware of the change, I have now been entering my passwords in "raw" text I.E. no escape codes.

eahrold commented 9 years ago

Yeah, that's the change. Can you tell me if the url encoding you were using is the same that's appearing in the subprocess command now? There is some discrepancy as to whether the "!" (and a few select others) needs encoding. In my tests it didn't, but that's not to say it works across the board.

gerardweese commented 9 years ago

@eahrold The subprocess prints back only the white space as encoded with "%20" while it leaves the special character as is. Originally I was using %21 for my special character prior to the update and I did not need to encode the spaces. For example: If my password is "I Drive Fast!" and that is exactly the text I put in. The error would return "I%20Drive%20Fast!"

eahrold commented 9 years ago

OK, spaces in passwords was not something that even crossed my mind during testing. In testing my password was !@#$%^*() which became !%40%23%24%25%5E%26*() and worked just fine. I'll do some more tests with spaces in the password, and see if I can figure it out.

eahrold commented 9 years ago

So I just changed my password to Rock And Roll! which was encoded into Rock%20And%20Roll! and that still worked fine for me, so I'm at a loss.

Password look right for the DP here (un-escaped)?

defaults read com.github.autopkg JSS_REPOS

You could also try going into /Library/Python/2.7/site-packages/python_jss-0.5.2-py2.7.egg/jss/distribution_points.py

and change line 407 from

return urllib.quote(upass, safe='~()*!.\'')

with

return urllib.quote(upass)

So all characters are escaped.

sheagcraig commented 9 years ago

The ! is definitely a reserved character in the shell, so I'm confused that it worked for @eahrold but not @gerardweese. I have to imagine that the ! is the issue though. I imagine even changing line 407 as per the above suggestion to

return urllib.quote(upass, safe='~()*.\'')

to remove ! from the "safe" characters would work too.

eahrold commented 9 years ago

And for some background I chose the safe string set to mimic javascript's encodeURIComponent() method. Here's some good info on that. http://xkr.us/articles/javascript/encode-compare/ So even though ! is a reserved shell character, it should be fine in a quoted url request. But then again, we're not using javascript, so it could very well need tweaking.

@gerardweese if you're able to figure out which character is causing problems, it's an easy adjustment to make and I'm sure helpful for others.

gerardweese commented 9 years ago

@eahrold @sheagcraig both options are definitely worth a try, I will look at it this Friday. My suspicious since it worked for @eahrold that there is another issue at play.

gerardweese commented 9 years ago

@eahrold this issue is no longer a problem for me. It is worth noting that I did change my passwords to remove white spaces. @sheagcraig