mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-21 18:41:03 +00:00
Plugin tor_: handle missing dependency during "fetch" or "config"
This commit is contained in:
parent
f06ee36a05
commit
179f04721a
1 changed files with 7 additions and 2 deletions
|
@ -81,10 +81,11 @@ try:
|
|||
import stem
|
||||
import stem.control
|
||||
import stem.connection
|
||||
except ImportError:
|
||||
missing_dependency_error = None
|
||||
except ImportError as exc:
|
||||
# missing dependencies are reported via "autoconf"
|
||||
# thus failure is acceptable here
|
||||
pass
|
||||
missing_dependency_error = str(exc)
|
||||
|
||||
default_torcachefile = 'munin_tor_country_stats.json'
|
||||
default_torconnectmethod = 'port'
|
||||
|
@ -517,6 +518,10 @@ def main():
|
|||
TorPlugin.suggest()
|
||||
sys.exit()
|
||||
else:
|
||||
if missing_dependency_error is not None:
|
||||
print("Failed to run tor_ due to missing dependency: {}"
|
||||
.format(missing_dependency_error), file=sys.stderr)
|
||||
sys.exit(1)
|
||||
# detect data provider
|
||||
if __file__.endswith('_bandwidth'):
|
||||
provider = TorBandwidth()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue