Skip to content

Conversation

@blackboxsw
Copy link
Collaborator

  • I have added unit tests to cover the new behavior under ``tests/unit_tests/```
  • I have run tox -e format locally to automatically format my code before submitting
  • I have run tox locally ensuring that it passes before submitting
  • (if applicable) I have added a reference to issues that this PR relates to in the PR message (Refs GH-1234, Fixes GH-1234)
  • My commits are atomic and follow the convetional commit message format (https://www.conventionalcommits.org/en/v1.0.0/)

Description

Add functionality to use new cloud-init clean params to remove stale cloud-init artifacts from previous boots.
Retain fallback for older versions of cloud-init which may not yet support the -c all param.

cloud-init version 23.1 introduced new commandline options to cloud-init clean:

  1. --machine-id to uninitialize /etc/machine-id
  2. -c all which remove previous boot artifacts such as /etc/netplan/50-cloud-init.yaml and and cloud artifacts (generated by azure)

Additional Context and Relevant Issues

Test Steps

@blackboxsw blackboxsw requested a review from Copilot January 10, 2026 00:05
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the clean() method to leverage newer cloud-init clean options (--machine-id and -c all) introduced in cloud-init version 23.1, with a fallback mechanism for older cloud-init versions that don't support these parameters.

Changes:

  • Updated BaseInstance.clean() to use cloud-init clean --logs --machine-id -c all by default
  • Added fallback logic to retry with cloud-init clean --logs if the -c all option is unrecognized
  • Added comprehensive unit tests covering success, fallback, and edge cases
  • Version bumped to 1!10.17.0

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
pycloudlib/instance.py Updated clean method to use new cloud-init options with fallback for older versions
tests/unit_tests/test_instance.py Added TestClean class with unit tests covering various scenarios for the updated clean method
VERSION Bumped version from 1!10.16.0 to 1!10.17.0

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@blackboxsw blackboxsw force-pushed the cloud-init-clean-all branch from bb81156 to fff8d87 Compare January 10, 2026 00:21
@blackboxsw blackboxsw marked this pull request as draft January 10, 2026 00:24
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.

1 participant