canonical / canonical/cloud-init
status is error when `cloud-init status --long` only shows warnings
- Dominant language
- Python
- Stars
- 3.8k
- Forks
- 1.1k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 18
Description
# Bug report
The instance boots and network is configured correctly, but cloud-init status is error. In the status report, there is no item in the field errors. IIUC, the status should be `degraded done` when there are only warnings.
## Steps to reproduce the problem
gcloud compute instances create cos113 --zone=us-west2-b --image=cos-113-18244-151-100 --image-project=cos-cloud
## Environment details
- Cloud-init version: 23.4.4
- Operating System Distribution: Container Optimized OS
- Cloud provider, platform or installer type: Google Cloud Platform
## cloud-init logs
......
2024-10-21 23:07:21,561 - DataSourceGCE.py[DEBUG]: Looking for the primary NIC in: ['eth0']
2024-10-21 23:07:21,563 - dhcp.py[DEBUG]: Skip dhclient configuration: No dhclient command found.
2024-10-21 23:07:21,563 - dhcp.py[WARNING]: DHCP client not found: dhclient
2024-10-21 23:07:21,564 - dhcp.py[WARNING]: DHCP client not found: dhcpcd
2024-10-21 23:07:21,564 - dhcp.py[DEBUG]: Skip udhcpc configuration: No udhcpc command found.
2024-10-21 23:07:21,564 - dhcp.py[WARNING]: DHCP client not found: udhcpc
2024-10-21 23:07:21,564 - DataSourceGCE.py[WARNING]: Did not find a fallback interface on gce.
2024-10-21 23:07:21,565 - handlers.py[DEBUG]: finish: init-local/search-GCELocal: FAIL: no local data found from DataSourceGCELocal
2024-10-21 23:07:21,565 - util.py[WARNING]: Getting data from failed
2024-10-21 23:07:21,566 - util.py[DEBUG]: Getting data from failed
Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/cloudinit/sources/__init__.py", line 1017, in find_source
if s.update_metadata_if_supported(
File "/usr/lib/python3.8/site-packages/cloudinit/sources/__init__.py", line 903, in update_metadata_if_supported
result = self.get_data()
File "/usr/lib/python3.8/site-packages/cloudinit/sources/__init__.py", line 438, in get_data
return_value = self._check_and_get_data()
File "/usr/lib/python3.8/site-packages/cloudinit/sources/__init__.py", line 370, in _check_and_get_data
return self._get_data()
File "/usr/lib/python3.8/site-packages/cloudinit/sources/DataSourceGCE.py", line 145, in _get_data
if not ret["success"]:
UnboundLocalError: local variable 'ret' referenced before assignment
......
output of cloud-init status --long:
status: error
extended_status: error
boot_status_code: enabled-by-generator
last_update: Mon, 21 Oct 2024 23:07:26 +0000
detail:
DataSourceGCE
errors: []
recoverable_errors:
WARNING:
- DHCP client not found: dhclient
- DHCP client not found: dhcpcd
- DHCP client not found: udhcpc
- Did not find a fallback interface on gce.
- Getting data from failed
Contributor guide
Assessment
This issue has not been assessed yet.