Commit Graph

62 Commits

Author SHA1 Message Date
Gregory Haynes
8434e5afbf Set DIB_RELEASE in ubuntu element
The other distro elements set DIB_RELEASE which allows the other
elements to know what distro release is being built during the
extra-data or environment.d phases.

Change-Id: I00bf13410ded5b678ebc66ff191891ed3cc80f4f
2015-03-04 23:11:27 +00:00
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
Jenkins
084d1dfc50 Merge "Use package-installs for ubuntu and base elements" 2015-02-11 11:12:35 +00:00
Gregory Haynes
c4bbb6f3bc Create docs site containing element READMEs
We currently do not have the ability to create a docs site which
outlines all the elements.

Change-Id: I77ccf61e0c4b1509b3e7ce9b8f15ea5ccfd50d9b
2015-02-10 11:45:35 -08:00
Gregory Haynes
21799254a7 Use package-installs for ubuntu and base elements
Both ccache and linux-image-generic were being installed by
install-packages rather than using a package-installs.yaml.

Change-Id: Ib54c5b51d605278bb9d046a897be989c17c6fb0f
2015-02-06 10:13:08 -08:00
Gregory Haynes
74dca3734c Add apt-get autoremove
We end up with some unneeded packages by default, we should autoremove
them before were done.

Change-Id: Ib9e08e623d952ea3c04c764511dc860915d0abb2
2015-02-05 20:42:02 -08:00
Ryan Brady
1aecb41b7e Add deprecation warning when using map-services
This patch writes a warning out to stderr to notify element authors
that may be using map-services to migrate to svc-map.

Change-Id: Ic80db16c607958d025e89b3a4058a9cbb568938e
2014-11-12 17:03:49 +00:00
Ghe Rivero
873de01491 Remove first-boot.d support
After being deprecated two releases ago, finally remove any reference
for the support of first-boot.d

Change-Id: I08d67404ef48cad61db3b18fb86e970abfa5d2b6
2014-10-16 09:48:14 +00:00
Pino Toscano
267e96f52c Centralize handling of /lost+found
Just remove globally /lost+found after the root and install phases, so
distribution elements don't need to do that by themselves.

Change-Id: Ic783e613bd8794aefd3f40c9a7c308d14cd04b8d
2014-08-04 11:48:21 +02:00
Jon-Paul Sullivan
94535ebb21 Lock around ubuntu tarball download
Make this safe for parallel builds

Change-Id: I578fa38e1d44bc205b70d087d161b471cd260fa1
2014-07-18 09:52:39 +01:00
Robert Collins
eca284cab7 Really handle Ubuntu mirror cache skew,
The last patch to do this only handled the case of SHA256SUM being
stale, but the image is more likely to be stale in the default
configuration as the hash file is downloaded over HTTPS.

Change-Id: I6531fa684e560cad48c3696394d48a600680c875
Closes-Bug: #1336067
2014-07-09 08:07:58 +12:00
Chris Jones
a65d74f171 Last ditch effort to correct a wrong shasum.
Some users on corp networks are finding that cloud images appear in
their proxies before SHA256SUMS files.
We now try to force any to upstream proxies to update their copy and
retry the checksum, rather than immediately failing.
We also now add proper argument parsing to cache-url, and associated
help functionality, since we have now grown our first argument.

Change-Id: I44d44b62db8d1df990606fdf087ec1b837f491f6
Closes-Bug: #1336067
2014-07-05 12:06:28 -07:00
Steve Kowalik
cf9870729d Drop ending slash from DIB_CLOUD_IMAGES
The DIB_CLOUD_IMAGES variable in ubuntu's root.d is already used
everywhere with a /, so we can safely drop it from the default
value.

Change-Id: I39dbd3f4004052fcccb4131dc838759f4c82312a
2014-06-23 16:22:51 +10:00
Dan Prince
50374fe4e7 Name 99-setup-first-boot uniquely
While an end user would never use both redhat-common and ubuntu
elements at the same time we should always use unique names
for things per DIB conventions.

