Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

Commit

Permalink
Improved error handling
Browse files Browse the repository at this point in the history
This commit adds a try catch block to a snippet where while removing a file may raise an exception as it might not exist in the first place.
Ticket: #45805
  • Loading branch information
sonicaj authored and Brandon Schneider committed Sep 13, 2018
1 parent 65b6b96 commit 3a36b86
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions iocage_lib/ioc_destroy.py
Expand Up @@ -22,7 +22,6 @@
# IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
"""iocage destroy module."""
import glob
import json
import os
import subprocess as su
Expand Down Expand Up @@ -116,9 +115,10 @@ def __destroy_leftovers__(self, dataset, clean=False):
snapshot = True

if path:
for file in glob.glob(f"{self.iocroot}/log/*"):
if file == f"{self.iocroot}/log/{uuid}-console.log":
os.remove(file)
try:
os.remove(f"{self.iocroot}/log/{uuid}-console.log")
except FileNotFoundError:
pass

# Dangling mounts are bad...mmkay?
su.Popen(
Expand Down

0 comments on commit 3a36b86

Please sign in to comment.