Browse code

Remove lib/dib

diskimage-builder is a utility rather than a service, and is already
installed in devstack via pip when required.

lib/dib was created to allow an image to be created during a devstack
run for the heat functional tests, however this approach is no longer
being taken and there are no other known uses for lib/dib.

This change removes lib/dib and moves the pip mirror building to
lib/heat so that snapshot pip packages of the heat agent projects can
be made available to servers which the heat functional tests boot.

This also removes tripleo-image-elements, which has never
been utilised, and since images won't be created
during heat functional test runs it is no longer required.

Change-Id: Ic77f841437ea23c0645d3a34d9dd6bfd1ee28714

Steve Baker authored on 2015/03/05 10:01:45
Showing 8 changed files
... ...
@@ -158,7 +158,6 @@ Scripts
158 158
 * `lib/cinder <lib/cinder.html>`__
159 159
 * `lib/config <lib/config.html>`__
160 160
 * `lib/database <lib/database.html>`__
161
-* `lib/dib <lib/dib.html>`__
162 161
 * `lib/dstat <lib/dstat.html>`__
163 162
 * `lib/glance <lib/glance.html>`__
164 163
 * `lib/heat <lib/heat.html>`__
... ...
@@ -181,7 +180,6 @@ Scripts
181 181
 * `clean.sh <clean.sh.html>`__
182 182
 * `run\_tests.sh <run_tests.sh.html>`__
183 183
 
184
-* `extras.d/40-dib.sh <extras.d/40-dib.sh.html>`__
185 184
 * `extras.d/50-ironic.sh <extras.d/50-ironic.sh.html>`__
186 185
 * `extras.d/60-ceph.sh <extras.d/60-ceph.sh.html>`__
187 186
 * `extras.d/70-sahara.sh <extras.d/70-sahara.sh.html>`__
