Unix: make the default ping count configurable (fixes #1187)

Squashed commit of the following:

commit 2952c1f3e3d81a4d473bc7037f3fa9091219e483
Author: James Lu <james@overdrivenetworks.com>
Date:   Sat Sep 23 12:42:05 2017 -0700

    Unix: fix wrong conf var name

commit a3ea173ee0995e9d22472cc569d54d7e65648117
Merge: ca037a94 165d9f25
Author: James Lu <james@overdrivenetworks.com>
Date:   Sat Sep 23 12:41:37 2017 -0700

    Merge branch 'configurable-ping-count' of https://github.com/IotaSpencer/Limnoria into configurable-ping-count

commit 165d9f258f02c5adf0087b164e144038c06a46c4
Author: Ken Spencer <ken@electrocode.net>
Date:   Sat Sep 23 15:39:02 2017 -0400

    Unix: use str() on the integer-type defaultCount so we don't get a TypeError

commit f3b58710752f3b40db44ddc97369e15951563ea7
Author: Ken Spencer <ken@electrocode.net>
Date:   Sat Sep 23 15:35:30 2017 -0400

    Unix: use PositiveInteger so < 0 is inherently invalid

commit b4f9e4fdfffcc75c4803480702271647decf73a0
Author: Ken Spencer <ken@electrocode.net>
Date:   Sat Sep 23 15:03:37 2017 -0400

    Unix: make the default ping count configurable
This commit is contained in:
Ken Spencer 2017-09-23 12:42:22 -07:00 committed by James Lu
parent ca037a94c5
commit 82cdf17964
2 changed files with 3 additions and 1 deletions

View File

@ -108,6 +108,8 @@ conf.registerGroup(Unix, 'ping')
conf.registerGlobalValue(Unix.ping, 'command',
registry.String(utils.findBinaryInPath('ping') or '', """Determines what
command will be called for the ping command."""))
conf.registerGlobalValue(Unix.ping, 'defaultCount',
registry.PositiveInteger(5, """Determines what ping and ping6 counts (-c) will default to."""))
conf.registerGroup(Unix, 'ping6')
conf.registerGlobalValue(Unix.ping6, 'command',

View File

@ -301,7 +301,7 @@ class Unix(callbacks.Plugin):
args.append(str(val))
if '-c' not in args:
args.append('-c')
args.append('5')
args.append(str(self.registryValue('ping.defaultCount')))
args.append(host)
try:
with open(os.devnull) as null: