From 4f945ba715a09fb2425e3a40e9bb1783e45f86c5 Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Tue, 9 Oct 2012 16:29:27 -0500
Subject: LinHES-config: timezip.py, mv_ir.py timezip.py   some cleanup in how
 things are synced for the nfsshares.  Now it will only sync if the BE has a
 central config AND hosthareall is not selected

mv_ir.py  remove logging statement about change_channel
---
 abs/core/LinHES-config/PKGBUILD   |  2 +-
 abs/core/LinHES-config/mv_ir.py   |  2 +-
 abs/core/LinHES-config/timezip.py | 84 +++++++++++++++++++++------------------
 3 files changed, 48 insertions(+), 40 deletions(-)

diff --git a/abs/core/LinHES-config/PKGBUILD b/abs/core/LinHES-config/PKGBUILD
index ebbabdc..28aa79e 100755
--- a/abs/core/LinHES-config/PKGBUILD
+++ b/abs/core/LinHES-config/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=LinHES-config
 pkgver=2.3
-pkgrel=170
+pkgrel=171
 conflicts=(MythVantage-config MythVantage-config-dev LinHES-config-dev LinHes-config )
 pkgdesc="Install and configure your system"
 depends=('bc' 'libstatgrab'  'mysql-python' 'expect' 'curl' 'dnsutils' 'parted'
diff --git a/abs/core/LinHES-config/mv_ir.py b/abs/core/LinHES-config/mv_ir.py
index b38c84e..f0863c4 100755
--- a/abs/core/LinHES-config/mv_ir.py
+++ b/abs/core/LinHES-config/mv_ir.py
@@ -213,7 +213,7 @@ def setup_blaster_proto(HostBlasterType,Hostnumblaster,TEMPLATES,systemconfig):
                 include_file("/etc/lircd.conf",template)
             else:
                 logging.debug("    template: %s is not present",template)
-    logging.info("------NEED TO SETUP CHANGE_CHANNEL------")
+
 
 
 def setup_blaster_transmiter(HostBlasterType):
diff --git a/abs/core/LinHES-config/timezip.py b/abs/core/LinHES-config/timezip.py
index 82efefc..c6c68d1 100755
--- a/abs/core/LinHES-config/timezip.py
+++ b/abs/core/LinHES-config/timezip.py
@@ -86,8 +86,9 @@ def printvars():
     print "timezone region:" + tz_region
     print "timezone subregion:" + tz_subregion
     print "nfsip:" + nfsip
-    #print "nfstoggle:" + nfstoggle
+    print "nfstoggle:" + nfstoggle
     print "nfsmount:"  + nfsmount
+    print "nfsshare:"  + nfsshareall
     #print "hobbitclient:" + hobbitclient
     print "windowmanager:" + windowmanager
     print "windowmanager style:" + wmstyle
@@ -107,8 +108,9 @@ def selectvars():
     global tz_region
     global tz_subregion
     global nfsip
-    #global nfstoggle
+    global nfstoggle
     global nfsmount
+    global nfsshareall
     #global hobbitclient
     global windowmanager
     global wmstyle
@@ -135,12 +137,12 @@ def selectvars():
     except TypeError:
         nfsip=""
 
-    #cursor.execute("select data from settings where value='HostHaveCentralNFS' and hostname=(%s)",(BEhostname))
-    #result = cursor.fetchone()
-    #try:
-        #nfstoggle=result[0]
-    #except TypeError:
-        #nfstoggle=""
+    try:
+        cursor.execute("select data from settings where value='HostHaveCentralNFS' and hostname=(%s)",(BEhostname))
+        result = cursor.fetchone()
+        nfstoggle=result[0]
+    except TypeError:
+        nfstoggle="no"
 
 
     try:
@@ -150,6 +152,14 @@ def selectvars():
     except TypeError:
         nfsmount=""
 
+    try:
+        cursor.execute("select data from settings where value='HostCentralNFSallhosts' and hostname=(%s)",(BEhostname))
+        result = cursor.fetchone()
+        nfsshareall=result[0]
+    except TypeError:
+        nfsshareall="0"
+
+
 
     try:
         #cursor.execute("select data from settings where value='HostTimeZonetemp' and hostname=(%s)",(BEhostname))
@@ -280,36 +290,34 @@ def insertvars():
 
 
 ##start of NFSIP
-
-    if ( nfsip != ""):
-        cursor.execute("select data from settings where value='HostCentralNFSIP' and hostname=(%s)",(thishostname))
-        result = cursor.fetchone()
-        if (result == None):
-            cursor.execute("INSERT INTO  settings (value,data,hostname) VALUES ('HostCentralNFSIP',(%s),(%s))",(nfsip,thishostname))
-            print "inserting nfsip"
-        else:
-            no_update("HostCentralNFSIP")
-            #cursor.execute("update settings set data=(%s) where hostname=(%s) and value='HostCentralNFSIP'",(nfsip,thishostname))
-            #print "updating nfsip"
-
-    #if (nfstoggle != ""):
-        #cursor.execute("select data from settings where value='HostHaveCentralNFS' and hostname=(%s)",(thishostname))
-        #result = cursor.fetchone()
-        #if (result == None):
-            #cursor.execute("INSERT INTO  settings (value,data,hostname) VALUES ('HostHaveCentralNFS',(%s),(%s))",(nfstoggle,thishostname))
-            #print "inserting nfstoggle"
-
-    if ( nfsmount !="") :
-        cursor.execute("select data from settings where value='HostNFSmountpoint' and hostname=(%s)",(thishostname))
-        result = cursor.fetchone()
-        if (result == None):
-            cursor.execute("INSERT INTO  settings (value,data,hostname) VALUES ('HostNFSmountpoint',(%s),(%s))",(nfsmount,thishostname))
-            print "inserting nfsmountpoint"
-        else:
-            no_update("nfsmount")
-            #cursor.execute("update settings set data=(%s) where hostname=(%s) and value='HostNFSmountpoint'",(nfsmount,thishostname))
-            #print "updating nfsmount"
-
+    if nfstoggle == "yes" :
+        print "BE has a central storage"
+        #if nfsshareall == "0":
+            #print "BE is not sharing central, starting config"
+        if ( nfsip != ""):
+            cursor.execute("select data from settings where value='HostCentralNFSIP' and hostname=(%s)",(thishostname))
+            result = cursor.fetchone()
+            if (result == None):
+                cursor.execute("INSERT INTO  settings (value,data,hostname) VALUES ('HostCentralNFSIP',(%s),(%s))",(nfsip,thishostname))
+                print "inserting nfsip"
+            else:
+                no_update("HostCentralNFSIP")
+                #cursor.execute("update settings set data=(%s) where hostname=(%s) and value='HostCentralNFSIP'",(nfsip,thishostname))
+                #print "updating nfsip"
+        if ( nfsmount !="") :
+            cursor.execute("select data from settings where value='HostNFSmountpoint' and hostname=(%s)",(thishostname))
+            result = cursor.fetchone()
+            if (result == None):
+                cursor.execute("INSERT INTO  settings (value,data,hostname) VALUES ('HostNFSmountpoint',(%s),(%s))",(nfsmount,thishostname))
+                print "inserting nfsmountpoint"
+            else:
+                no_update("nfsmount")
+                #cursor.execute("update settings set data=(%s) where hostname=(%s) and value='HostNFSmountpoint'",(nfsmount,thishostname))
+                #print "updating nfsmount"
+        #else:
+            #print "BE is sharing, config sync skipped"
+    else:
+        print "BE has no central storage"
 
     #windowmanager
     if windowmanager != "":
-- 
cgit v0.12

