# HG changeset patch # User Goffi # Date 1519838919 -3600 # Node ID fcf0ae8102b8b763651200d406e116c9f0ef1499 # Parent 5895e4daae8c9460e5767627bf2c034d50831e52 jp (profile/create): errback handling diff -r 5895e4daae8c -r fcf0ae8102b8 frontends/src/jp/cmd_profile.py --- a/frontends/src/jp/cmd_profile.py Wed Feb 28 18:28:39 2018 +0100 +++ b/frontends/src/jp/cmd_profile.py Wed Feb 28 18:28:39 2018 +0100 @@ -20,10 +20,12 @@ """This module permits to manage profiles. It can list, create, delete and retrieve information about a profile.""" +from sat_frontends.jp.constants import Const as C from sat.core.log import getLogger log = getLogger(__name__) from sat.core.i18n import _ from sat_frontends.jp import base +from functools import partial __commands__ = ["Profile"] @@ -167,7 +169,11 @@ if self.args.profile in self.host.bridge.profilesListGet(): log.error("Profile %s already exists." % self.args.profile) self.host.quit(1) - self.host.bridge.profileCreate(self.args.profile, self.args.password, self.args.component, callback=self._profile_created, errback=None) + self.host.bridge.profileCreate(self.args.profile, self.args.password, self.args.component, + callback=self._profile_created, + errback=partial(self.errback, + msg=_(u"can't create profile: {}"), + exit_code=C.EXIT_BRIDGE_ERRBACK)) class ProfileModify(base.CommandBase):