lago
lago copied to clipboard
Is `lago cleanup` needed ?
This command stops the VMs and networks and then removes the initialized
file from the prefix. I'm not sure why it's needed.
@log_task('Cleanup prefix')
def cleanup(self):
"""
Stops any running entities in the prefix and uninitializes it, usually
you want to do this if you are going to remove the prefix afterwards
Returns:
None
"""
with LogTask('Stop prefix'):
self.stop()
with LogTask("Tag prefix as uninitialized"):
os.unlink(self.paths.prefix_lagofile())
lago destroy
calls lago cleanup
and then removes the prefix:
def destroy(self):
"""
Destroy this prefix, running any cleanups and removing any files
inside it.
"""
self.cleanup()
shutil.rmtree(self._prefix)
I think that we can merge those two commands into one. What do you think?
@nvgoldin @mykaul
First I like the question
label, good addition!
Yep its weird indeed. I seem to think the intention was that you remove only one prefix from the workdir, but lago destroy
does the same. So unless we reveal something here +1 on removing cmd.py:do_cleanup
, about the function in the prefix.py
, probably +1 too(though that is more internal - so whatever makes sense code-wise).
Hey! iirc the cleanup is indeed a legacy feature, that was created way before destroy existed. Probably kept to allow backwards compatibility and forgotten. (see 517b7c804e54910292a52c8eadc8ce0f2491ab69, that shows that cleanup already existed on the early bitbucket repo, and 1c408675f4ac722f967c4e9aaa1ae1fe6f89891f, were destroy was introduced).