Change-Id: I2cabc583a1fd41d4fe7fbf8cf93127d49e26aff4
2014-06-11 08:16:41 -04:00
Jenkins
6ff1681915 Merge "Reinstate Trusty as default for Ubuntu" 2014-06-11 04:28:56 +00:00
Jenkins
336398d57a Merge "Only use Ec2 cloud-init data source for Ubuntu" 2014-06-10 23:06:27 +00:00
Adam Gandelman
40914bd121 Reinstate Trusty as default for Ubuntu
Now that issues associated with this bump have been addressed
elsewhere, reinstate trusty as the default DIB_RELEASE for
the ubuntu element.  Also adds a note about memory requirements
to the ramdisk element.

Change-Id: Ia89c83ba0ee4ad3bd89b833ba0db08135eac63ed
2014-06-03 16:28:25 -07:00
Adam Gandelman
f61c1acf81 Only use Ec2 cloud-init data source for Ubuntu
Default to only having cloud-init query Ec2 on first boot for Ubuntu,
until cloud-init has been SRU'd to fix the CloudSigma data source issue
that causes Trusty boots to hang.

Change-Id: Icb3734d5ae78f4a0a6c0fae1af4a2ce3c809308c
Partial-bug: #1316475
2014-06-03 16:27:41 -07:00
Dan Prince
50cb019a25 Set DISTRO_NAME in OS environment.d
Updates the various operating system elements so that we
set the DISTRO_NAME variable for each distro.

This env var is used by bin/pkg-map to set the default
distribution name for package name mappings.

Change-Id: Ib4b05eb7191dd50d25799a0bac51fd15c01b74cb
2014-05-28 12:22:02 -04:00
Jenkins
ab8a0f4bdd Merge "add some missing \n at end of file" 2014-05-28 00:40:57 +00: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
Jenkins
f70a9fa4e2 Merge "Add map-services for debian distros." 2014-05-19 21:23:00 +00:00
Gonéri Le Bouder
ea3f4dd459 4 spaces indent
ensure 4 spaces indentation is used everywhere.

Change-Id: Ieb48faacb4c96b7b358771d70c17f2f22d0354f4
2014-05-10 11:17:29 +02:00
Trent Geerdes
771ed1903c Adding -x to set parameters for more output
When the cache tarball gets fail the output doesn't indicate
what url is failing.  Adding '-x' displays the urls attempted.

Change-Id: I71b2dbfd712e72c591410ca9b68edc76d493ad6e
2014-05-08 14:41:03 -06:00
Ben Nemec
16be6d7ce0 set -u and -o pipefail everywhere
As with the previous similar changes, this is intended to catch
problems as they happen instead of ignoring them and continuing on
to potentially fail later.  Setting this on all existing scripts
will allow us to enforce use via Jenkins.

Change-Id: Iad2d490c86dceab148ea9ab08f457c49a5d5352e
2014-05-06 15:51:07 -05:00
Gonéri Le Bouder
3ae4edc276 add some missing \n at end of file
This to avoid the “No newline at end of file” error from patch/git.

Change-Id: Ice82d4a36a0893e8f71dbffbdab154d1fbab8a09
2014-05-06 13:43:53 +02:00
Dan Prince
3a7800ec99 Add map-services for debian distros.
DIB's map-services is currently used in TIE's os-svc-config
binaries to support service name lookups. Many of the systemd
specific functions require bin/map-services to exist.

This change adds bin/map-services files that are noops
to both the debian and ubuntu elements so that as those
distros move towards using systemd they can make use
of the functions we already have in place.

Change-Id: If8d61f3858b11de86c3292e840d033e5e3cecedb
2014-05-05 16:08:40 -04:00
Ben Nemec
f6ba2aeaf4 set -e all the things
Using set -e in all of our scripts will prevent some subtle bugs
from slipping in, and will allow us to enforce use of set -e with
tooling.

This change also adds -u and set -o pipefail in the less complex
scripts where it is unlikely to cause problems.  A follow-up change
will enable those options in the complex scripts so that if it
breaks something it can be reverted easily.

Change-Id: I0ad358ccb98da7277a0ee2e9ce8fda98438675eb
2014-04-25 17:38:51 -05:00
Adam Gandelman
927f80adaa Revert default Ubuntu release back to Saucy
Trusty ramdisks do not boot, failing to exec init.  This reverts
the default DIB_RELEASE back to Saucy until Trusty ramdisks have
been properly tested.

Change-Id: I5ac81822b78805275268cecc021a74a62c22ef58
2014-04-24 11:19:43 -07:00
Clint Byrum
404c695de9 Make "trusty" (Ubuntu 14.04) the default release
Ubuntu 14.04 was released today. Saucy will be EOL in 3 months.

