Fix account be locked due to access registry without password
Correct code to let exception be raised when password cannot be got from keyring. Account is locked due to exception is not raised, and client try to access registry with None password, which is incorrect. Closes-Bug: #1871141 Change-Id: Ia68b4a4f25756fdad7a198a31d5870245ff9dc1a Signed-off-by: Shuicheng Lin <shuicheng.lin@intel.com>
This commit is contained in:
@@ -29,10 +29,10 @@ registries = json.loads(os.environ['REGISTRIES'])
|
||||
|
||||
|
||||
def get_local_registry_auth():
|
||||
password = str(keyring.get_password("CGCS", "admin"))
|
||||
password = keyring.get_password("CGCS", "admin")
|
||||
if not password:
|
||||
raise Exception("Local registry password not found.")
|
||||
return dict(username="admin", password=password)
|
||||
return dict(username="admin", password=str(password))
|
||||
|
||||
|
||||
def download_an_image(img):
|
||||
|
||||
@@ -130,10 +130,10 @@
|
||||
vars:
|
||||
script_content: |
|
||||
import keyring
|
||||
password = str(keyring.get_password("CGCS", "admin"))
|
||||
password = keyring.get_password("CGCS", "admin")
|
||||
if not password:
|
||||
raise Exception("Local registry password not found.")
|
||||
print dict(username='admin', password=password)
|
||||
print dict(username='admin', password=str(password))
|
||||
shell: "{{ script_content }}"
|
||||
args:
|
||||
executable: /usr/bin/python
|
||||
|
||||
Reference in New Issue
Block a user