Skip to content

util: add ensure_dir_exists parameter to write_file#443

Merged
OddBloke merged 1 commit into
canonical:masterfrom
OddBloke:cc_final_message
Jun 19, 2020
Merged

util: add ensure_dir_exists parameter to write_file#443
OddBloke merged 1 commit into
canonical:masterfrom
OddBloke:cc_final_message

Conversation

@OddBloke
Copy link
Copy Markdown
Collaborator

This allows us to disable the ensure_dir call when it isn't
appropriate.

This allows us to disable the `ensure_dir` call when it isn't
appropriate.
Copy link
Copy Markdown
Collaborator

@smoser smoser left a comment

Choose a reason for hiding this comment

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

ensure_dir_exists -> mkdirs ?

2 things

  • shorter
  • plural - ensure_dir will create all parent directories on the way.

cons:

  • isn't named 'ensure_dir' which lines up with the cloud-init function.

i'm fine with either.

@OddBloke
Copy link
Copy Markdown
Collaborator Author

Thanks for taking a look! I think I prefer ensure_dir_exists; it mirrors ensure_dir (and I would have named the parameter that if it didn't shadow the function in the body of write_files) so it's consistent within the codebase, and e.g. py.path uses ensure_dir for the same concept so I think it'll be natural even for people who don't know of the existence of util.ensure_dir.

Copy link
Copy Markdown
Collaborator

@smoser smoser left a comment

Choose a reason for hiding this comment

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

good enough

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