mojo deploy-diff crashes

Bug #1884039 reported by Barry Price
28
This bug affects 6 people
Affects Status Importance Assigned to Milestone
Mojo: Continuous Delivery for Juju
Fix Released
High
Barry Price

Bug Description

The latest mojo build seems to have regressed and can no longer deploy-diff:

$ mojo deploy-diff --apply-config-changes
2020-06-18 09:25:54 [INFO] Using pre-existing container class lxc
2020-06-18 09:25:54 [INFO] Rsyncing /home/stg-foo/spec to /srv/mojo/mojo-foo/bionic/staging/spec
2020-06-18 09:25:56 [INFO] Applying config changes, if any.
2020-06-18 09:25:56 [INFO] Pulling secrets from /srv/mojo/LOCAL/mojo-foo/staging to /srv/mojo/mojo-foo/bionic/staging/local
2020-06-18 09:25:58 Application: telegraf will show ambiguous relations to foo
2020-06-18 09:25:58 Application: telegraf will show ambiguous relations to foo
2020-06-18 09:25:58 Application: foo will show ambiguous relations to telegraf
2020-06-18 09:25:58 Application: foo will show ambiguous relations to telegraf
2020-06-18 09:25:58 [ERROR] Unknown error
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/mojo/cli.py", line 684, in run_with_args
    args.func(args)
  File "/usr/lib/python3/dist-packages/mojo/cli.py", line 73, in diff_deploy
    phase.diff(project, workspace, args.stage)
  File "/usr/lib/python3/dist-packages/mojo/phase.py", line 945, in run
    self, project, workspace, stage, diff_processor=lambda d: process_config_changes_from_diff(d, preview=False)
  File "/usr/lib/python3/dist-packages/mojo/phase.py", line 781, in diff
    diff_processor(diff)
  File "/usr/lib/python3/dist-packages/mojo/phase.py", line 945, in <lambda>
    self, project, workspace, stage, diff_processor=lambda d: process_config_changes_from_diff(d, preview=False)
  File "/usr/lib/python3/dist-packages/mojo/phase.py", line 496, in process_config_changes_from_diff
    if identical_but_wrapped_in_newlines(changes["env-config"][config_item], config_value):
  File "/usr/lib/python3/dist-packages/mojo/phase.py", line 463, in identical_but_wrapped_in_newlines
    return current == proposed.strip("\n")
TypeError: 'str' does not support the buffer interface
$

Changed in mojo:
status: New → Confirmed
importance: Undecided → High
Revision history for this message
Stuart Bishop (stub) wrote :

The traceback means that proposed is a bytestring, and you can't strip the unicode string "\n" from it. Either proposed should be a unicode string and the bug is whatever made it not be that, or .strip("\n") needs to become .strip(b"\n").

Python 3.8.2 (default, Apr 27 2020, 15:53:34)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> " ".strip("hello")
' '
>>> b' '.strip("hello")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: a bytes-like object is required, not 'str'
>>>

Revision history for this message
Haw Loeung (hloeung) wrote :

Seeing this myself:

| 2020-07-08 01:25:33 [ERROR] Unknown error
| Traceback (most recent call last):
| File "/usr/lib/python3/dist-packages/mojo/cli.py", line 684, in run_with_args
| args.func(args)
| File "/usr/lib/python3/dist-packages/mojo/utils.py", line 384, in wrapped
| return method(*args, **kwargs)
| File "/usr/lib/python3/dist-packages/mojo/cli.py", line 352, in run_from_manifest
| manifest.run(project, workspace, args.stage, args.interactive)
| File "/usr/lib/python3/dist-packages/mojo/manifest.py", line 126, in run
| phase_name.run(project, workspace, stage)
| File "/usr/lib/python3/dist-packages/mojo/phase.py", line 945, in run
| self, project, workspace, stage, diff_processor=lambda d: process_config_changes_from_diff(d, preview=False)
| File "/usr/lib/python3/dist-packages/mojo/phase.py", line 781, in diff
| diff_processor(diff)
| File "/usr/lib/python3/dist-packages/mojo/phase.py", line 945, in <lambda>
| self, project, workspace, stage, diff_processor=lambda d: process_config_changes_from_diff(d, preview=False)
| File "/usr/lib/python3/dist-packages/mojo/phase.py", line 496, in process_config_changes_from_diff
| if identical_but_wrapped_in_newlines(changes["env-config"][config_item], config_value):
| File "/usr/lib/python3/dist-packages/mojo/phase.py", line 463, in identical_but_wrapped_in_newlines
| return current == proposed.strip("\n")
| TypeError: 'str' does not support the buffer interface

Revision history for this message
Haw Loeung (hloeung) wrote :

^ That was from 'mojo run -m manifest-update-config'

Barry Price (barryprice)
Changed in mojo:
assignee: nobody → Barry Price (barryprice)
Revision history for this message
Barry Price (barryprice) wrote :

Some values were actually being passed in as boolean and then cast as strings/bytes, so I've fixed this at the source by ensuring we only ever pass it a pair of strings.

Barry Price (barryprice)
Changed in mojo:
status: Confirmed → In Progress
Barry Price (barryprice)
Changed in mojo:
status: In Progress → Fix Committed
Barry Price (barryprice)
Changed in mojo:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.