Ask Your Question
1

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

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

doka.ua gravatar image

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

Dears,

there is a problem with Ubuntu 16.04 (Xenial) custom image for Heat. Everything built accordingly to http://docs.openstack.org/developer/h... 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:

#!/bin/sh

# Clone the required repositories. Some of these are also available
# via pypi or as distro packages.
git clone https://git.openstack.org/openstack/diskimage-builder
git clone https://git.openstack.org/openstack/tripleo-image-elements.git
git clone https://git.openstack.org/openstack/heat-templates.git
git clone https://git.openstack.org/openstack/dib-utils

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
export DEPLOYMENT_TOOL=""

# 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 \
        $DEPLOYMENT_BASE_ELEMENTS $DEPLOYMENT_TOOL -o $IMAGE_NAME.qcow2

Thank you!

edit retag flag offensive close merge delete

2 answers

Sort by » oldest newest most voted
0

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

doka.ua 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 (https://docs.openstack.org/developer/...).

Clone HEAT modules using stable/ocata branch:

git clone -b stable/ocata https://git.openstack.org/openstack/tripleo-image-elements.git
git clone -b stable/ocata https://git.openstack.org/openstack/heat-agents.git

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
python-dib-utils:
- tripleo-image-elements/elements/os-collect-config/install.d/os-collect-config-source-install/10-os-collect-config
[Install]
WantedBy=cloud-init.target
  • 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.

Enjoy!

edit flag offensive delete link more
0

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
root@server-06:~#

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:~#
root@server-06:~# cat /etc/issue.net
Ubuntu 16.04.1 LTS
root@server-06:~#

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

Comments

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.

doka.ua gravatar imagedoka.ua ( 2017-02-12 15:38:29 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

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

Seen: 295 times

Last updated: May 18