fixes packaging V0.8.3

Sun, 25 Mar 2018 18:08:13 +0200

author
Malte Bayer <mbayer@neo-soft.org>
date
Sun, 25 Mar 2018 18:08:13 +0200
branch
packaging
changeset 65
5b4234e20fc9
parent 64
da8bba34e7e1
child 66
393aa36f48d6

fixes

victrond/config.py file | annotate | diff | comparison | revisions
victrond/victrond.py file | annotate | diff | comparison | revisions
--- a/victrond/config.py	Sat Nov 25 02:32:50 2017 +0100
+++ b/victrond/config.py	Sun Mar 25 18:08:13 2018 +0200
@@ -12,7 +12,6 @@
 SHUTDOWN_CMD = "/usr/lib/victrond/scripts/shutdown.sh now"  # which command should be executed after shutdown delay?
 
 # HTTP SERVER CONFIGURATION
-#HTTP_ENABLED = True # OBSOLETE
 HTTP_IP = "0.0.0.0"  # http listen ip (0.0.0.0 = all interfaces)
 HTTP_PORT = 500
 
--- a/victrond/victrond.py	Sat Nov 25 02:32:50 2017 +0100
+++ b/victrond/victrond.py	Sun Mar 25 18:08:13 2018 +0200
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 """
 Victron UPS Daemon with Webinterface
-2010-2014 by NeoSoft - Malte Bayer
+2010-2018 by NeoSoft - Malte Di Donato
 Contributions: Tobias Paepke
 """
 import os
@@ -18,6 +18,7 @@
 from structures import *
 import tools
 from tools import bstr_pos, test_bit, mail_deliver, tmpl_replace
+
 from config import BATTERYVOLTAGE, LOG_INFOS, LOG_DEBUG, NOTICE_EMAIL, \
     SHUTDOWN_DELAY, SHUTDOWN_POSTDELAY, SHUTDOWN_BATTERYLEFT, SHUTDOWN_CMD, \
     HTTP_AUTH_STATUS, HTTP_AUTH_SETTINGS, HTTP_IP, HTTP_PORT, \
@@ -997,23 +998,23 @@
     
 
 # BEGIN MAIN
-def main():
+if __name__ == "__main__":
     tools.rrd_check()
 
     if SHUTDOWN_POSTDELAY < 60:
         SHUTDOWN_POSTDELAY = 60
 
     try:
-        if HTTP_ENABLED:
-            if HTTP_AUTH_SETTINGS == "":
-                print ""
-                print "!!! EMPTY SETTINGS PASSWORD, DISABLING THE WEBSERVER !!!"
-                print ""
-                HTTP_ENABLED = False
-            else:
-                HTTP = VictronHttpThread(HTTP_IP, HTTP_PORT)
-                HTTP.setDaemon(1)
-                HTTP.start()
+        if HTTP_AUTH_SETTINGS == "":
+            print ""
+            print "!!! EMPTY SETTINGS PASSWORD, DISABLING THE WEBSERVER !!!"
+            print ""
+            HTTP_ENABLED = False
+        else:
+            HTTP = VictronHttpThread(HTTP_IP, HTTP_PORT)
+            HTTP.setDaemon(1)
+            HTTP.start()
+            HTTP_ENABLED = True
         global UPS
         UPS = VictronUps(SERIAL_DEV)
         print "Starting Serial polling loop..."
@@ -1025,6 +1026,3 @@
         print "Exiting..."
         if HTTP_ENABLED:
             HTTP.server.socket.close()
-
-if __name__ == "__main__":
-    main()

mercurial