The unified diff between revisions [8212e04c..] and [f0d24753..] is displayed below. It can also be downloaded as a raw diff.
#
#
# patch "client/phonehome.py"
# from [6a427e58b84966d046a93af27db27d8aa3c6f436]
# to [f1e1874a134a2877f66f21f014ac0d4b98883fc2]
#
============================================================
--- client/phonehome.py 6a427e58b84966d046a93af27db27d8aa3c6f436
+++ client/phonehome.py f1e1874a134a2877f66f21f014ac0d4b98883fc2
@@ -8,23 +8,32 @@
# client<->server communication happens over SOAP
#
+from getopt import getopt
import sys
import os
import config
import traceback
-import ZSI
-from ZSI.client import Binding
-
urgency = { 'info' : 0, 'notice' : 1, 'warning' : 2, 'alert' : 3, 'critical' : 4 }
if __name__ == '__main__':
+ opts, args = getopt(sys.argv[1:], 'n')
+ skip_network = False
+ for opt, value in opts:
+ if opt == '-n':
+ skip_network = True
+
# load each of the plugins
results = []
sys.path.insert(0, config.plugin_path)
+
+ binding = None
+ if not skip_network:
+ import ZSI
+ from ZSI.client import Binding
- # SOAP connection to send information back
- soap_password = open(os.path.join(config.install_path, 'etc', 'client.pass')).readline().strip()
- b = Binding(url=config.soap_address, host=config.soap_host, auth=(ZSI.AUTH.httpbasic, 'phonehome', soap_password), tracefile=open('trace.txt', 'w'))
+ # SOAP connection to send information back
+ soap_password = open(os.path.join(config.install_path, 'etc', 'client.pass')).readline().strip()
+ b = Binding(url=config.soap_address, host=config.soap_host, auth=(ZSI.AUTH.httpbasic, 'phonehome', soap_password), tracefile=open('trace.txt', 'w'))
# run each plugin
for plugin_name in config.plugins:
@@ -45,7 +54,11 @@ if __name__ == '__main__':
result = [(plugin_name,) + t for t in result]
results += result
- b.plugin_results(results)
+ if skip_network:
+ print >>sys.stderr, "Transmission to network server skipped. Results are:", results
+ else:
+ b.plugin_results(results)
+
sys.exit(0)
# not for now.. perhaps do this as a plugin instead