Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cloud-config: honor cloud_dir setting #1523

Merged
merged 10 commits into from Jun 22, 2022

Conversation

aciba90
Copy link
Contributor

@aciba90 aciba90 commented Jun 16, 2022

Proposed Commit Message

cloud-config: honor cloud_dir setting

- Modules affected: cmd.main, apport, devel.logs (collect-logs),
cc_snap, sources.DataSourceAzure, sources.DataSourceBigstep,
util:fetch_ssl_details.
- testing: Extend and port to pytest unit tests, add integration test.

LP: #1976564

Additional Context

https://bugs.launchpad.net/cloud-init/+bug/1976564
https://warthogs.atlassian.net/browse/SC-1085

Test Steps

cat > /tmp/95-custom-cloud-dir.cfg <<EOF
system_info:
  paths:
    cloud_dir: /new-cloud-dir
EOF

CONTAINER_NAME=dev-k
lxc launch ubuntu-daily:kinetic $CONTAINER_NAME
lxc file push /tmp/95-custom-cloud-dir.cfg $CONTAINER_NAME/etc/cloud/cloud.cfg.d/
lxc exec $CONTAINER_NAME -- rm -rf /var/lib/cloud
lxc exec $CONTAINER_NAME -- cloud-init clean --logs --reboot
lxc exec $CONTAINER_NAME -- cloud-init status --wait --long

# Expect no logs referencing use of /var/lib/cloud
lxc exec $CONTAINER_NAME -- grep /var/lib /var/log/cloud-init.log

# Expect logs referencing use of new cloud-dir
lxc exec $CONTAINER_NAME -- grep /new-cloud-dir var/log/cloud-init.log

# Expect to find no files in /var/lib/cloud
lxc exec $CONTAINER_NAME find /var/lib/cloud

# Expect user-data file pointing to the correct cloud-dir
lxc exec $CONTAINER_NAME -- cloud-init collect-logs -h

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

@TheRealFalcon TheRealFalcon self-assigned this Jun 17, 2022
@TheRealFalcon
Copy link
Member

@aciba90 , I noticed that this PR is in draft state. Is it still in progress, or is it ready for review?

@aciba90 aciba90 changed the title cloud-config: honor cloud_dir setting [WIP] cloud-config: honor cloud_dir setting Jun 20, 2022
@aciba90
Copy link
Contributor Author

aciba90 commented Jun 20, 2022

@aciba90 , I noticed that this PR is in draft state. Is it still in progress, or is it ready for review?

Yes, it is, @TheRealFalcon. I want to run the new integration test on Azure. I will let you know when ready, thanks.

@aciba90
Copy link
Contributor Author

aciba90 commented Jun 20, 2022

I have tested the added integration test on Azure, and added the Azure mark to execute it there too. This PR is ready to be reviewed @TheRealFalcon, thanks.

@aciba90 aciba90 marked this pull request as ready for review June 20, 2022 19:32
@aciba90 aciba90 changed the title [WIP] cloud-config: honor cloud_dir setting cloud-config: honor cloud_dir setting Jun 20, 2022
Copy link
Member

@TheRealFalcon TheRealFalcon left a comment

Choose a reason for hiding this comment

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

Great work here! I left a few comments inline, but nothing major.

tests/integration_tests/bugs/test_lp1976564.py Outdated Show resolved Hide resolved
tests/integration_tests/bugs/test_lp1976564.py Outdated Show resolved Hide resolved
tests/integration_tests/bugs/test_lp1976564.py Outdated Show resolved Hide resolved
cloudinit/sources/DataSourceBigstep.py Outdated Show resolved Hide resolved
tests/unittests/sources/test_bigstep.py Show resolved Hide resolved
- Move integration test to meaningful file and allow it to
  run in every cloud
- DataSourceBigstep: remove caching
@aciba90
Copy link
Contributor Author

aciba90 commented Jun 22, 2022

Great work here! I left a few comments inline, but nothing major.

Thanks a lot, @TheRealFalcon! I have addressed your comments / suggestions and this PR is ready to be reviewed after the build passes.

Copy link
Member

@TheRealFalcon TheRealFalcon left a comment

Choose a reason for hiding this comment

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

Thanks!

@TheRealFalcon TheRealFalcon merged commit a23c886 into canonical:main Jun 22, 2022
holmanb added a commit that referenced this pull request Sep 12, 2022
A new attribute was added to DataSourceAzure[1].
Since the base class uses CloudInitPickleMixin,
we need to define this new attribute in _unpickle()

Add multiple tests to improve pickle coverage.

[1] #1523
@aciba90 aciba90 deleted the honor_cloud_dir branch September 14, 2022 09:27
holmanb added a commit to holmanb/cloud-init that referenced this pull request Sep 14, 2022
A new attribute was added to DataSourceAzure[1].
Since the base class uses CloudInitPickleMixin,
we need to define this new attribute in _unpickle()

Add multiple tests to improve pickle coverage.

[1] canonical#1523
holmanb added a commit to holmanb/cloud-init that referenced this pull request Sep 21, 2022
A new attribute was added to DataSourceAzure[1].
Since the base class uses CloudInitPickleMixin,
we need to define this new attribute in _unpickle()

Add multiple tests to improve pickle coverage.

[1] canonical#1523
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.

None yet

2 participants