зеркало из https://github.com/microsoft/lisa.git
freebsd shadow file location is different
This commit is contained in:
Родитель
f7fddd38e7
Коммит
6e485a921d
|
@ -25,6 +25,7 @@ from lisa.operating_system import (
|
|||
Debian,
|
||||
DebianRepositoryInfo,
|
||||
Fedora,
|
||||
FreeBSD,
|
||||
Oracle,
|
||||
Posix,
|
||||
Redhat,
|
||||
|
@ -885,10 +886,18 @@ class AzureImageStandard(TestSuite):
|
|||
def verify_no_pre_exist_users(self, node: Node) -> None:
|
||||
current_user = node.tools[Whoami].get_username()
|
||||
cat = node.tools[Cat]
|
||||
if isinstance(node.os, FreeBSD):
|
||||
shadow_file = "/etc/master.passwd"
|
||||
else:
|
||||
shadow_file = "/etc/shadow"
|
||||
passwd_outputs = cat.read_with_filter(
|
||||
"/etc/shadow", current_user, True, True, True
|
||||
shadow_file, current_user, True, True, True
|
||||
)
|
||||
for passwd_raw_output in passwd_outputs.splitlines():
|
||||
# remove comments
|
||||
# # $FreeBSD$
|
||||
if passwd_raw_output.strip().startswith("#"):
|
||||
continue
|
||||
# sample line of /etc/shadow
|
||||
# root:x:0:0:root:/root:/bin/bash
|
||||
# sshd:!:19161::::::
|
||||
|
|
Загрузка…
Ссылка в новой задаче