jp (profile/create): errback handling

This commit is contained in:
Goffi 2018-02-28 18:28:39 +01:00
commit 195f30b4d5

View file

@ -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 @@ class ProfileCreate(base.CommandBase):
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):