canonical / canonical/cloud-init

[BUG] FreeBSD 15 have new exit code for netstat

Open
#6,206 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
3.8k
Forks
1.1k
Avg merge
2d 23h
Merged PRs (30d)
18

Description

This netstat request in FreeBSD always have error (FreeBSD netstat allow only short flags)

https://github.com/canonical/cloud-init/blob/b5046c4002b14dd6ba7aa12be99a1cf3cdb1c148/cloudinit/netinfo.py#L561

In 14.2 release and early

```
subp.py[DEBUG]: Running command ['netstat', '--route', '--numeric', '--extend'] with allowed return codes [0, 1] (shell=False, capture=True)
subp.py[DEBUG]: Running command ['netstat', '-A', 'inet6', '--route', '--numeric'] with allowed return codes [0, 1] (shell=False, capture=True)
```

But in 15-CURRENT, this broken, exit code netstat 64 now
```
subp.py[DEBUG]: Running command ['netstat', '--route', '--numeric', '--extend'] with allowed return codes [0, 1] (shell=False, capture=True)
2025-05-04 12:23:51,444 - util.py[WARNING]: Route info failed: Unexpected error while running command.
Command: ['netstat', '--route', '--numeric', '--extend']
Exit code: 64
Reason: -
Stdout:
Stderr: netstat: illegal option -- -
...
Traceback (most recent call last):
File "/usr/local/lib/python3.11/site-packages/cloudinit/netinfo.py", line 580, in route_pformat
routes = route_info()
^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cloudinit/netinfo.py", line 514, in route_info
(route_out, _err) = subp.subp(
^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/cloudinit/subp.py", line 298, in subp
raise ProcessExecutionError(
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.