incubator-tashi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rg...@apache.org
Subject svn commit: r1455136 - in /incubator/tashi/trunk: etc/TashiDefaults.cfg src/tashi/clustermanager/data/getentoverride.py
Date Mon, 11 Mar 2013 13:40:25 GMT
Author: rgass
Date: Mon Mar 11 13:40:25 2013
New Revision: 1455136

URL: http://svn.apache.org/r1455136
Log:
In Telef\'{o}nica we have a very slow ldap server which takes 5 seconds to
respond.  Even with the configurable caching, addingg an option to pull the
administrative database from a local file if specifed.


Modified:
    incubator/tashi/trunk/etc/TashiDefaults.cfg
    incubator/tashi/trunk/src/tashi/clustermanager/data/getentoverride.py

Modified: incubator/tashi/trunk/etc/TashiDefaults.cfg
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/etc/TashiDefaults.cfg?rev=1455136&r1=1455135&r2=1455136&view=diff
==============================================================================
--- incubator/tashi/trunk/etc/TashiDefaults.cfg (original)
+++ incubator/tashi/trunk/etc/TashiDefaults.cfg Mon Mar 11 13:40:25 2013
@@ -62,6 +62,10 @@ allowDuplicateNames = False
 [GetentOverride]
 baseData = tashi.clustermanager.data.Pickled
 fetchThreshold = 60.0
+#  Use local version of getent file
+;getentFromLocalFile = False
+;getentLocalFile = /var/tmp/getent.tmp
+
 
 [LdapOverride]
 baseData = tashi.clustermanager.data.Pickled

Modified: incubator/tashi/trunk/src/tashi/clustermanager/data/getentoverride.py
URL: http://svn.apache.org/viewvc/incubator/tashi/trunk/src/tashi/clustermanager/data/getentoverride.py?rev=1455136&r1=1455135&r2=1455136&view=diff
==============================================================================
--- incubator/tashi/trunk/src/tashi/clustermanager/data/getentoverride.py (original)
+++ incubator/tashi/trunk/src/tashi/clustermanager/data/getentoverride.py Mon Mar 11 13:40:25
2013
@@ -29,6 +29,8 @@ class GetentOverride(DataInterface):
 		self.log = logging.getLogger(__name__)
 		self.baseDataObject = instantiateImplementation(config.get("GetentOverride", "baseData"),
config)
 		self.dfs = instantiateImplementation(config.get("ClusterManager", "dfs"), config)
+		self.useLocal = config.get("GetentOverride", "getentFromLocalFile")
+		self.localFileName = config.get("GetentOverride", "getentLocalFile")
 
 		self.users = {}
 		self.lastUserUpdate = 0.0
@@ -105,7 +107,18 @@ class GetentOverride(DataInterface):
 		now = time.time()
 		if (now - self.lastUserUpdate > self.fetchThreshold):
 			myUsers = {}
-			p = subprocess.Popen("getent passwd".split(), stdout=subprocess.PIPE)
+            #  Use local getent file instead of querying the administrative db
+			if self.useLocal:
+				if os.path.exists(self.localFileName):
+					cmd = "cat %s" % self.localFileName
+					p = subprocess.Popen(cmd.split(), stdout=subprocess.PIPE)
+				else:
+					self.log.warning("getent cache file not found (%s)" % (self.localFileName))
+					p = subprocess.Popen("getent passwd".split(), stdout=subprocess.PIPE)
+            #  Query administrative database
+			else:
+				p = subprocess.Popen("getent passwd".split(), stdout=subprocess.PIPE)
+
 			try:
 				for l in p.stdout.xreadlines():
 					ws = l.strip().split(":")



Mime
View raw message