Skip to content

fix(distros): clarify misleading ssh_redirect_user warning - #6906

Merged
blackboxsw merged 1 commit into
canonical:mainfrom
Sandhya-d:fix/ssh-redirect-user-warning
Jun 16, 2026
Merged

fix(distros): clarify misleading ssh_redirect_user warning#6906
blackboxsw merged 1 commit into
canonical:mainfrom
Sandhya-d:fix/ssh-redirect-user-warning

Conversation

@Sandhya-d

Copy link
Copy Markdown
Contributor

This PR rewords a misleading warning emitted when ssh_redirect_user is
configured but no cloud public SSH keys are available.

When ssh_redirect_user is set to true or default, cc_users_groups
resolves it to the actual default username before create_user runs. The
"no cloud public-keys" warning then printed that resolved name (e.g.
ubuntu), making it look like the user had configured ubuntu. This
rewords the warning so the value reads as the redirect target, not the
configured value.

Fixes GH-3924

Proposed Commit Message

```
fix(distros): clarify misleading ssh_redirect_user warning

When ssh_redirect_user is set to true or default, cc_users_groups
resolves it to the actual default username before create_user runs.
The 'no cloud public-keys' warning then printed that resolved name
(e.g. 'ubuntu'), making it look like the user had configured 'ubuntu'.
Reword the warning so the value reads as the redirect target, not the
configured value.

Fixes GH-3924
```

Additional Context

The warning is emitted in Distro.create_user
(cloudinit/distros/__init__.py). The value substitution happens earlier
in cc_users_groups, which replaces a true/default ssh_redirect_user
with the resolved default username before it reaches create_user.

Test Steps

  • pytest tests/unittests/distros/test_create_users.py — 59 passed,
    including test_create_user_with_ssh_redirect_user_no_cloud_keys.
  • Ran tox -e do_format, tox -e ruff, tox -e mypy, and tox -e pylint
    locally — all clean.

Merge type

  • Squash merge using "Proposed Commit Message"
  • Rebase and merge unique commits. Requires commit messages per-commit each referencing the pull request number (#<PR_NUM>)

When ssh_redirect_user is set to true or default, cc_users_groups resolves it to the actual default username before create_user runs. The 'no cloud public-keys' warning then printed that resolved name (e.g. 'ubuntu'), making it look like the user had configured 'ubuntu'. Reword the warning so the value reads as the redirect target, not the configured value.

Fixes canonicalGH-3924
@blackboxsw

Copy link
Copy Markdown
Collaborator

Unrelated unittest failures fixed by #6908

@blackboxsw blackboxsw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you for this contribution. unrelated unittest failures in CI are fixed in a separate PR.

@blackboxsw
blackboxsw merged commit 1ee6e65 into canonical:main Jun 16, 2026
10 of 18 checks passed
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.

Misleading ssh_redirect_user warning

2 participants