Change-Id: I2043c3dfa8b795ae587b42cd80d3a0bf866bf82a
2014-04-17 11:20:06 -07:00
Jon-Paul Sullivan
793dae8fe6 Use provides to note an element provides an OS
Use "operating-system" to denote that an element provides that to the
image being created.  This can then be used to specify an abstract
dependency in other elements to assist in build-time image verification.

Change-Id: Ic125803da65e0f8f8c20ef90b08815f4f7d09762
2014-04-10 14:42:04 +01:00
Ben Nemec
63230414d2 Alphabetize all element-deps
Change-Id: Idc31d60daeea61d6df0b70dac4a5671fa5a804ee
2014-03-26 15:23:18 -05:00
Steve Kowalik
a84611d766 Replace security.ubuntu.com when setting mirror
The current method to rewrite the mirror URL in the ubuntu element will
only rewrite archive.ubuntu.com, which leaves the security URL alone.
This is probably not intended for people who are creating images behind
firewalls.

Change-Id: I54a867e0e9d5a7c94324a5c00ff1a83b4e6e4524
2014-02-24 11:00:24 +11:00
Steve Kowalik
48f5359efb Allow use of mirrors when building Ubuntu images
Add a script to ubuntu's pre-install.d that will change
archive.ubuntu.com to a mirror specified in $DIB_DISTRIBUTION_MIRROR.

Change-Id: Idfd5a40ec8a1912a5de5dcdcaf9795946b0b53b8
2014-01-20 15:07:04 +11:00
Chris Jones
a84b2763fc Switch Ubuntu element to installing saucy.
In tests, saucy has been able to match raring for the ability to bring
up clouds, so we can roll forwards and switch the default to saucy.

Change-Id: I4df35d40f902c0daa7b2761d7afea8db25526753
2013-11-27 10:10:39 +00:00
Ripal Nathuji
8f118af7d3 Fix issue with Ubuntu grub pre-install step for ARM
The Ubuntu build for ARM breaks when the pre-install step attempts to remove
grub components. This change gates those package removals based on whether
they are currently installed.

Change-Id: Ie169dbf12213e69b3713b3b1f9a68ae224f9fd31
2013-11-19 15:26:17 -06:00
Victor Lowther
43b70ce224 /bin/bash all the things.
Since we are using bash syntax in some of the element fragments,
we should make sure we use bash for all of them, so that things don't
break on systems where /bin/sh != /bin/bash.

Change-Id: If2f043c57aa4e1492b7f9839213ef6123f683612
2013-11-17 16:59:31 -06:00
iberezovskiy
f23babe971 Check existence of directory 'lost+found'
The command `sudo rmdir $TARGET_ROOT/lost+found` will fail
if `$TARGET_ROOT/lost+found` directory doesn't exist,
e.g. when you use non-default image.

Fixes bug #1245856

Change-Id: I48c8f2f201b29912a726249023ca7d20893cc958
2013-10-29 18:51:49 +04:00
Tim Serong
6da49c6d49 Use --numeric-owner when extracting base image
When extracting the base image without --numeric-owner, user and group
names in the tarball are mapped to uid/gid by the host.  This can cause
problems when building an image for some other distro than you're
running yourself.  For example, building an Ubuntu image on openSUSE
ends up with /var/cache/man in the image owned by 'proxy' (uid 13)
instead of 'man' (uid 6), because the host (openSUSE) uses uid 13 for
the 'man' user.  This particular man/proxy discrepancy results in
"fopen: Permission denied" errors when apt-get does its "Processing
triggers for man-db" thing in the Ubuntu system.  I wouldn't be
surprised if there were other kinks caused by this uid/gid mapping
discrepancy too, but that's the one I found so far.

The same thing can also happen with Fedora, but seems to be less likely,
or at least less obvious to me when building Fedora images on openSUSE.
But, IMO, it's better to be safe and just use --numeric-owner on all
base image untarring outside the chroot.

