[hostcfgd] Fix a bug that tacacs key is wrongly modified (#1536)

This commit is contained in:
Taoyu Li 2018-03-28 10:55:59 -07:00 committed by GitHub
parent 4daf002859
commit 208ca43760
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,6 +5,7 @@ import os
import sys import sys
import subprocess import subprocess
import syslog import syslog
import copy
import jinja2 import jinja2
from swsssdk import ConfigDBConnector from swsssdk import ConfigDBConnector
@ -155,15 +156,17 @@ class HostConfigDaemon:
def tacacs_server_handler(self, key, data): def tacacs_server_handler(self, key, data):
self.aaacfg.tacacs_server_update(key, data) self.aaacfg.tacacs_server_update(key, data)
if data.has_key('passkey'): log_data = copy.deepcopy(data)
data['passkey'] = obfuscate(data['passkey']) if log_data.has_key('passkey'):
syslog.syslog(syslog.LOG_DEBUG, 'value for {} changed to {}'.format(key, data)) log_data['passkey'] = obfuscate(log_data['passkey'])
syslog.syslog(syslog.LOG_DEBUG, 'value of {} changed to {}'.format(key, log_data))
def tacacs_global_handler(self, key, data): def tacacs_global_handler(self, key, data):
self.aaacfg.tacacs_global_update(key, data) self.aaacfg.tacacs_global_update(key, data)
if data.has_key('passkey'): log_data = copy.deepcopy(data)
data['passkey'] = obfuscate(data['passkey']) if log_data.has_key('passkey'):
syslog.syslog(syslog.LOG_DEBUG, 'value for {} changed to {}'.format(key, data)) log_data['passkey'] = obfuscate(log_data['passkey'])
syslog.syslog(syslog.LOG_DEBUG, 'value of {} changed to {}'.format(key, log_data))
def start(self): def start(self):
self.config_db.subscribe('AAA', lambda table, key, data: self.aaa_handler(key, data)) self.config_db.subscribe('AAA', lambda table, key, data: self.aaa_handler(key, data))