sheagcraig / SavingThrow

Flexible adware file detection and removal. +1
GNU General Public License v3.0
66 stars 12 forks source link

JAMF-Arguments not processing removal #2

Closed FredCox3 closed 9 years ago

FredCox3 commented 9 years ago

Switching over from Twitter so I don't blow up your feed.

I added a print(args) when running from a Policy on the JSS. Here's a sample output:

Script result: Namespace(jamf-arguments=['/', 'ComputerName', 'SelfServiceUsername', '-r', '', '', '', '', '', '', ''], quarantine=False, remove=False, stdout=False, verbose=False)

Since the jamf-arguments are a seperate list, it doesn't appear the if args.remove is picking up that -r has been passed from Casper so it just runs the else condition.

sheagcraig commented 9 years ago

Take a peek at the diff-my mistake was thinking that the positional args from JAMF would come before the optional args. In fact, it's the opposite.

argparse has a parse_known_args() method which splits the args into a namespace dict and a tuple of unrecognized arguments which serves to just toss away the unused $1-$3 from JAMF.