jp: added param/set command
This commit is contained in:
parent
d620805fc7
commit
c377237add
1 changed files with 16 additions and 1 deletions
|
|
@ -57,7 +57,22 @@ class Get(base.CommandBase):
|
||||||
print value
|
print value
|
||||||
|
|
||||||
|
|
||||||
|
class Set(base.CommandBase):
|
||||||
|
def __init__(self, host):
|
||||||
|
super(Set, self).__init__(host, 'set', help=_('Set a parameter value'))
|
||||||
|
|
||||||
|
def add_parser_options(self):
|
||||||
|
self.parser.add_argument("category", type=base.unicode_decoder, help=_(u"Category of the parameter"))
|
||||||
|
self.parser.add_argument("name", type=base.unicode_decoder, help=_(u"Name of the parameter"))
|
||||||
|
self.parser.add_argument("value", type=base.unicode_decoder, help=_(u"Name of the parameter"))
|
||||||
|
self.parser.add_argument("--security-limit", type=int, default=-1, help=_(u"Security limit"))
|
||||||
|
|
||||||
|
def connected(self):
|
||||||
|
super(Set, self).connected()
|
||||||
try:
|
try:
|
||||||
|
self.host.bridge.setParam(self.args.name, self.args.value, self.args.category, self.args.security_limit, self.profile)
|
||||||
|
except Exception as e:
|
||||||
|
print u"Can set requested parameter: {}".format(e)
|
||||||
|
|
||||||
|
|
||||||
class SaveTemplate(base.CommandBase):
|
class SaveTemplate(base.CommandBase):
|
||||||
|
|
@ -92,7 +107,7 @@ class LoadTemplate(base.CommandBase):
|
||||||
|
|
||||||
|
|
||||||
class Param(base.CommandBase):
|
class Param(base.CommandBase):
|
||||||
subcommands = (Get, SaveTemplate, LoadTemplate)
|
subcommands = (Get, Set, SaveTemplate, LoadTemplate)
|
||||||
|
|
||||||
def __init__(self, host):
|
def __init__(self, host):
|
||||||
super(Param, self).__init__(host, 'param', use_profile=False, help=_('Save/load parameters template'))
|
super(Param, self).__init__(host, 'param', use_profile=False, help=_('Save/load parameters template'))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue