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

Network Config v2 parser requires nameservers to be set #156

Open
FlorianLaunay opened this issue Sep 30, 2024 · 4 comments
Open

Network Config v2 parser requires nameservers to be set #156

FlorianLaunay opened this issue Sep 30, 2024 · 4 comments

Comments

@FlorianLaunay
Copy link
Contributor

FlorianLaunay commented Sep 30, 2024

I have found an issue in the Network Config v2 parser that requires nameservers to be set : cloudbaseinit/metadata/services/nocloudservice.py#L335.

Here is the error log when nameservers is not set:

2024-09-30 13:32:19.818 768 INFO cloudbaseinit.init [-] Executing plugin 'NetworkConfigPlugin'
2024-09-30 13:32:19.818 768 ERROR cloudbaseinit.init [-] plugin 'NetworkConfigPlugin' failed with error ''NoneType' object has no attribute 'get''
2024-09-30 13:32:19.818 768 ERROR cloudbaseinit.init [-] 'NoneType' object has no attribute 'get': AttributeError: 'NoneType' object has no attribute 'get'
2024-09-30 13:32:19.818 768 ERROR cloudbaseinit.init Traceback (most recent call last):
2024-09-30 13:32:19.818 768 ERROR cloudbaseinit.init   File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\Lib\site-packages\cloudbaseinit\init.py", line 66, in _exec_plugin    
2024-09-30 13:32:19.818 768 ERROR cloudbaseinit.init     (status, reboot_required) = plugin.execute(service,
2024-09-30 13:32:19.818 768 ERROR cloudbaseinit.init                                 ^^^^^^^^^^^^^^^^^^^^^^^
2024-09-30 13:32:19.818 768 ERROR cloudbaseinit.init   File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\Lib\site-packages\cloudbaseinit\plugins\common\networkconfig.py", line 305, in execute
2024-09-30 13:32:19.818 768 ERROR cloudbaseinit.init     network_details = service.get_network_details_v2()
2024-09-30 13:32:19.818 768 ERROR cloudbaseinit.init                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-09-30 13:32:19.818 768 ERROR cloudbaseinit.init   File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\Lib\site-packages\cloudbaseinit\metadata\services\vmwareguestinfoservice.py", line 165, in get_network_details_v2
2024-09-30 13:32:19.818 768 ERROR cloudbaseinit.init     return nocloudservice.NoCloudNetworkConfigParser.parse(network)
2024-09-30 13:32:19.818 768 ERROR cloudbaseinit.init            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-09-30 13:32:19.818 768 ERROR cloudbaseinit.init   File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\Lib\site-packages\cloudbaseinit\metadata\services\nocloudservice.py", line 548, in parse
2024-09-30 13:32:19.818 768 ERROR cloudbaseinit.init     return network_config_parser.parse(network_data)
2024-09-30 13:32:19.818 768 ERROR cloudbaseinit.init            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-09-30 13:32:19.818 768 ERROR cloudbaseinit.init   File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\Lib\site-packages\cloudbaseinit\metadata\services\nocloudservice.py", line 515, in parse
2024-09-30 13:32:19.818 768 ERROR cloudbaseinit.init     self._get_network_config_parser(singular)
2024-09-30 13:32:19.818 768 ERROR cloudbaseinit.init   File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\Lib\site-packages\cloudbaseinit\metadata\services\nocloudservice.py", line 376, in _parse_ethernet_config_item
2024-09-30 13:32:19.818 768 ERROR cloudbaseinit.init     networks, services = self._parse_addresses(item, link.name)
2024-09-30 13:32:19.818 768 ERROR cloudbaseinit.init                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-09-30 13:32:19.818 768 ERROR cloudbaseinit.init   File "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\Lib\site-packages\cloudbaseinit\metadata\services\nocloudservice.py", line 338, in _parse_addresses
2024-09-30 13:32:19.818 768 ERROR cloudbaseinit.init     searches = nameservers.get("search", [])
2024-09-30 13:32:19.818 768 ERROR cloudbaseinit.init                ^^^^^^^^^^^^^^^
2024-09-30 13:32:19.818 768 ERROR cloudbaseinit.init AttributeError: 'NoneType' object has no attribute 'get'
2024-09-30 13:32:19.818 768 ERROR cloudbaseinit.init

I think this argument should be set to an empty value by default.

@FlorianLaunay
Copy link
Contributor Author

I have opened a change to fix this issue : https://review.opendev.org/c/x/cloudbase-init/+/930923

@FlorianLaunay
Copy link
Contributor Author

I have also opened a PR : #157

@seanmorton
Copy link

I just hit this bug as well, thanks @FlorianLaunay!

@ader1990
Copy link
Member

ader1990 commented Oct 9, 2024

Hello, was waiting for a new release of the https://pypi.org/project/sphinx-rtd-theme/3.0.0/ to unblock the gates.

Will merge https://review.opendev.org/c/x/cloudbase-init/+/930923 asap, thanks!

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 a pull request may close this issue.

3 participants