canonical / canonical/cloud-init
Bash option 'set -e' is ignored
- Dominant language
- Python
- Stars
- 3.8k
- Forks
- 1.1k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 18
Description
# Bug report
You usually use [set -e](https://gist.github.com/vncsna/64825d5609c146e80de8b1fd623011ca) to exit a script on error. `cloud-init status` should be `error` now. But `cloud-init` continues and ends up with status `done`.
`cloud-init status --long`
```
status: done
extended_status: done
boot_status_code: enabled-by-generator
last_update: Thu, 01 Jan 1970 00:01:48 +0000
detail: DataSourceHetzner
errors: []
recoverable_errors: {}
```
## Steps to reproduce the problem
```yaml
#cloud-config
write_files:
- owner: root:root
path: /root/.cloud-init/some-script.sh
content: |
#!/bin/bash
set -e
a command that will fail
runcmd:
- /bin/bash /root/.cloud-init/some-script.sh
```
## Environment details
- Cloud-init version: `24.3.1-0ubuntu0~24.04.2`
- Operating System Distribution: `Ubuntu 24.04.1 LTS`
- Cloud provider, platform or installer type: `hcloud`
## cloud-init logs
```
/root/.cloud-init/some-script.sh: line 5: a: command not found
```
Contributor guide
Assessment
This issue has not been assessed yet.