forked from canonical/cloud-init
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Ensure _should_wait_via_user_data() handles all user data types (c…
…anonical#5976) The function "_should_wait_via_user_data()" wasn't properly handling user data that has a header that starts with #cloud-config, but isn't cloud-config, like #cloud-config-archive Fixes canonicalGH-5975
- Loading branch information
1 parent
e702638
commit 470f652
Showing
3 changed files
with
54 additions
and
1 deletion.
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
31 changes: 31 additions & 0 deletions
31
tests/integration_tests/modules/test_cloud_config_archive.py
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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import pytest | ||
|
||
from tests.integration_tests.instances import IntegrationInstance | ||
from tests.integration_tests.util import verify_clean_boot, verify_clean_log | ||
|
||
USER_DATA = """\ | ||
#cloud-config-archive | ||
- type: "text/cloud-boothook" | ||
content: | | ||
#!/bin/sh | ||
echo "this is from a boothook." > /var/tmp/boothook.txt | ||
- type: "text/cloud-config" | ||
content: | | ||
bootcmd: | ||
- echo "this is from a cloud-config." > /var/tmp/bootcmd.txt | ||
""" | ||
|
||
|
||
@pytest.mark.ci | ||
@pytest.mark.user_data(USER_DATA) | ||
def test_cloud_config_archive(client: IntegrationInstance): | ||
"""Basic correctness test for #cloud-config-archive.""" | ||
log = client.read_from_file("/var/log/cloud-init.log") | ||
assert "this is from a boothook." in client.read_from_file( | ||
"/var/tmp/boothook.txt" | ||
) | ||
assert "this is from a cloud-config." in client.read_from_file( | ||
"/var/tmp/bootcmd.txt" | ||
) | ||
verify_clean_log(log) | ||
verify_clean_boot(client) |
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