Fix to ensure that tacacs servers are ordered (reverse) by priority in pam.d's config. (#3322)

Present: Servers are listed in the same order as in redis-db
Fix: Save the sort o/p, hence use sorted list to write into pam.d's conf.
     As well convert priority to integer for use by sort.
This commit is contained in:
Renuka Manavalan 2019-08-09 11:46:46 -07:00 committed by Ying Xie
parent db209067f6
commit b80d60c277

View File

@ -104,7 +104,7 @@ class AaaCfg(object):
server['ip'] = addr
server.update(self.tacplus_servers[addr])
servers_conf.append(server)
sorted(servers_conf, key=lambda t: t['priority'], reverse=True)
servers_conf = sorted(servers_conf, key=lambda t: int(t['priority']), reverse=True)
template_file = os.path.abspath(PAM_AUTH_CONF_TEMPLATE)
env = jinja2.Environment(loader=jinja2.FileSystemLoader('/'), trim_blocks=True)