From: Michael Tremer Date: Wed, 1 Dec 2010 16:31:56 +0000 (+0100) Subject: Add option to disable to send the profile. X-Git-Tag: v0.4~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3fde7e2745535c0c3b148c1be4373eea86dfb8c1;p=oddments%2Ffireinfo.git Add option to disable to send the profile. --- diff --git a/sendprofile b/sendprofile index 453e5e1..0c8a0b5 100644 --- a/sendprofile +++ b/sendprofile @@ -3,12 +3,15 @@ import json import logging import logging.handlers +import os import sys import urllib import urllib2 import fireinfo +ENABLED_FILE = "/var/ipfire/main/send_profile" + log_level = logging.INFO if "-d" in sys.argv: log_level = logging.DEBUG @@ -51,14 +54,18 @@ def main(): # Collect system information system = fireinfo.System() + profile = system.profile() # If --dump is passed -> only dump the output. if "--dump" in sys.argv: - print json.dumps(system.profile(), sort_keys=True, indent=4) + print json.dumps(profile, sort_keys=True, indent=4) return 0 + if not os.path.exists(ENABLED_FILE): + del profile["profile"] + try: - send_profile(system.profile()) + send_profile(profile) except urllib2.URLError: return 1