ASM #539 - Multiple flag functionality for textdb is not working properly

Change-Id: I6f48e877a356fa576e1311da769c90735e61877f

Former-commit-id: 2e2de40d75c0ebc0af1b2d70806e834c7d5089f8
This commit is contained in:
Kiran.Shrestha 2014-05-12 15:16:14 -04:00
parent dd13f453e6
commit e615e1efc5

View file

@ -58,6 +58,7 @@ import conf.TDBConfig as config
# 10/29/10 7354 cjeanbap Updated if-statement to handle None # 10/29/10 7354 cjeanbap Updated if-statement to handle None
# 12/07/10 7656 cjeanbap Retrieve environment variable. # 12/07/10 7656 cjeanbap Retrieve environment variable.
# 04/07/11 8686 cjeanbap Fixed $ACTION has -i associated # 04/07/11 8686 cjeanbap Fixed $ACTION has -i associated
# 05/12/14 16954 kshrestha Added Multiple flag functionality for textdb
############################################################################## ##############################################################################
class TextDB: class TextDB:
@ -226,6 +227,7 @@ class TextDB:
msg = MSG.Message(True) msg = MSG.Message(True)
msg.initializeMessage(False) msg.initializeMessage(False)
commands = self.commands['command'] commands = self.commands['command']
isJoin = False
for command in commands: for command in commands:
data = self.commands[command] data = self.commands[command]
message = config.message[command] message = config.message[command]
@ -233,6 +235,8 @@ class TextDB:
for tuple in message[config.MSG_START:]: for tuple in message[config.MSG_START:]:
key = tuple[config.MSG_KEY] key = tuple[config.MSG_KEY]
value = tuple[config.MSG_VALUE] value = tuple[config.MSG_VALUE]
if ((key == "SUBOP") and (value == "JOIN")):
isJoin = True
if isinstance(value,types.IntType): if isinstance(value,types.IntType):
if args == config.MSG_VAR_ARGS: if args == config.MSG_VAR_ARGS:
for item in data: for item in data:
@ -242,6 +246,9 @@ class TextDB:
if ((key == "SITE") and (self.commands.get("site_node") is not None) and (len(self.commands.get("site_node")) == 0)): if ((key == "SITE") and (self.commands.get("site_node") is not None) and (len(self.commands.get("site_node")) == 0)):
val = str(os.getenv("sitename")) val = str(os.getenv("sitename"))
msg.addProperty(name=key,value=val,replace=True) msg.addProperty(name=key,value=val,replace=True)
elif(isJoin == True):
msg.addProperty(name=key,value=data,replace=True)
isJoin = False
else: else:
msg.addProperty(name=key,value=data[value],replace=True) msg.addProperty(name=key,value=data[value],replace=True)
else: else:
@ -472,7 +479,7 @@ class TextDB:
subJoins = self.commands.get(key) subJoins = self.commands.get(key)
length = len(self.commands.get(key)) length = len(self.commands.get(key))
#specifically looking for config.flags of subJoins #specifically looking for config.flags of subJoins
if length == 6: if length <= 6:
for pos in range(0, length, 2): for pos in range(0, length, 2):
value = config.flags.get(subJoins[pos])[0] value = config.flags.get(subJoins[pos])[0]
try: try: