summaryrefslogtreecommitdiffstats
path: root/abs/core/LinHES-config/timezip.py
diff options
context:
space:
mode:
Diffstat (limited to 'abs/core/LinHES-config/timezip.py')
-rwxr-xr-xabs/core/LinHES-config/timezip.py84
1 files changed, 46 insertions, 38 deletions
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 != "":