Since the last update, using Glances with a password fails with a Python error #2159

pull/2160/head
nicolargo 2022-10-23 11:27:06 +02:00
parent f5892af699
commit b7641a18eb
2 changed files with 7 additions and 4 deletions

View File

@ -773,5 +773,5 @@ Examples of use:
"""
from glances.password import GlancesPassword
password = GlancesPassword(username=username)
password = GlancesPassword(username=username, config=self.get_config())
return password.get_password(description, confirm, clear)

View File

@ -38,9 +38,12 @@ class GlancesPassword(object):
"""Return the local password path.
Related toissue: Password files in same configuration dir in effect #2143
"""
return self.config.get_value('passwords',
'local_password_path',
default=user_config_dir())
if self.config is None:
return user_config_dir
else:
return self.config.get_value('passwords',
'local_password_path',
default=user_config_dir())
def sha256_hash(self, plain_password):
"""Return the SHA-256 of the given password."""