summaryrefslogtreecommitdiff
path: root/roles/unix_users/subplot.py
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2020-10-10 11:25:50 +0300
committerLars Wirzenius <liw@liw.fi>2020-10-10 11:25:50 +0300
commit144d8b800569264dc0932de11701f3080164f426 (patch)
treecdabe66c5c46dd5c8bdf640d769b24ddaab1c407 /roles/unix_users/subplot.py
parentd22b710477a78f40a7d61a91a8a802e704d24a07 (diff)
downloaddebian-ansible-144d8b800569264dc0932de11701f3080164f426.tar.gz
test(unix_users): set encrypted password for users
Diffstat (limited to 'roles/unix_users/subplot.py')
-rw-r--r--roles/unix_users/subplot.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/roles/unix_users/subplot.py b/roles/unix_users/subplot.py
index dc4e9f6..0735049 100644
--- a/roles/unix_users/subplot.py
+++ b/roles/unix_users/subplot.py
@@ -26,3 +26,14 @@ def host_user_has_shell(ctx, username=None, shell=None):
if line.startswith(f"{username}:"):
logging.debug(f"host_user_has_shell: line={line!r}")
assert line.endswith(f":{shell}")
+
+
+def host_user_has_password(ctx, username=None, password=None):
+ assert_eq = globals()["assert_eq"]
+ qemu = ctx["qemu"]
+ output, exit = qemu.ssh(["sudo", "grep", f"^{username}:"])
+ assert_eq(exit, 0)
+ for line in output.decode("UTF8").splitlines():
+ if line.startswith(f"{username}:"):
+ parts = line.split(":")
+ assert_eq(parts[1], password)