Merge "Password set now works on an empty password file"

This commit is contained in:
Zuul 2018-05-24 22:41:03 +00:00 committed by Gerrit Code Review
commit 25cadcaa57
1 changed files with 3 additions and 0 deletions

View File

@ -180,6 +180,9 @@ def change_password(file_path, pname, pvalue=None, public_key=None,
"""
read_data = sync_read_file(file_path)
file_pwds = yaml.safe_load(read_data)
# if the password file is empty file_pwds will be None after safe_load
if file_pwds is None:
file_pwds = {}
if clear:
# clear
if pname in file_pwds: