[Bug 2116890] [NEW] Incorrect shebang in loguserdata.py
Wesley Hershberger
2116890 at bugs.launchpad.net
Mon Jul 14 16:20:01 UTC 2025
Public bug reported:
[ Impact ]
Heat templates that include MIME type `x-shellscript` user-data fail due to an
incorrect shebang in loguserdata.py [1].
This failure prevents use of `x-shellscript` user-data in heat templates
[2].
[1] https://review.opendev.org/c/openstack/heat/+/916058
[2] https://docs.openstack.org/heat/latest/template_guide/software_deployment.html
[ Test Plan ]
Deploy OpenStack Caracal. As Charmed Openstack Caracal does not support Noble as
a base, deploy Jammy/Caracal and DRU the heat unit to Noble to test the Noble
package.
Create a stack with this template:
```yaml
heat_template_version: 2021-04-16
description: Deploy an instance with some user-data
resources:
user-data-inst:
type: OS::Nova::Server
properties:
image: noble-server-cloudimg-amd64
flavor: m1.small
key_name: heat_key
networks:
- network: private
- network: ext_net
user_data: |
#!/bin/bash
mkdir -p /usr/local/share/hello
echo "Hello, world!" > /usr/local/share/hello/hello.txt
```
```
os stack create -t user-data-template.yaml ud0
```
Expected result: cloud-init succeeds and /usr/local/share/hello/hello.txt is
created.
Actual result: cloud-init fails:
```
Cloud-init v. 25.1.2-0ubuntu0~24.04.1 running 'modules:final' at Mon, 14 Jul 2025 13:59:07 +0000. Up 82.71 seconds.
/var/lib/cloud/instance/scripts/loguserdata.py: line 15: import: command not found
/var/lib/cloud/instance/scripts/loguserdata.py: line 16: import: command not found
/var/lib/cloud/instance/scripts/loguserdata.py: line 17: import: command not found
/var/lib/cloud/instance/scripts/loguserdata.py: line 18: import: command not found
/var/lib/cloud/instance/scripts/loguserdata.py: line 19: import: command not found
/var/lib/cloud/instance/scripts/loguserdata.py: line 20: import: command not found
/var/lib/cloud/instance/scripts/loguserdata.py: line 23: VAR_PATH: command not found
/var/lib/cloud/instance/scripts/loguserdata.py: line 24: syntax error near unexpected token `('
/var/lib/cloud/instance/scripts/loguserdata.py: line 24: `LOG = logging.getLogger('heat-provision')'
2025-07-14 13:59:07,898 - cc_scripts_user.py[WARNING]: Failed to run module scripts_user (scripts in /var/lib/cloud/instance/scripts)
2025-07-14 13:59:07,899 - log_util.py[WARNING]: Running module scripts_user (<module 'cloudinit.config.cc_scripts_user' from '/usr/lib/python3/dist-packages/cloudinit/config/cc_scripts_user.py'>) failed
Cloud-init v. 25.1.2-0ubuntu0~24.04.1 finished at Mon, 14 Jul 2025 13:59:08 +0000. Datasource DataSourceOpenStackLocal [net,ver=2]. Up 83.21 seconds
```
[ Where problems could occur ]
The modified file is only used as a wrapper when executing cloud-init user-data
of MIME type `x-shellscript` [1]. Regressions in this change should only
impact this specific feature.
[1]
https://git.launchpad.net/ubuntu/+source/heat/tree/heat/engine/clients/os/nova.py?h=applied/ubuntu/noble-
devel#n399
** Affects: cloud-archive
Importance: Undecided
Status: Fix Released
** Affects: cloud-archive/caracal
Importance: Undecided
Assignee: Wesley Hershberger (whershberger)
Status: In Progress
** Affects: heat (Ubuntu)
Importance: Undecided
Status: Fix Released
** Affects: heat (Ubuntu Noble)
Importance: Undecided
Assignee: Wesley Hershberger (whershberger)
Status: In Progress
** Also affects: cloud-archive
Importance: Undecided
Status: New
** Also affects: cloud-archive/caracal
Importance: Undecided
Status: New
** Changed in: cloud-archive
Status: New => Invalid
** Changed in: cloud-archive/caracal
Status: New => In Progress
** Changed in: cloud-archive/caracal
Assignee: (unassigned) => Wesley Hershberger (whershberger)
** Changed in: cloud-archive
Status: Invalid => Fix Released
** Also affects: heat (Ubuntu Noble)
Importance: Undecided
Status: New
** Changed in: heat (Ubuntu)
Assignee: Wesley Hershberger (whershberger) => (unassigned)
** Changed in: heat (Ubuntu Noble)
Assignee: (unassigned) => Wesley Hershberger (whershberger)
** Changed in: heat (Ubuntu)
Status: In Progress => Fix Released
** Changed in: heat (Ubuntu Noble)
Status: New => In Progress
--
You received this bug notification because you are a member of Ubuntu
OpenStack, which is subscribed to heat in Ubuntu.
https://bugs.launchpad.net/bugs/2116890
Title:
Incorrect shebang in loguserdata.py
Status in Ubuntu Cloud Archive:
Fix Released
Status in Ubuntu Cloud Archive caracal series:
In Progress
Status in heat package in Ubuntu:
Fix Released
Status in heat source package in Noble:
In Progress
Bug description:
[ Impact ]
Heat templates that include MIME type `x-shellscript` user-data fail due to an
incorrect shebang in loguserdata.py [1].
This failure prevents use of `x-shellscript` user-data in heat
templates [2].
[1] https://review.opendev.org/c/openstack/heat/+/916058
[2] https://docs.openstack.org/heat/latest/template_guide/software_deployment.html
[ Test Plan ]
Deploy OpenStack Caracal. As Charmed Openstack Caracal does not support Noble as
a base, deploy Jammy/Caracal and DRU the heat unit to Noble to test the Noble
package.
Create a stack with this template:
```yaml
heat_template_version: 2021-04-16
description: Deploy an instance with some user-data
resources:
user-data-inst:
type: OS::Nova::Server
properties:
image: noble-server-cloudimg-amd64
flavor: m1.small
key_name: heat_key
networks:
- network: private
- network: ext_net
user_data: |
#!/bin/bash
mkdir -p /usr/local/share/hello
echo "Hello, world!" > /usr/local/share/hello/hello.txt
```
```
os stack create -t user-data-template.yaml ud0
```
Expected result: cloud-init succeeds and /usr/local/share/hello/hello.txt is
created.
Actual result: cloud-init fails:
```
Cloud-init v. 25.1.2-0ubuntu0~24.04.1 running 'modules:final' at Mon, 14 Jul 2025 13:59:07 +0000. Up 82.71 seconds.
/var/lib/cloud/instance/scripts/loguserdata.py: line 15: import: command not found
/var/lib/cloud/instance/scripts/loguserdata.py: line 16: import: command not found
/var/lib/cloud/instance/scripts/loguserdata.py: line 17: import: command not found
/var/lib/cloud/instance/scripts/loguserdata.py: line 18: import: command not found
/var/lib/cloud/instance/scripts/loguserdata.py: line 19: import: command not found
/var/lib/cloud/instance/scripts/loguserdata.py: line 20: import: command not found
/var/lib/cloud/instance/scripts/loguserdata.py: line 23: VAR_PATH: command not found
/var/lib/cloud/instance/scripts/loguserdata.py: line 24: syntax error near unexpected token `('
/var/lib/cloud/instance/scripts/loguserdata.py: line 24: `LOG = logging.getLogger('heat-provision')'
2025-07-14 13:59:07,898 - cc_scripts_user.py[WARNING]: Failed to run module scripts_user (scripts in /var/lib/cloud/instance/scripts)
2025-07-14 13:59:07,899 - log_util.py[WARNING]: Running module scripts_user (<module 'cloudinit.config.cc_scripts_user' from '/usr/lib/python3/dist-packages/cloudinit/config/cc_scripts_user.py'>) failed
Cloud-init v. 25.1.2-0ubuntu0~24.04.1 finished at Mon, 14 Jul 2025 13:59:08 +0000. Datasource DataSourceOpenStackLocal [net,ver=2]. Up 83.21 seconds
```
[ Where problems could occur ]
The modified file is only used as a wrapper when executing cloud-init user-data
of MIME type `x-shellscript` [1]. Regressions in this change should only
impact this specific feature.
[1]
https://git.launchpad.net/ubuntu/+source/heat/tree/heat/engine/clients/os/nova.py?h=applied/ubuntu/noble-
devel#n399
To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-archive/+bug/2116890/+subscriptions
More information about the Ubuntu-openstack-bugs
mailing list