188 187
deleted file mode 100644
... ...
@@ -1,27 +0,0 @@
1
-# dib.sh - Devstack extras script to install diskimage-builder
2
-
3
-if is_service_enabled dib; then
4
-    if [[ "$1" == "source" ]]; then
5
-        # Initial source
6
-        source $TOP_DIR/lib/dib
7
-    elif [[ "$1" == "stack" && "$2" == "install" ]]; then
8
-        echo_summary "Installing diskimage-builder"
9
-        install_dib
10
-    elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
11
-        # no-op
12
-        :
13
-    elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
14
-        # no-op
15
-        :
16
-    fi
17
-
18
-    if [[ "$1" == "unstack" ]]; then
19
-        # no-op
20
-        :
21
-    fi
22
-
23
-    if [[ "$1" == "clean" ]]; then
24
-        # no-op
25
-        :
26
-    fi
27
-fi
28 1
deleted file mode 100644
... ...
@@ -1,15 +0,0 @@
1
-Listen %DIB_PIP_REPO_PORT%
2
-
3
-<VirtualHost *:%DIB_PIP_REPO_PORT%>
4
-    DocumentRoot %DIB_PIP_REPO%
5
-    <Directory %DIB_PIP_REPO%>
6
-        DirectoryIndex index.html
7
-        Require all granted
8
-        Order allow,deny
9
-        allow from all
10
-    </Directory>
11
-
12
-    ErrorLog /var/log/%APACHE_NAME%/dib_pip_repo_error.log
13
-    LogLevel warn
14
-    CustomLog /var/log/%APACHE_NAME%/dib_pip_repo_access.log combined
15
-</VirtualHost>
16 1
new file mode 100644
... ...
@@ -0,0 +1,15 @@
0
+Listen %HEAT_PIP_REPO_PORT%
1
+
2
+<VirtualHost *:%HEAT_PIP_REPO_PORT%>
3
+    DocumentRoot %HEAT_PIP_REPO%
4
+    <Directory %HEAT_PIP_REPO%>
5
+        DirectoryIndex index.html
6
+        Require all granted
7
+        Order allow,deny
8
+        allow from all
9
+    </Directory>
10
+
11
+    ErrorLog /var/log/%APACHE_NAME%/heat_pip_repo_error.log
12
+    LogLevel warn
13
+    CustomLog /var/log/%APACHE_NAME%/heat_pip_repo_access.log combined
14
+</VirtualHost>
0 15
deleted file mode 100644
... ...
@@ -1,149 +0,0 @@
1
-#!/bin/bash
2
-#
3
-# lib/dib
4
-# Install and build images with **diskimage-builder**
5
-
6
-# Dependencies:
7
-#
8
-# - functions
9
-# - DEST, DATA_DIR must be defined
10
-
11
-# stack.sh
12
-# ---------
13
-# - install_dib
14
-
15
-# Save trace setting
16
-XTRACE=$(set +o | grep xtrace)
17
-set +o xtrace
18
-
19
-# Defaults
20
-# --------
21
-
22
-# set up default directories
23
-DIB_DIR=$DEST/diskimage-builder
24
-TIE_DIR=$DEST/tripleo-image-elements
25
-
26
-# NOTE: Setting DIB_APT_SOURCES assumes you will be building
27
-# Debian/Ubuntu based images. Leave unset for other flavors.
28
-DIB_APT_SOURCES=${DIB_APT_SOURCES:-""}
29
-DIB_BUILD_OFFLINE=$(trueorfalse False DIB_BUILD_OFFLINE)
30
-DIB_IMAGE_CACHE=$DATA_DIR/diskimage-builder/image-create
31
-DIB_PIP_REPO=$DATA_DIR/diskimage-builder/pip-repo
32
-DIB_PIP_REPO_PORT=${DIB_PIP_REPO_PORT:-8899}
33
-
34
-OCC_DIR=$DEST/os-collect-config
35
-ORC_DIR=$DEST/os-refresh-config
36
-OAC_DIR=$DEST/os-apply-config
37
-
38
-# Functions
39
-# ---------
40
-
41
-# install_dib() - Collect source and prepare
42
-function install_dib {
43
-    pip_install diskimage-builder
44
-
45
-    git_clone $TIE_REPO $TIE_DIR $TIE_BRANCH
46
-    git_clone $OCC_REPO $OCC_DIR $OCC_BRANCH
47
-    git_clone $ORC_REPO $ORC_DIR $ORC_BRANCH
48
-    git_clone $OAC_REPO $OAC_DIR $OAC_BRANCH
49
-    mkdir -p $DIB_IMAGE_CACHE
50
-}
51
-
52
-# build_dib_pip_repo() - Builds a local pip repo from local projects
53
-function build_dib_pip_repo {
54
-    local project_dirs=$1
55
-    local projpath proj package
56
-
57
-    rm -rf $DIB_PIP_REPO
58
-    mkdir -p $DIB_PIP_REPO
59
-
60
-    echo "<html><body>" > $DIB_PIP_REPO/index.html
61
-    for projpath in $project_dirs; do
62
-        proj=$(basename $projpath)
63
-        mkdir -p $DIB_PIP_REPO/$proj
64
-        pushd $projpath
65
-        rm -rf dist
66
-        python setup.py sdist
67
-        pushd dist
68
-        package=$(ls *)
69
-        mv $package $DIB_PIP_REPO/$proj/$package
70
-        popd
71
-
72
-        echo "<html><body><a href=\"$package\">$package</a></body></html>" > $DIB_PIP_REPO/$proj/index.html
73
-        echo "<a href=\"$proj\">$proj</a><br/>" >> $DIB_PIP_REPO/index.html
74
-
75
-        popd
76
-    done
77
-
78
-    echo "</body></html>" >> $DIB_PIP_REPO/index.html
79
-
80
-    local dib_pip_repo_apache_conf=$(apache_site_config_for dib_pip_repo)
81
-
82
-    sudo cp $FILES/apache-dib-pip-repo.template $dib_pip_repo_apache_conf
83
-    sudo sed -e "
84
-        s|%DIB_PIP_REPO%|$DIB_PIP_REPO|g;
85
-        s|%DIB_PIP_REPO_PORT%|$DIB_PIP_REPO_PORT|g;
86
-        s|%APACHE_NAME%|$APACHE_NAME|g;
87
-    " -i $dib_pip_repo_apache_conf
88
-    enable_apache_site dib_pip_repo
89
-}
90
-
91
-# disk_image_create_upload() - Creates and uploads a diskimage-builder built image
92
-function disk_image_create_upload {
93
-
94
-    local image_name=$1
95
-    local image_elements=$2
96
-    local elements_path=$3
97
-
98
-    local image_path=$TOP_DIR/files/$image_name.qcow2
99
-
100
-    # Include the apt-sources element in builds if we have an
101
-    # alternative sources.list specified.
102
-    if [ -n "$DIB_APT_SOURCES" ]; then
103
-        if [ ! -e "$DIB_APT_SOURCES" ]; then
104
-            die $LINENO "DIB_APT_SOURCES set but not found at $DIB_APT_SOURCES"
105
-        fi
106
-        local extra_elements="apt-sources"
107
-    fi
108
-
109
-    # Set the local pip repo as the primary index mirror so the
110
-    # image is built with local packages
111
-    local pypi_mirror_url=http://$SERVICE_HOST:$DIB_PIP_REPO_PORT/
112
-    local pypi_mirror_url_1
113
-
114
-    if [ -a $HOME/.pip/pip.conf ]; then
115
-        # Add the current pip.conf index-url as an extra-index-url
116
-        # in the image build
117
-        pypi_mirror_url_1=$(iniget $HOME/.pip/pip.conf global index-url)
118
-    else
119
-        # If no pip.conf, set upstream pypi as an extra mirror
120
-        # (this also sets the .pydistutils.cfg index-url)
121
-        pypi_mirror_url_1=http://pypi.python.org/simple
122
-    fi
123
-
124
-    # The disk-image-create command to run
125
-    ELEMENTS_PATH=$elements_path \
126
-    DIB_APT_SOURCES=$DIB_APT_SOURCES \
127
-    DIB_OFFLINE=$DIB_BUILD_OFFLINE \
128
-    PYPI_MIRROR_URL=$pypi_mirror_url \
129
-    PYPI_MIRROR_URL_1=$pypi_mirror_url_1 \
130
-    disk-image-create -a amd64 $image_elements ${extra_elements:-} \
131
-        --image-cache $DIB_IMAGE_CACHE \
132
-        -o $image_path
133
-
134
-    local token=$(keystone token-get | grep ' id ' | get_field 2)
135
-    die_if_not_set $LINENO token "Keystone fail to get token"
136
-
137
-    glance --os-auth-token $token --os-image-url http://$GLANCE_HOSTPORT \
138
-        image-create --name $image_name --is-public True \
139
-        --container-format=bare --disk-format qcow2 \
140
-        < $image_path
141
-}
142
-
143
-# Restore xtrace
144
-$XTRACE
145
-
146
-# Tell emacs to use shell-script-mode
147
-## Local variables:
148
-## mode: shell-script
149
-## End:
... ...
@@ -8,9 +8,7 @@
8 8
 #   ENABLED_SERVICES+=,heat,h-api,h-api-cfn,h-api-cw,h-eng
