Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

util: don't return a placeholder netdef in the iterator #406

Merged

Conversation

daniloegea
Copy link
Collaborator

@daniloegea daniloegea commented Aug 31, 2023

Description

Tripped on this while working on netplan diff. We probably want to patch the netplan package as well.

Traceback (most recent call last):
  File "/root/netplan/tools/diff.py", line 117, in <module>
    diff = diff_state.get_diff()
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/share/netplan/netplan_cli/cli/state_diff.py", line 149, in get_diff
    full_state = self.get_full_state()
                 ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/share/netplan/netplan_cli/cli/state_diff.py", line 103, in get_full_state
    device_type = DEVICE_TYPES.get(config.type, 'unknown')
                                   ^^^^^^^^^^^
  File "/usr/local/lib/python3.11/dist-packages/netplan/netdef.py", line 118, in type
    return ffi.string(lib.netplan_def_type_name(lib.netplan_netdef_get_type(self._ptr))).decode('utf-8')
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: cannot use string() on <cdata 'char *' NULL>

Checklist

  • Runs make check successfully.
  • Retains 100% code coverage (make check-coverage).
  • New/changed keys in YAML format are documented.
  • (Optional) Adds example YAML for new feature.
  • (Optional) Closes an open bug in Launchpad.

@daniloegea daniloegea requested a review from slyon August 31, 2023 15:14
Copy link
Collaborator

@slyon slyon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, lgtm!

Ubuntu is in feature freeze already, so we'd need a bug report on Launchpad, which we can reference/close, when uploading this as a distro patch to the packaging. Could you create one?

@daniloegea
Copy link
Collaborator Author

@daniloegea daniloegea merged commit e60822b into canonical:main Sep 4, 2023
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants