Révision 179f0472
Plugin tor_: handle missing dependency during "fetch" or "config"
| plugins/tor/tor_ | ||
|---|---|---|
| 81 | 81 |
import stem |
| 82 | 82 |
import stem.control |
| 83 | 83 |
import stem.connection |
| 84 |
except ImportError: |
|
| 84 |
missing_dependency_error = None |
|
| 85 |
except ImportError as exc: |
|
| 85 | 86 |
# missing dependencies are reported via "autoconf" |
| 86 | 87 |
# thus failure is acceptable here |
| 87 |
pass
|
|
| 88 |
missing_dependency_error = str(exc)
|
|
| 88 | 89 |
|
| 89 | 90 |
default_torcachefile = 'munin_tor_country_stats.json' |
| 90 | 91 |
default_torconnectmethod = 'port' |
| ... | ... | |
| 517 | 518 |
TorPlugin.suggest() |
| 518 | 519 |
sys.exit() |
| 519 | 520 |
else: |
| 521 |
if missing_dependency_error is not None: |
|
| 522 |
print("Failed to run tor_ due to missing dependency: {}"
|
|
| 523 |
.format(missing_dependency_error), file=sys.stderr) |
|
| 524 |
sys.exit(1) |
|
| 520 | 525 |
# detect data provider |
| 521 | 526 |
if __file__.endswith('_bandwidth'):
|
| 522 | 527 |
provider = TorBandwidth() |
Formats disponibles : Unified diff