[tacacs]: fix /etc/nsswitch.conf for buster image (#4303)

in buster image, default /etc/nsswitch.conf becomes

```
passwd:         files
```

when tacacs is enable, this files changes to

```
passwd:         tacplus files
```
This commit is contained in:
lguohan 2020-03-22 09:44:48 -07:00 committed by GitHub
parent 1038182f3d
commit 3c6f23e7b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -207,10 +207,10 @@ class AaaCfg(object):
# Add tacplus in nsswitch.conf if TACACS+ enable
if 'tacacs+' in auth['login']:
if os.path.isfile(NSS_CONF):
self.modify_single_file(NSS_CONF, [ "'/tacplus/b'", "'/^passwd/s/compat/tacplus &/'"])
self.modify_single_file(NSS_CONF, [ "'/tacplus/b'", "'/^passwd/s/compat/tacplus &/'", "'/^passwd/s/files/tacplus &/'" ])
else:
if os.path.isfile(NSS_CONF):
self.modify_single_file(NSS_CONF, [ "'/^passwd/s/tacplus //'" ])
self.modify_single_file(NSS_CONF, [ "'/^passwd/s/tacplus //g'" ])
# Set tacacs+ server in nss-tacplus conf
template_file = os.path.abspath(NSS_TACPLUS_CONF_TEMPLATE)