Gracefully handle removed VM in log follow #73

Closed
opened 2020-01-15 18:27:14 -05:00 by JoshuaBoniface · 3 comments
JoshuaBoniface commented 2020-01-15 18:27:14 -05:00 (Migrated from git.bonifacelabs.ca)

Removing a VM while an active log follow is running results in a gross traceback:

Traceback (most recent call last):
  File "/usr/bin/pvc", line 3339, in <module>
    main()
  File "/usr/bin/pvc", line 3336, in main
    return cli(obj={})
  File "/usr/lib/python3/dist-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/bin/pvc", line 860, in vm_log
    retcode, retmsg = pvc_vm.follow_console_log(config, domain, lines)
  File "/usr/share/pvc/cli_lib/vm.py", line 290, in follow_console_log
    new_console_log = response.json()['data']
  File "/usr/lib/python3/dist-packages/requests/models.py", line 897, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib/python3/dist-packages/simplejson/__init__.py", line 518, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3/dist-packages/simplejson/decoder.py", line 370, in decode
    obj, end = self.raw_decode(s)
  File "/usr/lib/python3/dist-packages/simplejson/decoder.py", line 400, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Or this one:

Traceback (most recent call last):
  File "/usr/bin/pvc", line 3339, in <module>
    main()
  File "/usr/bin/pvc", line 3336, in main
    return cli(obj={})
  File "/usr/lib/python3/dist-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/bin/pvc", line 860, in vm_log
    retcode, retmsg = pvc_vm.follow_console_log(config, domain, lines)
  File "/usr/share/pvc/cli_lib/vm.py", line 293, in follow_console_log
    new_console_log = response.json()['data']
KeyError: 'data'

Handle this more gracefully. Cosmetic.

Removing a VM while an active log follow is running results in a gross traceback: ``` Traceback (most recent call last): File "/usr/bin/pvc", line 3339, in <module> main() File "/usr/bin/pvc", line 3336, in main return cli(obj={}) File "/usr/lib/python3/dist-packages/click/core.py", line 764, in __call__ return self.main(*args, **kwargs) File "/usr/lib/python3/dist-packages/click/core.py", line 717, in main rv = self.invoke(ctx) File "/usr/lib/python3/dist-packages/click/core.py", line 1137, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/lib/python3/dist-packages/click/core.py", line 1137, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/lib/python3/dist-packages/click/core.py", line 956, in invoke return ctx.invoke(self.callback, **ctx.params) File "/usr/lib/python3/dist-packages/click/core.py", line 555, in invoke return callback(*args, **kwargs) File "/usr/bin/pvc", line 860, in vm_log retcode, retmsg = pvc_vm.follow_console_log(config, domain, lines) File "/usr/share/pvc/cli_lib/vm.py", line 290, in follow_console_log new_console_log = response.json()['data'] File "/usr/lib/python3/dist-packages/requests/models.py", line 897, in json return complexjson.loads(self.text, **kwargs) File "/usr/lib/python3/dist-packages/simplejson/__init__.py", line 518, in loads return _default_decoder.decode(s) File "/usr/lib/python3/dist-packages/simplejson/decoder.py", line 370, in decode obj, end = self.raw_decode(s) File "/usr/lib/python3/dist-packages/simplejson/decoder.py", line 400, in raw_decode return self.scan_once(s, idx=_w(s, idx).end()) simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0) ``` Or this one: ``` Traceback (most recent call last): File "/usr/bin/pvc", line 3339, in <module> main() File "/usr/bin/pvc", line 3336, in main return cli(obj={}) File "/usr/lib/python3/dist-packages/click/core.py", line 764, in __call__ return self.main(*args, **kwargs) File "/usr/lib/python3/dist-packages/click/core.py", line 717, in main rv = self.invoke(ctx) File "/usr/lib/python3/dist-packages/click/core.py", line 1137, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/lib/python3/dist-packages/click/core.py", line 1137, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/lib/python3/dist-packages/click/core.py", line 956, in invoke return ctx.invoke(self.callback, **ctx.params) File "/usr/lib/python3/dist-packages/click/core.py", line 555, in invoke return callback(*args, **kwargs) File "/usr/bin/pvc", line 860, in vm_log retcode, retmsg = pvc_vm.follow_console_log(config, domain, lines) File "/usr/share/pvc/cli_lib/vm.py", line 293, in follow_console_log new_console_log = response.json()['data'] KeyError: 'data' ``` Handle this more gracefully. Cosmetic.
JoshuaBoniface commented 2020-01-15 18:27:14 -05:00 (Migrated from git.bonifacelabs.ca)

changed milestone to %2

changed milestone to %2
JoshuaBoniface commented 2020-01-15 18:37:25 -05:00 (Migrated from git.bonifacelabs.ca)

changed the description

changed the description
JoshuaBoniface commented 2020-01-30 09:29:20 -05:00 (Migrated from git.bonifacelabs.ca)

closed via commit 4868625809

closed via commit 48686258098eab823a434e178078fec49624fdd8
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: parallelvirtualcluster/pvc#73
No description provided.