jp (profile/create): errback handling
This commit is contained in:
parent
0e5e340935
commit
195f30b4d5
1 changed files with 7 additions and 1 deletions
|
|
@ -20,10 +20,12 @@
|
||||||
"""This module permits to manage profiles. It can list, create, delete
|
"""This module permits to manage profiles. It can list, create, delete
|
||||||
and retrieve information about a profile."""
|
and retrieve information about a profile."""
|
||||||
|
|
||||||
|
from sat_frontends.jp.constants import Const as C
|
||||||
from sat.core.log import getLogger
|
from sat.core.log import getLogger
|
||||||
log = getLogger(__name__)
|
log = getLogger(__name__)
|
||||||
from sat.core.i18n import _
|
from sat.core.i18n import _
|
||||||
from sat_frontends.jp import base
|
from sat_frontends.jp import base
|
||||||
|
from functools import partial
|
||||||
|
|
||||||
__commands__ = ["Profile"]
|
__commands__ = ["Profile"]
|
||||||
|
|
||||||
|
|
@ -167,7 +169,11 @@ class ProfileCreate(base.CommandBase):
|
||||||
if self.args.profile in self.host.bridge.profilesListGet():
|
if self.args.profile in self.host.bridge.profilesListGet():
|
||||||
log.error("Profile %s already exists." % self.args.profile)
|
log.error("Profile %s already exists." % self.args.profile)
|
||||||
self.host.quit(1)
|
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):
|
class ProfileModify(base.CommandBase):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue