Opened 7 years ago

Closed 7 years ago

#2290 closed defect (fixed)

bindctl crash after malformed command

Reported by: tomek Owned by:
Priority: low Milestone: Sprint-20121009
Component: ~bind-ctl (obsolete) Version:
Keywords: Cc:
CVSS Scoring: Parent Tickets:
Sensitive: no Defect Severity: N/A
Sub-Project: Core Feature Depending on Ticket:
Estimated Difficulty: 0 Add Hours to Ticket: 0
Total Hours: 0 Internal?: no

Description

bindctl crashes, when trying to add to non-existing list entry. While I was learning how to write bindctl, commands I've crashed it couple times.

Error handling should be improved. It is frustrating, when user types long configuration and then due to one syntax error bindctl crashes and all changes are lost.

This works:
config set Dhcp6/subnet6[0]/valid-lifetime 1000

However, this:
config add Dhcp6/subnet6[0] valid-lifetime 1000

will crash bindctl:

thomson@billabong:~/devel/bind10/src/bin/dhcp6$ bindctl 
["login success "] login as root
> config add Dhcp6/subnet6[0] valid-lifetime 1000
Traceback (most recent call last):
  File "/usr/lib/python3.2/cmd.py", line 214, in onecmd
    func = getattr(self, 'do_' + cmd)
AttributeError: 'BindCmdInterpreter' object has no attribute 'do_config'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/bindctl", line 151, in <module>
    result = tool.run()
  File "/usr/local/lib/python3/dist-packages/bindctl/bindcmd.py", line 140, in run
    self.cmdloop()
  File "/usr/lib/python3.2/cmd.py", line 138, in cmdloop
    stop = self.onecmd(line)
  File "/usr/local/lib/python3/dist-packages/bindctl/bindcmd.py", line 464, in onecmd
    Cmd.onecmd(self, line)
  File "/usr/lib/python3.2/cmd.py", line 216, in onecmd
    return self.default(line)
  File "/usr/local/lib/python3/dist-packages/bindctl/bindcmd.py", line 430, in default
    self._parse_cmd(line)
  File "/usr/local/lib/python3/dist-packages/bindctl/bindcmd.py", line 567, in _parse_cmd
    self._handle_cmd(cmd)
  File "/usr/local/lib/python3/dist-packages/bindctl/bindcmd.py", line 414, in _handle_cmd
    self.apply_config_cmd(cmd)
  File "/usr/local/lib/python3/dist-packages/bindctl/bindcmd.py", line 683, in apply_config_cmd
    cmd.params.get('value_for_set'))
  File "/usr/local/lib/python3/dist-packages/isc/config/ccsession.py", line 591, in add_value
    self._add_value_to_list(identifier, value, module_spec)
  File "/usr/local/lib/python3/dist-packages/isc/config/ccsession.py", line 533, in _add_value_to_list
    cur_list.append(value)
AttributeError: 'dict' object has no attribute 'append'

I've used code from branch #2269, but I think that is a generic issue.

Subtickets

Change History (3)

comment:1 Changed 7 years ago by jreed

Please see ticket #2254.

From today's jabber:

(08:13:26 AM) jelte: oh actually, i think 2254 accidentally fixes 2290 as well

(08:14:54 AM) jelte: should fix most if not all instances where you do add or remove to something that does not support addition/removal

comment:2 Changed 7 years ago by muks

  • Milestone changed from New Tasks to Sprint-20121009

0 points ticket. During this sprint, Jelte will check if this has been fixed already and then we'll estimate it if necessary.

comment:3 Changed 7 years ago by jelte

  • Resolution set to fixed
  • Status changed from new to closed

Checked it, this is fixed in master now.

Note: See TracTickets for help on using tickets.