Skip to content

Commit

Permalink
network module raises Exception on command failure issue 51 (#97)
Browse files Browse the repository at this point in the history
Fixes #51
  • Loading branch information
myakove authored and lukas-bednar committed Jan 16, 2018
1 parent af1074a commit 32f356a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions rrmngmnt/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import shlex
import six
import subprocess
from rrmngmnt.errors import CommandExecutionFailure

from rrmngmnt.service import Service

Expand Down Expand Up @@ -127,7 +128,7 @@ def set_hostname(self, name):
cmd = ['hostnamectl', 'set-hostname', name]
rc, _, err = self._m.runCmd(cmd)
if rc:
raise Exception("Unable to set hostname: %s" % err)
raise CommandExecutionFailure("Unable to set hostname: %s" % err)


class Network(Service):
Expand All @@ -142,7 +143,7 @@ def _cmd(self, cmd):

if rc:
cmd_out = " ".join(cmd)
raise Exception(
raise CommandExecutionFailure(
"Fail to run command %s: %s ; %s" % (cmd_out, out, err))
return out

Expand Down

0 comments on commit 32f356a

Please sign in to comment.