Change-Id: I9da5ac66dd182e7278fe4fee932093f61d35673a
2013-10-08 22:45:51 +11:00
Jenkins
6ede4c2016 Merge "Add DIB_IMAGE_CACHE" 2013-09-19 20:47:17 +00:00
Cody A.W. Somerville
a8d8e7a30d Do not prompt on removal of apt-xapian-index from ubuntu cloud images
Change-Id: I49582a0c51aafcda6c0ad7911c291d58bb6c52a6
2013-09-19 16:35:31 -04:00
Matthew Farrellee
1d2a85d5e4 Add DIB_IMAGE_CACHE
DIB_IMAGE_CACHE will be a user override for the location where images
are cached. Default location is ~/.cache/image-create

Change-Id: I3e9b9f970864d555c9ec9436344b53f6d3d66dfa
2013-09-19 14:34:05 -04:00
Clint Byrum
2d70812e81 Remove apt-xapian-index from ubuntu cloud images
This package recently caused us some very large headaches when it
was updated for a security issue. It is completely unnecessary and
should be removed.

Note that we have recommended that it be removed from the cloud images
in launchpad bug #1227425.

fixes bug #1227420

Change-Id: Ic0d4efa7b44c46271d19576f5191c9421d07c015
2013-09-18 17:22:59 -07:00
Steven Dake
2c73a001b2 dkms is unavailable on RHEL and derivatives
The dynamic kernel module system is not available on RHEL, CentOS,
Scientific Linux, or SUSE.  Make it part of the distro post-install
rather then base post-install.

Change-Id: Ic2c345bf9f0738dadae611194e263d3a5d424a3e
2013-08-12 19:07:28 -07:00
Clint Byrum
5a69fa879e Make Ubuntu 13.04 (raring) the default release
Ubuntu 13.04 has been released now for 3 months. The updated libvirt,
openvswitch and kernel are all beneficial to various OpenStack components,
and many other software is updated beyond the versions in Ubuntu 12.10.

Change-Id: I358aed8bf906c3ff5103f19b1f9e6ac689b5d5ee
2013-07-29 17:02:23 -07:00
Robert Collins
d7379df8b8 Enable --offline support for Ubuntu root images.
When --offline is set elements should not revalidate cached data. The
ubuntu element had not been updated to match this. SHA checking is
also skipped as we only move a new cached file into place when the
hash matches, and we might download a new hash before updating the
image cache, which would cause persistent --offline failures.

Change-Id: If1a0366b51951a73b7a3ffe23a29a3d910b08938
2013-07-18 13:19:35 +12:00
Mark McLoughlin
6c997fda97 Re-use cache_url() in fedora element.
The fedora element downloads images too, so we should re-use the caching
code from the ubuntu element.

There doesn't seem to be other examples of code shared between root.d
scripts. In the fedora and dpkg elements we copy install-packages into
the chroot, but that model doesn't apply when we're running scripts
outside of the chroot. Seems sane to just run it directly from the bin/
dir in the temporary hooks directory.

Change-Id: Iaa6aca660042fea323cab4271633a4bdbbc271b8
2013-06-20 00:04:59 +01:00
Mark McLoughlin
efb1f435d4 Improve first time download of ubuntu images.
If a cached copy of the file doesn't exist, cache_url() passes a
non-existent path to -z/--time-cond and you see this warning:

 Warning: Illegal date format for -z, --timecond (and not a file name).
 Warning: Disabling time condition. See curl_getdate(3) for valid date syntax.

It works just fine, but the warning is ugly.

Change-Id: Ic6f13a2c596b988308d7fca9cd1745e5d48ae5fb
2013-06-20 00:04:53 +01:00
Robert Collins
03b437db0e Fix cloud-init-nocloud to actually work.
Bug 1124593 reported that ssh host keys were not being created, and the
lack of seed metadata files was the cause. Add those files and remove
the workaround.

Change-Id: I6fb55be7f8c7efd1f75aeba9123f495e312ff695
2013-06-12 13:28:27 +12:00
Lucas Alvares Gomes
02ee161e81 Refactor the first boot routine.
Setting up a routine to run at first time the system boot may vary from
distribution to distribution. This patch will remove the logic from the
diskimage-builder code and put it into the elements.

The base element will now deploy a dib-first-boot script and each OS
element will ensure that this script runs at rc.local time. By doing
that we will put the OS specific stuff in the OS elements and remove
the embedded code out of the img-function file.

Change-Id: I24c5d1b1185de5693f145347fe912245f1ba7dfe
2013-05-16 15:50:10 +01:00