Azure / Azure/azure-linux-extensions
[VMAccess] Reports "success" on enable if sequence number is unchanged, even if config is bad
- Dominant language
- Python
- Stars
- 333
- Forks
- 278
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 4
Description
The first time VMAccessForLinux is enabled with a new configuration, things happen in this sequence:
1. Configuration is decoded
2. Check and open sshd port.
3. Check and update most-recent sequence number
4. Reset sshd_config
5. Set new password/ssh_key
When a problem occurs, the extension sets the extension status appropriately and returns "false" to the agent. If everything was okay, the extension sets status to "succeeded" and returns "true" to the agent.
Step 3 checks the newest config sequence number against the "most recent" sequence number. If they differ, set the most-recent sequence number to the one we're working on now. If they're the same, the extension concludes no additional action is required (since sshd is up and running); it takes a shortcut and exits. This shortcut path leaves the extension status unchanged and returns "true" to the agent.
Suppose that, when enablement with a new config, a problem occurred during steps 4 or 5. The most-recent sequence is updated, the extension sets its status to "failed", and it reports "false" to the agent. On a subsequent enable of the extension with an unchanged config sequence, the extension will take the shortcut at step 3, reporting "true" to the agent. This is a bug; the agent now things the extension is OK, but the extension status remains, accurately, "failed".
Two possible fixes:
1. When taking the shortcut exit, report the true/false state that was reported the last time the non-shortcut path was taken.
2. Do not update the "active config sequence number" unless success has been reported to the agent. Step 3 becomes "take the shortcut if the new sequence matches the most-recent sequence"; a new Step 6 is added, "update the most-recent sequence number".
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing the VMAccessForLinux enable flow around the sequence-number shortcut and the extension status returned to the agent. Compare the two proposed fixes, then verify that a failed initial enable followed by an unchanged-sequence enable preserves consistent status and agent results.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cloud, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100