Skip to content

Make sure path exist before writing #4472

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

Qalthos
Copy link
Collaborator

@Qalthos Qalthos commented Jul 10, 2025

No description provided.

Copy link

@Copilot 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 ensures the directory for a target file exists before writing and refactors the initial “create” step in _run_scenarios to separate shared‐data handling.

  • util.py: Add a call to create the parent directory before writing the file.
  • base.py: Simplify the shared_data check, add a nested “create” condition, and update lint ignore.

Reviewed Changes

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

File Description
src/molecule/util.py Ensure parent directory exists before writing file content
src/molecule/command/base.py Refactor initial scenario “create” logic and update lint flags
Comments suppressed due to low confidence (1)

src/molecule/command/base.py:214

  • This append should only occur if the subcommand actually ran; indent both this line and the default.results = [] line under the nested if "create" in ... block to avoid appending or clearing results when create wasn’t executed.
            scenarios.results.append({"name": default.name, "results": default.results})

@ssbarnea ssbarnea changed the title Make sure path exist before writing. Make sure path exist before writing Jul 11, 2025
@ssbarnea ssbarnea marked this pull request as draft July 11, 2025 10:51
@Qalthos Qalthos marked this pull request as ready for review July 16, 2025 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Review
Development

Successfully merging this pull request may close these issues.

3 participants