Skip to content

DataSourceAzure: update password for the default user if the user exists#671

Merged
blackboxsw merged 1 commit into
canonical:masterfrom
anhvoms:anhvo/updateDefUserPass
Nov 19, 2020
Merged

DataSourceAzure: update password for the default user if the user exists#671
blackboxsw merged 1 commit into
canonical:masterfrom
anhvoms:anhvo/updateDefUserPass

Conversation

@anhvoms
Copy link
Copy Markdown
Contributor

@anhvoms anhvoms commented Nov 17, 2020

Proposed Commit Message

DataSourceAzure: update password for the default user if the user exists

cc_set_password will only update the password for the default user if
cfg['password'] is set. The existing code of datasource Azure will fail
to update the default user's password because it does not set that
metadata. If the default user doesn't exist in the image, the current
code works fine because the password is set during user create and
not in cc_set_password

Additional Context

Test Steps

  • Deploy the latest bionic image on Azure with password
  • Prepare an image but do not delete the user (waagent -deprovision)
  • Deploy a new VM from the prepared image with a new password
  • Observe that the password is not set appropriately (and that the
    previous password continued to work)
  • Apply this patch and go through the steps again and verify
    that new password is set.

Checklist:

  • My code follows the process laid out in the documentation
  • I have updated or added any unit tests accordingly
  • I have updated or added any documentation accordingly

@blackboxsw blackboxsw self-assigned this Nov 18, 2020
Copy link
Copy Markdown
Collaborator

@blackboxsw blackboxsw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @anhvoms.

No backwards incompatible changes here. Only adds a top-level password value to the base config, which could be overridden if users provided a "password" themselves in #cloud-config as well.

I reproduced failure case as mentioned by "capturing" a VM under test with password provided and launching new vms from that image. When applying your changeset I confirmed new password was honored and old was no longer valid.

@blackboxsw blackboxsw force-pushed the anhvo/updateDefUserPass branch from 3dbb9ff to 9ee401f Compare November 19, 2020 05:05
@blackboxsw blackboxsw force-pushed the anhvo/updateDefUserPass branch from 9ee401f to 0c77e3f Compare November 19, 2020 05:10
@blackboxsw blackboxsw merged commit eea7544 into canonical:master Nov 19, 2020
TheRealFalcon added a commit to TheRealFalcon/cloud-init that referenced this pull request Dec 10, 2020
Verify that on Azure that if a default user and password are specified
through the Azure API that a change in the default password overwrites
the old password
@TheRealFalcon TheRealFalcon mentioned this pull request Dec 10, 2020
3 tasks
TheRealFalcon added a commit to TheRealFalcon/cloud-init that referenced this pull request Dec 11, 2020
Verify that on Azure that if a default user and password are specified
through the Azure API that a change in the default password overwrites
the old password
TheRealFalcon added a commit that referenced this pull request Dec 11, 2020
Verify that on Azure that if a default user and password are specified
through the Azure API that a change in the default password overwrites
the old password
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants