Ask Your Question

OS::Heat::SoftwareDeployment and Xenial (16.04) custom image

asked 2017-02-11 15:19:26 -0500 gravatar image

updated 2017-02-11 15:21:48 -0500


there is a problem with Ubuntu 16.04 (Xenial) custom image for Heat. Everything built accordingly to and while it works fine with Ubuntu 14.04 (DIB_RELEASE=trusty), it fails with Ubuntu 16.04 (DIB_RELEASE=xenial).

Screenshot from VM:

ubuntu@adb1:~$ sudo os-collect-config --force --one-time --debug
[ ... ]
dib-run-parts Sat Feb 11 22:57:31 EET 2017 20-os-apply-config completed
dib-run-parts Sat Feb 11 22:57:31 EET 2017 Running /usr/libexec/os-refresh-config/configure.d/55-heat-config
Traceback (most recent call last):
  File "/usr/libexec/os-refresh-config/configure.d/55-heat-config", line 23, in <module>
    import requests
ImportError: No module named requests

ubuntu@adb1:~$ sudo -H pip install requests
Requirement already satisfied: requests in /usr/local/lib/python3.5/dist-packages

ubuntu@adb1:~$ cat /usr/libexec/os-refresh-config/configure.d/55-heat-config
#!/usr/bin/env python
[ ... ]

ubuntu@adb1:~$ /usr/bin/env python
Python 2.7.12 (default, Nov 19 2016, 06:48:10) 
>>> import requests
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named requests

On 14.04 (Trusty) module "requests" is available for python2 and 55-heat-config works without issues. On 16.04 (Xenial) module "requests" isn't available in default distribution for python2 and, thus, 55-heat-config doesn't work.

Any ideas on why this happen and how to fix this?

Script I use to build image (I'm doing this under 16.04.2 LTS) follows:


# Clone the required repositories. Some of these are also available
# via pypi or as distro packages.
git clone
git clone
git clone
git clone

export PATH=$(pwd)/diskimage-builder/bin:$(pwd)/dib-utils/bin:$PATH

# Required by diskimage-builder to discover element collections
export ELEMENTS_PATH=tripleo-image-elements/elements:heat-templates/hot/software-config/elements

# The base operating system element(s) provided by the diskimage-builder
# elements collection. Other values which may work include:
# centos7, debian, opensuse, rhel, rhel7, or ubuntu
export BASE_ELEMENTS="ubuntu selinux-permissive"

# Install and configure the os-collect-config agent to poll the metadata
# server (heat service or zaqar message queue and so on) for configuration
# changes to execute
export AGENT_ELEMENTS="os-collect-config os-refresh-config os-apply-config"

# heat-config installs an os-refresh-config script which will invoke the
# appropriate hook to perform configuration. The element heat-config-script
# installs a hook to perform configuration with shell scripts
export DEPLOYMENT_BASE_ELEMENTS="heat-config heat-config-script"

# Install a hook for any other chosen configuration tool(s).
# Elements which install hooks include:
# heat-config-cfn-init, heat-config-puppet, or heat-config-salt

# The name of the qcow2 image to create, and the name of the image
# uploaded to the OpenStack image registry.
export DIB_RELEASE=xenial
export IMAGE_NAME=ubuntu-${DIB_RELEASE}-heat

# Create the image
diskimage-builder/bin/disk-image-create --mkfs-options '-i 16384' --no-tmpfs vm $BASE_ELEMENTS $AGENT_ELEMENTS \

Thank you!

edit retag flag offensive close merge delete

2 answers

Sort by » oldest newest most voted

answered 2017-02-13 07:01:17 -0500 gravatar image

updated 2017-05-18 17:11:32 -0500

Finally, there are couple of changes to few files. Below is list of files and what I've changed to get HEAT-aware Xenial-based custom image. Before you'll be able to create custom image, you need to install diskimage-builder (

Clone HEAT modules using stable/ocata branch:

git clone -b stable/ocata
git clone -b stable/ocata

and change the following files:

  • custom image script:
export BASE_ELEMENTS="ubuntu selinux-permissive dib-run-parts"
export DIB_RELEASE=xenial
  • diskimage-builder/diskimage_builder/elements/dib-run-parts/package-installs.yaml
- tripleo-image-elements/elements/os-collect-config/install.d/os-collect-config-source-install/10-os-collect-config
  • heat-agents/heat-config/install.d/heat-config-source-install/50-heat-config-soure
pip install python-heatclient python-zaqarclient python-keystoneclient

and then you can launch custom image script to get 16.04 custom image.


edit flag offensive delete link more

answered 2017-02-12 11:01:40 -0500

spartacle gravatar image

requests is available on 16.04.

root@server-06:~# pip install requests
Collecting requests
  Downloading requests-2.13.0-py2.py3-none-any.whl (584kB)
    100% |████████████████████████████████| 593kB 1.8MB/s
Installing collected packages: requests
Successfully installed requests-2.13.0
root@server-06:~# pip list --format=columns | grep requests
requests     2.13.0

and is working as expected

root@server-06:~# /usr/bin/env python
Python 2.7.12 (default, Nov 19 2016, 06:48:10)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
>>> quit()
root@server-06:~# cat /etc/
Ubuntu 16.04.1 LTS

and you already have it installed

ubuntu@adb1:~$ sudo -H pip install requests
Requirement already satisfied: requests in /usr/local/lib/python3.5/dist-packages

If I were you, I would remove and install requests and run your script as root.

edit flag offensive delete link more


Hi Spartacle, the problem isn't in Ubuntu 16.04 itself but in image, generated by diskimage-builder, where I see described above behaviour. Of course, I can install everything I need later, but before this I need to have Heat's Software Deployment working on VM which I create, while it isn't. gravatar ( 2017-02-12 15:38:29 -0500 )edit

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2017-02-11 15:19:26 -0500

Seen: 799 times

Last updated: May 18 '17