Skip to content
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

Add replace option to prevent accidental overwrite #60

Merged
merged 1 commit into from
Feb 18, 2023

Conversation

kevin-bates
Copy link
Member

This pull request adds a --replace flag to the kernel spec installer CLI tooling to prevent accidental overwrites.

If the directory and kernel.json file already exist, the kernel spec is assumed to exist and, if no --replace option has been included, a error will occur and the process terminated.

$ jupyter k8s-spec install                                                                       
A kernel specification exists at '/usr/local/share/jupyter/kernels/k8s_python' and '--replace' has not been specified.  Terminating.

When --replace is used, the existing directory is copied to a temporary location. If any exceptions are raised when overwriting the existing spec, a "rollback" is performed from the temporary location and a message similar to the following is issued:

An exception was encountered while finalizing the kernel specification and the previous contents have been restored. The exception was: Expecting property name enclosed in double quotes: line 14 column 3 (char 279)

@kevin-bates kevin-bates added the enhancement An improvement to an existing feature label Feb 18, 2023
@kevin-bates kevin-bates merged commit 3a48c10 into jupyter-server:main Feb 18, 2023
@kevin-bates kevin-bates deleted the add-replace-option branch February 18, 2023 02:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An improvement to an existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant