-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(agent): No empty cloudinit (#886)
When the config is empty, the yaml serialization outputs {}. We still added some commentary in the agent.yaml, resulting in a bunch of nothing that confused cloud-init, because it's enablement is based on the existence of the files, their contents are only checked later. That wouldn't be a problem per se, as the WSL datasource would recognize there's nothing to do and bail out, but that would have costed unnecesary CPU cicles, and worse than that, the current implementation of cloud-init makes it log as an error the fact that there is nothing to do at this point, which results in more noise if the user see the output of cloud-init status --long. The fix is rather simple: do not write an empty object into agent.yaml. If the config is empty we delete that file. This way, if there is nothing from the user nor the agent's perspective, cloud-init will remain trully disabled. I updated some tests that relied on the fact that cloud-init would create the agent.yaml file unconditionally, which is no longer the case. UDENG-4169
- Loading branch information
Showing
6 changed files
with
94 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 0 additions & 3 deletions
3
windows-agent/internal/cloudinit/testdata/TestUpdate/golden/with_empty_contents
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 6 additions & 1 deletion
7
...ernal/proservices/testdata/TestNew/golden/when_the_config_cannot_check_if_it_is_read-only
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
#cloud-config | ||
# This file was generated automatically and must not be edited | ||
{} | ||
landscape: | ||
client: | ||
tags: wsl | ||
user: JohnDoe | ||
ubuntu_pro: | ||
token: test-token |
7 changes: 6 additions & 1 deletion
7
windows-agent/internal/proservices/testdata/TestNew/golden/when_the_subscription_stays_empty
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
#cloud-config | ||
# This file was generated automatically and must not be edited | ||
{} | ||
landscape: | ||
client: | ||
tags: wsl | ||
user: JohnDoe | ||
ubuntu_pro: | ||
token: test-token |