Skip to content

Commit

Permalink
fix ensure --extra-args is string and not None, if None it adds None …
Browse files Browse the repository at this point in the history
…word in the cmdline and breaks the commands
  • Loading branch information
pablodav committed Sep 12, 2018
1 parent ca7462b commit 96f7893
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion curlnagios/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def parse_args(args):

parser.add_argument('-u', '--url', dest='url', nargs='?', default=None, const=None,
help='url to check \n')
parser.add_argument('-e', '--extra_args', dest='extra_args', nargs='?', default=None, const=None,
parser.add_argument('-e', '--extra_args', dest='extra_args', nargs='?', default='', const=None,
help='extra args to add to curl, see curl manpage \n')

# Arguments to check using OAuth2
Expand Down
4 changes: 2 additions & 2 deletions curlnagios/plugin_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import subprocess

class curlCheck:
def __init__(self, URL, extra_args, auth_args=''):
def __init__(self, URL, extra_args='', auth_args=''):
"""
:param URL: provide url to get/put data.
:param extra_args: any argument for curl command
Expand Down Expand Up @@ -36,7 +36,7 @@ def collect_data(self):
"""
### some code here
### or calling external modules
cmdline = "curl {} {} --fail -s -o /dev/null {} -w \\ {}".format(self.url, self.auth_args, self.extra_args, self.std_args)
cmdline = "curl {} --fail -s -o /dev/null {} -w \\ {} {}".format(self.url, self.extra_args, self.std_args, self.auth_args)

retrcode, retroutput = subprocess.getstatusoutput(cmdline)
jsonoutput = json.loads(retroutput)
Expand Down
Empty file modified upload.sh
100644 → 100755
Empty file.

0 comments on commit 96f7893

Please sign in to comment.