jssimporter / python-jss

python-jss is deprecated. Please see the wiki for alternatives.
GNU General Public License v3.0
102 stars 41 forks source link

cURL adapter attempts to use a File object in a dict comprehension #68

Closed mosen closed 6 years ago

mosen commented 6 years ago

subprocess seems to bail when it encounters a list that contains a File object, example print debug:

['curl', '-u', 'admin:password', '--silent', '--write-out', '|%{response_code}', 
'--insecure', '--tlsv1', '--header', 'Accept: application/xml', '--header', 'Content-Type: text/xml', 
'--header', 'FILE_TYPE', '--header', 'FILE_NAME', '--header', 'DESTINATION',
 '--header', 'OBJECT_ID', '--data', <open file u'/Users/admin/Library/AutoPkg/Cache/com.github.jss-recipes.jss.iTerm2/iTerm2-3.1.5.pkg', mode 'rb' at 0x10d0d1f60>, 
'--request', 'POST', u'https://localhost:8444/dbfileupload']

This may or may not be the issue affecting CDP.

mosen commented 6 years ago

Added another commit which resolves request headers not being properly supplied to curl eg. OBJECT_ID instead of OBJECT_ID: 1 due to a statement being array += dict.

sheagcraig commented 6 years ago

OMG. I've been in holiday ignoring-Github land. Seems as if you've been busy. Can you give me a summary of what all is going on here, and where you are? Thanks!

mosen commented 6 years ago

Sorry this went a bit insane, and I didn't end up making feature branches for every added feature. The summary:

Thats about it!

mosen commented 6 years ago

Worth mentioning that the NSURLSessionAdapter would break uploads in its current state so hold off :)

sheagcraig commented 6 years ago

I'm down for everything that's going on here. It's such a huge change that I'm wondering how to merge it though.

Also, about the tests: They are definitely tied to a JSS I used to have, so they won't even run now. My understanding is that they should still run under pytest (and that's what I would use if I get around to updating them). They just need to be updated to mock out the responses that I have hardcoded in (and had an actual server to respond to).

mosen commented 6 years ago

This is 342 commits ahead of your fork haha. No chance of merging anything. I need to examine how I can divide the spaghetti using surgical precision git cherry-pick or maybe a file by file basis

mosen commented 6 years ago

ok im assessing how to split this.

probably:

Rather than cherry pick the commits i feel like starting new ones on a new branch in case there are commits that run across those functions.

mosen commented 6 years ago

Split into multiple PRs