]> git.ipfire.org Git - oddments/fireinfo.git/commitdiff
Add option to disable to send the profile.
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 1 Dec 2010 16:31:56 +0000 (17:31 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 1 Dec 2010 16:31:56 +0000 (17:31 +0100)
sendprofile

index 453e5e17492f8c590bf49ced71de9a85f0cdb77c..0c8a0b5cc580f07504d6a1c17215ef46be150906 100644 (file)
@@ -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