getnikola / nikola

A static website and blog generator
https://getnikola.com/
MIT License
2.62k stars 450 forks source link

Trying to import after creating a post shows wrong info. #3731

Open StyXman opened 10 months ago

StyXman commented 10 months ago

Environment

Python Version: Python 3.11.7

Nikola Version: Nikola v8.2.4

Operating System: Debian Unstable

Description:

I first do:

(venv) mdione@ioniq:~/src/projects/glob/nikola$ nikola new_post
Creating New Post
-----------------

Title: Debugging docker containers with the host's tools
Scanning posts.........done!
[2024-01-06 11:34:46] INFO: new_post: Your post's text is at: posts/debugging-docker-containers-with-the-hosts-tools.rst

So far so good. Later I realize that rst is not the format I want and that I can --import the file I'm already writing. So I try:

(venv) mdione@ioniq:~/src/projects/glob/nikola$ nikola new_post --title "Debugging docker containers with the host's tools" -2 --import posts/debugging-docker-containers-with-the-hosts-tools.md 
Importing Existing Post
-----------------------

Title: Debugging docker containers with the host's tools
Scanning posts.........done!
[2024-01-06 11:38:14] ERROR: new_post: The title already exists!
[2024-01-06 11:38:14] INFO: new_post: Existing post's text is at: posts/debugging-docker-containers-with-the-hosts-tools.md
[2024-01-06 11:38:14] INFO: new_post: Existing post's metadata is at: posts/debugging-docker-containers-with-the-hosts-tools.meta

My issue is not that I get an error, that's fine. My issue is that it reports that a metadata file was created while in fact it wasn't:

(venv) mdione@ioniq:~/src/projects/glob/nikola$ cat posts/debugging-docker-containers-with-the-hosts-tools.meta
cat: posts/debugging-docker-containers-with-the-hosts-tools.meta: No such file or directory

Maybe it should bail out before reporting it?