9 9
 
10 10
 # Dependencies:
11
-#
12
-# - functions
13
-# - dib (if HEAT_CREATE_TEST_IMAGE=True)
11
+# (none)
14 12
 
15 13
 # stack.sh
16 14
 # ---------
... ...
@@ -37,6 +35,13 @@ GITDIR["python-heatclient"]=$DEST/python-heatclient
37 37
 HEAT_DIR=$DEST/heat
38 38
 HEAT_CFNTOOLS_DIR=$DEST/heat-cfntools
39 39
 HEAT_TEMPLATES_REPO_DIR=$DEST/heat-templates
40
+OCC_DIR=$DEST/os-collect-config
41
+ORC_DIR=$DEST/os-refresh-config
42
+OAC_DIR=$DEST/os-apply-config
43
+
44
+HEAT_PIP_REPO=$DATA_DIR/heat-pip-repo
45
+HEAT_PIP_REPO_PORT=${HEAT_PIP_REPO_PORT:-8899}
46
+
40 47
 HEAT_AUTH_CACHE_DIR=${HEAT_AUTH_CACHE_DIR:-/var/cache/heat}
41 48
 HEAT_STANDALONE=$(trueorfalse False HEAT_STANDALONE)
42 49
 HEAT_ENABLE_ADOPT_ABANDON=$(trueorfalse False HEAT_ENABLE_ADOPT_ABANDON)
... ...
@@ -47,10 +52,6 @@ HEAT_TEMPLATES_DIR=$HEAT_CONF_DIR/templates
47 47
 HEAT_STACK_DOMAIN=$(trueorfalse True HEAT_STACK_DOMAIN)
48 48
 HEAT_API_HOST=${HEAT_API_HOST:-$HOST_IP}
49 49
 HEAT_API_PORT=${HEAT_API_PORT:-8004}
50
-HEAT_FUNCTIONAL_IMAGE_ELEMENTS=${HEAT_FUNCTIONAL_IMAGE_ELEMENTS:-\
51
-vm fedora selinux-permissive pypi  os-collect-config os-refresh-config \
52
-os-apply-config heat-cfntools heat-config heat-config-cfn-init \
53
-heat-config-puppet heat-config-script}
54 50
 
55 51
 
56 52
 # other default options
... ...
@@ -296,22 +297,44 @@ function create_heat_accounts {
296 296
     fi
297 297
 }
298 298
 
