Distributed Cloud – subcloud bootstrap failed due to no attribute 'username'

Bug #1855129 reported by Tao Liu
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
StarlingX
Fix Released
Medium
Tao Liu

Bug Description

Brief Description
-----------------
Configure docker_registries in a subcloud override file using an aws erc registry for the system images, and add the subcloud via dcmanager subcloud add command. The subcloud bootstrap failed due to no attribute 'username' error.

The aws ecr user credentials are returned from a python script, and the return value is a dictionary which is written to the stdout using print(). The stdout contains a preceding, and trailing blank line when Ansible runs a playbook on a remote host. As such, the return value was not treated as a dictionary and attempts to reference 'username' field in the user credentials dictionary resulted in failure.

The fix is to strip both leading and trailing \r\n from the user credentials output.

Severity
--------
Critical

Steps to Reproduce
------------------
Install and configure a distributed cloud system, and add a subcloud using an aws erc registry.

Expected Behavior
------------------
Subcloud bootstrap was completed successfully.

Actual Behavior
----------------
Subcloud bootstrap failed.

Reproducibility
---------------
100%

System Configuration
--------------------
AIO-DX system controller
One AIO-SX subcloud

Branch/Pull Time/Commit
-----------------------
BUILD_DATE= 2019-11-06_10-52-51

Last Pass
---------
N/A

Timestamp/Logs
--------------
TASK [common/push-docker-images : set_fact] ************************************

fatal: [subcloud1]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'ansible.utils.unsafe_proxy.AnsibleUnsafeText object' has no attribute 'username'\n\nThe error appears to have been in '/usr/share/ansible/stx-ansible/playbooks/roles/common/push-docker-images/tasks/get_aws_ecr_credentials.yml': line 17, column 5, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n registry_auth: \"{{ registry_auth_output.stdout }}\"\n - set_fact:\n ^ here\n"}

Test Activity
-------------
Developer Testing

Tao Liu (tliu88)
Changed in starlingx:
assignee: nobody → Tao Liu (tliu88)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to ansible-playbooks (master)

Fix proposed to branch: master
Review: https://review.opendev.org/697313

Changed in starlingx:
status: New → In Progress
Revision history for this message
Ghada Khalil (gkhalil) wrote :

Marking for stx.4.0 as this is an issue with a specific registry config (amazon ecr)

tags: added: stx.distcloud
Changed in starlingx:
importance: Undecided → Medium
tags: added: stx.4.0
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ansible-playbooks (master)

Reviewed: https://review.opendev.org/697313
Committed: https://git.openstack.org/cgit/starlingx/ansible-playbooks/commit/?id=83476ceb7394f414eb1b6d0c00d1612a4cb7eb51
Submitter: Zuul
Branch: master

commit 83476ceb7394f414eb1b6d0c00d1612a4cb7eb51
Author: Tao Liu <email address hidden>
Date: Wed Dec 4 10:17:16 2019 -0500

    Fix subcloud bootstrap failure

    Subcloud bootstrap failed caused by an error "no attribute
    'username'" generated due to using an aws erc registry for
    the system images.

    The aws ecr user credentials are returned from a python script,
    and the return value is a dictionary which is written to the
    stdout using print(). The stdout contains a preceding, and
    trailing blank line when Ansible runs a playbook on a remote
    host. As such, the return value was not treated as a dictionary
    and attempts to reference 'username' field in the user
    credentials dictionary resulted in failure.

    This update strips both leading and trailing \r\n from the
    user credentials output.

    Tested running a playbook locally and remotely using an aws
    erc registry for system images.

    Closes-Bug: 1855129

    Change-Id: I6cfe1163586d60ecbd0d02ef26a3f984485cc916
    Signed-off-by: Tao Liu <email address hidden>

Changed in starlingx:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.