Commit Graph

15 Commits

Author SHA1 Message Date
Ian Wienand
36b59c001c Standarise tracing for scripts
There is a wide variety of tracing options through the various shell
scripts.  Some use "set -eux", others explicity set xtrace and others
do nothing.  There is a "-x" option to bin/disk-image-create but it
doesn't flow down to the many scripts it calls.

This adds a global integer variable set by disk-image-create
DIB_DEBUG_TRACE.  All scripts have a stanza added to detect this and
turn on tracing.  Any other tracing methods are rolled into this.  So
the standard header is

---
if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
    set -x
fi
set -eu
set -o pipefail
---

Multiple -x options can be specified to dib-create-image, which
increases the value of DIB_DEBUG_TRACE.  If script authors feel their
script should only trace at higher levels, they should modify the
"-gt" value.  If they feel it should trace by default, they can modify
the default value also.

Changes to pachset 16 : scripts which currently trace themselves by
default have retained this behaviour with DIB_DEBUG_TRACE defaulting
to "1".  This was done by running [1] on patch set 15.  See the thread
beginning at [2]

dib-lint is also updated to look for the variable being matched.

[1] https://gist.github.com/ianw/71bbda9e6acc74ccd0fd
[2] http://lists.openstack.org/pipermail/openstack-dev/2014-November/051575.html

Change-Id: I6c5a962260741dcf6f89da9a33b96372a719b7b0
2015-02-12 10:41:32 +11:00
Ben Nemec
79464cf00f Set -o pipefail new scripts
A few scripts were added without set -o pipefail since the original
change to add that everywhere.  This will get the dib-lint check
passing again.

Change-Id: I96bef45cc10ff9bbcf2c4f1b796b8cd188e10485
2014-05-23 15:57:27 -05:00
Dan Prince
131fb6e4db Fedora: Add support for configuring Yum mirrors
Updates the fedora element so that DIB_DISTRIBUTION_MIRROR can
be used to configure a custom Yum mirror on Fedora. This
implementation replaces the baseurl in each of the default
Fedora Yum .repo files so that a custom mirror URL/path
can be supplied. The URL should point to the directory
where the updates and release directories exist. Example:

  http://download.fedoraproject.org/pub/fedora/linux

As part of this change we also remove any existing
metalink settings in the .repo files to cover the case
where an end user runs their own createrepo command
to create the mirror... which means your metadata won't match that
of the normal Fedora mirrors and your baseurl won't get used.

Change-Id: I1a49a2941b1cc489e91a72b87430393cd32e865d
2014-05-06 10:11:26 -04:00
Ben Nemec
94f07c5962 Use redhat-common in fedora element
Have the fedora element use the common steps in the redhat-common
element.

Change-Id: Ic71b11c03b5c3868cc9e82e049f2700c1b67263a
2014-03-17 16:14:41 -05:00
James Slagle
15960f01cd Add ability to use local cloud image
Adds the ability to set $DIB_LOCAL_IMAGE to use as the base cloud image
for a Fedora image build. There are many repetitve tasks that are done
every image build. With this change you can build an image with the
fedora and vm element and then reuse the resulting image as input to
future image builds. This greatly reduces future image build times.

For instance 99-up-to-date is already taking almost 2 minutes (even with
rpm downloads already cached) for Fedora 20, and is only going to keep
taking longer. By having a local up to date Fedora cloud image, this
time can be saved on each image build.

There is one minor change to support this in that /tmp/grub needs to get
cleaned up at the end of image builds so that the image can be reused.
Plus, there is no reason for it to stick around anyway.  (didn't think
this was worth a seperate commit).

Change-Id: Ic74d138da922ecc99c38c27f105170d90009a84a
2014-01-28 11:01:30 -05:00
James Slagle
380df31aac Remove old versions of grub2 from the yum cache
Before downloading and caching the latest version of grub2, we need to
first remove all old versions. Otherwise, the find command that writes
the grub2 version to /tmp/grub/install to install during the finalise
phase could pick one of the older versions of grub2 in the cache. This
will cause the install during the finalise phase to fail since the older
version of grub2 will conflict with the newer installed version of
grub2-tools.