299
-# build_heat_functional_test_image() - Build and upload functional test image
300
-function build_heat_functional_test_image {
301
-    if is_service_enabled dib; then
302
-        build_dib_pip_repo "$OCC_DIR $OAC_DIR $ORC_DIR $HEAT_CFNTOOLS_DIR"
303
-        local image_name=heat-functional-tests-image
304
-
305
-        # Elements path for tripleo-image-elements and heat-templates software-config
306
-        local elements_path=$TIE_DIR/elements:$HEAT_TEMPLATES_REPO_DIR/hot/software-config/elements
307
-
308
-        disk_image_create_upload "$image_name" "$HEAT_FUNCTIONAL_IMAGE_ELEMENTS" "$elements_path"
309
-        iniset $TEMPEST_CONFIG orchestration image_ref $image_name
310
-    else
311
-        echo "Error, HEAT_CREATE_TEST_IMAGE=True requires dib" >&2
312
-        echo "Add \"enable_service dib\" to your localrc" >&2
313
-        exit 1
314
-    fi
299
+# build_heat_pip_mirror() - Build a pip mirror containing heat agent projects
300
+function build_heat_pip_mirror {
301
+    local project_dirs="$OCC_DIR $OAC_DIR $ORC_DIR $HEAT_CFNTOOLS_DIR"
302
+    local projpath proj package
303
+
304
+    rm -rf $HEAT_PIP_REPO
305
+    mkdir -p $HEAT_PIP_REPO
306
+
307
+    echo "<html><body>" > $HEAT_PIP_REPO/index.html
308
+    for projpath in $project_dirs; do
309
+        proj=$(basename $projpath)
310
+        mkdir -p $HEAT_PIP_REPO/$proj
311
+        pushd $projpath
312
+        rm -rf dist
313
+        python setup.py sdist
314
+        pushd dist
315
+        package=$(ls *)
316
+        mv $package $HEAT_PIP_REPO/$proj/$package
317
+        popd
318
+
319
+        echo "<html><body><a href=\"$package\">$package</a></body></html>" > $HEAT_PIP_REPO/$proj/index.html
320
+        echo "<a href=\"$proj\">$proj</a><br/>" >> $HEAT_PIP_REPO/index.html
321
+
322
+        popd
323
+    done
324
+
325
+    echo "</body></html>" >> $HEAT_PIP_REPO/index.html
326
+
327
+    local heat_pip_repo_apache_conf=$(apache_site_config_for heat_pip_repo)
328
+
329
+    sudo cp $FILES/apache-heat-pip-repo.template $heat_pip_repo_apache_conf
330
+    sudo sed -e "
331
+        s|%HEAT_PIP_REPO%|$HEAT_PIP_REPO|g;
332
+        s|%HEAT_PIP_REPO_PORT%|$HEAT_PIP_REPO_PORT|g;
333
+        s|%APACHE_NAME%|$APACHE_NAME|g;
334
+    " -i $heat_pip_repo_apache_conf
335
+    enable_apache_site heat_pip_repo
336
+    restart_apache_server
315 337
 }
316 338
 
317 339
 # Restore xtrace
... ...
@@ -1227,9 +1227,9 @@ if is_service_enabled heat; then
1227 1227
     init_heat
1228 1228
     echo_summary "Starting Heat"
1229 1229
     start_heat
1230
-    if [ "$HEAT_CREATE_TEST_IMAGE" = "True" ]; then
1231
-        echo_summary "Building Heat functional test image"
1232
-        build_heat_functional_test_image
1230
+    if [ "$HEAT_BUILD_PIP_MIRROR" = "True" ]; then
1231
+        echo_summary "Building Heat pip mirror"
1232
+        build_heat_pip_mirror
1233 1233
     fi
1234 1234
 fi
1235 1235
 
... ...
@@ -419,14 +419,10 @@ GITBRANCH["ceilometermiddleware"]=${CEILOMETERMIDDLEWARE_BRANCH:-master}
419 419
 
420 420
 ##################
421 421
 #
422
-#  TripleO Components
422
+#  TripleO / Heat Agent Components
423 423
 #
424 424
 ##################
425 425
 
426
-# diskimage-builder
427
-DIB_REPO=${DIB_REPO:-${GIT_BASE}/openstack/diskimage-builder.git}
428
-DIB_BRANCH=${DIB_BRANCH:-master}
429
-
430 426
 # os-apply-config configuration template tool
431 427
 OAC_REPO=${OAC_REPO:-${GIT_BASE}/openstack/os-apply-config.git}
432 428
 OAC_BRANCH=${OAC_BRANCH:-master}
... ...
@@ -439,10 +435,6 @@ OCC_BRANCH=${OCC_BRANCH:-master}
439 439
 ORC_REPO=${ORC_REPO:-${GIT_BASE}/openstack/os-refresh-config.git}
440 440
 ORC_BRANCH=${ORC_BRANCH:-master}
441 441
 
442
-# Tripleo elements for diskimage-builder images
443
-TIE_REPO=${TIE_REPO:-${GIT_BASE}/openstack/tripleo-image-elements.git}
444
-TIE_BRANCH=${TIE_BRANCH:-master}
445
-
446 442
 #################
447 443
 #
448 444
 #  3rd Party Components (non pip installable)