Skip to content

Ensure netplan directory creation is idempotent#562

Merged
slyon merged 1 commit intocanonical:mainfrom
Yanovon:main
Nov 12, 2025
Merged

Ensure netplan directory creation is idempotent#562
slyon merged 1 commit intocanonical:mainfrom
Yanovon:main

Conversation

@Yanovon
Copy link
Contributor

@Yanovon Yanovon commented Oct 23, 2025

Added exist_ok=True to os.makedirs() in TestSet.setUp() to prevent errors if the directory already exists. Improves test reliability and idempotence.

Description

This change ensures that directory creation in TestSet.setUp() is idempotent by adding exist_ok=True to os.makedirs().
Previously, the test could fail if the etc/netplan directory already existed.
This update improves test robustness and repeatability.

Checklist

  • Runs make check successfully.
  • Retains code coverage (make check-coverage).
  • New/changed keys in YAML format are documented. (not applicable)
  • (Optional) Adds example YAML for new feature. (not applicable)
  • (Optional) Closes an open bug in Launchpad. (not applicable)

Added exist_ok=True to os.makedirs() in TestSet.setUp() to prevent errors if the directory already exists. Improves test reliability and idempotence.
Copy link
Contributor

@slyon slyon left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution to Netplan. LGTM!

@slyon slyon merged commit 02191fd into canonical:main Nov 12, 2025
18 checks passed
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.

2 participants