Change-Id: I5b43e359db3ba81ed6283dfb41c7e89629516d38
2014-01-10 17:12:13 -05:00
Steve Baker
9ba761ef27 Install fedora grub from cached rpm during finalise
When uninstalling grub2, leave all its dependencies
including grub2-tools installed to minimise the number of packages
which need to be installed in the finalise stage.

Since the yum cache is unmounted during finalise, installing
grub2 in finalise is slowed by re-populating the yum cache.

This change copies the grub2 rpm out of the yum cache so it can be installed
from file during finalise.

This should prevent disk becoming full during finalise on Fedora.

Closes-Bug: #1217185

Change-Id: If095adc4abb52a19a3aa0b1caebfb3e4d8f605ef
2013-09-15 09:11:58 +10:00
Steve Baker
c182fef45c On Fedora, use Linux Foundation bzr lsb_release
Installing redhat-lsb-core adds 87M to the install due
to bugzilla #1002342

lsb_release is a platform agnostic script, so this change fetches
a single file via source-repositories from linuxfoundation bzr http
and installs it to /usr/local/bin

Change-Id: I4c979d4eb5e34a753d9143d9dcfe4e5d08f74a0d
2013-09-04 10:16:49 +12:00
Chris Alfonso
301c3c4475 Extracting common functionality for rpm based distros
Rather than dublicating code to implement rhel or any
other derivitive, this patch introduces an rpm-distro
element that should be used as a dependency.

Change-Id: I8a92bb041764d03f430b438f0013704f79a8674c
2013-08-20 16:44:19 -04:00
Lucas Alvares Gomes
f17e169f69 Add /usr/local/bin to the secure_path variable.
This patch will append /usr/local/bin to the sudoers secure_path variable,
by doing so commands prefixed with sudo will then find some binaries
delivered by other elements in that path (e.g nova-rootwrap).

Change-Id: I1ebad8b1932620559a3d90aa39298f9b12e636fd
2013-06-12 11:01:01 +01:00
Steve Baker
04e8d1cc00 install redhat-lsb before pre-install.d baseline-tools
baseline-tools expects lsb_release (although tolerates it not being there)

Order needs to be 01-override-yum-arch, 02-lsb, 03-baseline-tools
hence the renames.

Possibly lsb_release isn't cared enough about to do this.

Change-Id: I03abffb1ab2f560e746ba4ffd407605de31f4930
2013-05-13 15:58:31 +12:00
Robert Collins
cb62bae9b8 Build images using loopdev instead of qemu-nbd.
Qemu-nbd does not perform well with older versions of qemu due to
the lack of writeback caching mode. It also only builds qcow2 images
and there is a desire for raw image support. Finally, qemu-nbd makes
it very difficult to build images concurrently due to the somewhat
opaque nature of how it selects a /dev/nbd# device. losetup, on
the other hand, makes this process very straight forward.

Change-Id: I309fad8af4fd1e8d1720c17b65e1897a76d5e897
Co-Author: Clint Byrum <clint@fewbar.com>
2013-04-30 08:56:12 -07:00
Tim Miller
9eda303f5f Fedora element allows root to sudo without TTY.
The root user tries to `sudo -u stack`, without a tty,
causing fedora+devstack images builds to fail in Jenkins.

Change-Id: Ia0a7fb315cf9bd17cf250e70dba06363a697c97c
2013-04-09 16:46:16 -07:00
Robert Collins
f42cb641bf Fedora needs to depend on dib-run-parts too.
Change-Id: I56611d1c2bf13c8d24a87869bf8334d8e4992f6f
2013-02-15 15:34:09 +13:00
Robert Collins
9afddcf266 New element that uses a fedora cloud image as the base.
Change-Id: I7d83bb2b359e7a8c3858eca04c96e35cf4e1fe9e
2013-02-15 09:33:29 +13:00