Skip to content

Commit

Permalink
Don't crash when removing broken subusers.
Browse files Browse the repository at this point in the history
  • Loading branch information
timthelion committed Mar 19, 2015
1 parent c09af8b commit 9a21e86
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions logic/subuserlib/subuser.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,12 @@ def add(user,subuserName,imageSourceIdentifier):
def remove(user,subuserName):
if subuserName in user.getRegistry().getSubusers():
user.getRegistry().logChange("Removing subuser "+subuserName)
subuserHome = user.getRegistry().getSubusers()[subuserName].getHomeDirOnHost()
if subuserHome:
user.getRegistry().logChange(" If you wish to remove the subusers home directory, issule the command $ rm -r "+subuserHome)
try:
subuserHome = user.getRegistry().getSubusers()[subuserName].getHomeDirOnHost()
if subuserHome:
user.getRegistry().logChange(" If you wish to remove the subusers home directory, issule the command $ rm -r "+subuserHome)
except:
pass
user.getRegistry().logChange(" If you wish to remove the subusers image, issue the command $ subuser remove-old-images")
del user.getRegistry().getSubusers()[subuserName]
subuserlib.verify.verify(user)
Expand Down

0 comments on commit 9a21e86

Please sign in to comment.