cleanup.py: implment skips or retain-first-added unique_tags
For Cleanup
objects representing restoration of initial state of the system, we want the first object saved to be restored, we don't care about any latter changes (e.g. the configuration file as it was at the start of the scenario). Similarly, we may want to be able to backup/restore a file only if it exists and skip creation of a cleanup when it can't be found or read. These use cases are distinct but lead to a common thing: early return
out of _add_cleanup()
function based on these conditions.
As there are now more MR's around regarding [nmci/cleanup.py] (!1311 (merged), !1321 (closed)), I prefer to wait now until they're merged and leave this as an issue. After these are merged, part of MR should be use of this first-cleanup-only unique_tag
behaviour for RestoreFile()
(introduced by !1321 (closed)) and if we get to saving individual sysctls (instead of current blobs returned), then for them as well.