diff --git a/bindep.txt b/bindep.txt index 4f9b42547..5a9c382ed 100644 --- a/bindep.txt +++ b/bindep.txt @@ -1,2 +1,3 @@ # This is a cross-platform list tracking distribution packages needed by tests; # see http://docs.openstack.org/infra/bindep/ for additional information. +squashfs-tools diff --git a/diskimage_builder/elements/bootloader/README.rst b/diskimage_builder/elements/bootloader/README.rst index ecfefc428..86f759143 100644 --- a/diskimage_builder/elements/bootloader/README.rst +++ b/diskimage_builder/elements/bootloader/README.rst @@ -1,7 +1,14 @@ ========== bootloader ========== -Installs grub[2] on boot partition on the system. In case GRUB2 -is not available in the system, a fallback to Extlinux will happen. It's -also possible to enforce the use of Extlinux by exporting a DIB_EXTLINUX -variable to the environment. + +Installs ``grub[2]`` on boot partition on the system. In case GRUB2 is +not available in the system, a fallback to Extlinux will happen. It's +also possible to enforce the use of Extlinux by exporting a +``DIB_EXTLINUX`` variable to the environment. + +Arguments +========= + +* ``DIB_GRUB_TIMEOUT`` sets the ``grub`` menu timeout. It defaults to + 5 seconds. Set this to 0 (no timeout) for fast boot times. diff --git a/diskimage_builder/elements/bootloader/finalise.d/50-bootloader b/diskimage_builder/elements/bootloader/finalise.d/50-bootloader index d6e0d53da..0769c3c34 100755 --- a/diskimage_builder/elements/bootloader/finalise.d/50-bootloader +++ b/diskimage_builder/elements/bootloader/finalise.d/50-bootloader @@ -53,7 +53,7 @@ function install_grub2 { if [ -f "/tmp/grub/install" ] ; then source /tmp/grub/install elif [[ "$ARCH" =~ "ppc" ]]; then - install-packages -m bootloader grub-ieee1275 + install-packages grub-ieee1275 else install-packages -m bootloader grub-pc fi @@ -127,6 +127,7 @@ function install_grub2 { GRUB_CFG=/boot/grub/grub.cfg fi + echo "GRUB_TIMEOUT=${DIB_GRUB_TIMEOUT:-5}" >>/etc/default/grub echo 'GRUB_TERMINAL="serial console"' >>/etc/default/grub echo 'GRUB_GFXPAYLOAD_LINUX=text' >>/etc/default/grub echo 'GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=ttyS0,115200 no_timer_check"' >>/etc/default/grub diff --git a/diskimage_builder/elements/cloud-init/README.rst b/diskimage_builder/elements/cloud-init/README.rst index e76e956bf..707823e48 100644 --- a/diskimage_builder/elements/cloud-init/README.rst +++ b/diskimage_builder/elements/cloud-init/README.rst @@ -10,7 +10,7 @@ Currently only supports Gentoo. Environment Variables --------------------- -DIB_CLOUD_INIT_ALLOW_PASS_AUTH +DIB_CLOUD_INIT_ALLOW_SSH_PWAUTH :Required: No :Default: password authentication disabled when cloud-init installed :Description: customize cloud-init to allow ssh password diff --git a/diskimage_builder/elements/dib-python/environment.d/50-dib-python-version b/diskimage_builder/elements/dib-python/environment.d/50-dib-python-version index 27331dbd6..58a5dc7a9 100644 --- a/diskimage_builder/elements/dib-python/environment.d/50-dib-python-version +++ b/diskimage_builder/elements/dib-python/environment.d/50-dib-python-version @@ -16,6 +16,8 @@ if [ -z "${DIB_PYTHON_VERSION:-}" ]; then DIB_PYTHON_VERSION=2 elif [ "$DISTRO_NAME" == "centos7" ]; then DIB_PYTHON_VERSION=2 + elif [ "$DISTRO_NAME" == "rhel7" ]; then + DIB_PYTHON_VERSION=2 elif [ "$DISTRO_NAME" == "opensuse" ]; then DIB_PYTHON_VERSION=2 fi diff --git a/diskimage_builder/elements/ironic-agent/element-deps b/diskimage_builder/elements/ironic-agent/element-deps index 27cda407b..39d864612 100644 --- a/diskimage_builder/elements/ironic-agent/element-deps +++ b/diskimage_builder/elements/ironic-agent/element-deps @@ -3,5 +3,6 @@ no-final-image package-installs pip-and-virtualenv pkg-map +runtime-ssh-host-keys source-repositories svc-map diff --git a/diskimage_builder/elements/openssh-server/post-install.d/80-enable-sshd-service b/diskimage_builder/elements/openssh-server/post-install.d/80-enable-sshd-service index 50238bbcc..ee59b3a41 100755 --- a/diskimage_builder/elements/openssh-server/post-install.d/80-enable-sshd-service +++ b/diskimage_builder/elements/openssh-server/post-install.d/80-enable-sshd-service @@ -22,8 +22,12 @@ case "$DIB_INIT_SYSTEM" in # let dib-init-system's postinstall handle enabling init scripts exit 0 ;; + sysv) + # ssh is enabled by default, nothing to do + exit 0 + ;; *) - echo "Unsupported init system" + echo "Unsupported init system $DIB_INIT_SYSTEM" exit 1 ;; esac diff --git a/diskimage_builder/elements/opensuse-minimal/README.rst b/diskimage_builder/elements/opensuse-minimal/README.rst index 46df3c17c..7abe6e5b9 100644 --- a/diskimage_builder/elements/opensuse-minimal/README.rst +++ b/diskimage_builder/elements/opensuse-minimal/README.rst @@ -13,7 +13,7 @@ Environment Variables DIB_RELEASE :Required: No - :Default: 42.1 + :Default: 42.2 :Description: Set the desired openSUSE release. DIB_OPENSUSE_MIRROR: diff --git a/diskimage_builder/elements/opensuse-minimal/environment.d/10-opensuse-distro-name.bash b/diskimage_builder/elements/opensuse-minimal/environment.d/10-opensuse-distro-name.bash index c6aafbbc2..db0f47566 100644 --- a/diskimage_builder/elements/opensuse-minimal/environment.d/10-opensuse-distro-name.bash +++ b/diskimage_builder/elements/opensuse-minimal/environment.d/10-opensuse-distro-name.bash @@ -1,5 +1,5 @@ export DISTRO_NAME=opensuse -DIB_RELEASE=${DIB_RELEASE:-42.1} +DIB_RELEASE=${DIB_RELEASE:-42.2} export DIB_RELEASE=${DIB_RELEASE,,} export DIB_OPENSUSE_MIRROR=${DIB_OPENSUSE_MIRROR:-http://download.opensuse.org} case ${DIB_RELEASE} in diff --git a/diskimage_builder/elements/opensuse/README.rst b/diskimage_builder/elements/opensuse/README.rst index 5ca0da5e4..287f7db2e 100644 --- a/diskimage_builder/elements/opensuse/README.rst +++ b/diskimage_builder/elements/opensuse/README.rst @@ -18,7 +18,7 @@ Environment Variables DIB_RELEASE :Required: No - :Default: 13.1 + :Default: 42.2 :Description: Set the desired openSUSE release. DIB_CLOUD_IMAGES diff --git a/diskimage_builder/elements/opensuse/environment.d/10-opensuse-distro-name.bash b/diskimage_builder/elements/opensuse/environment.d/10-opensuse-distro-name.bash index 38efb86fc..a9d195eb1 100644 --- a/diskimage_builder/elements/opensuse/environment.d/10-opensuse-distro-name.bash +++ b/diskimage_builder/elements/opensuse/environment.d/10-opensuse-distro-name.bash @@ -1,5 +1,5 @@ export DISTRO_NAME=opensuse -export DIB_RELEASE=${DIB_RELEASE:-13.1} +export DIB_RELEASE=${DIB_RELEASE:-42.2} case ${DIB_RELEASE} in # Old openSUSE releases 13*) export OPENSUSE_REPO_DIR=openSUSE_${DIB_RELEASE} ;; diff --git a/diskimage_builder/elements/opensuse/test-elements/build-succeeds/README.rst b/diskimage_builder/elements/opensuse/test-elements/build-succeeds/README.rst new file mode 100644 index 000000000..49ba1444a --- /dev/null +++ b/diskimage_builder/elements/opensuse/test-elements/build-succeeds/README.rst @@ -0,0 +1 @@ +Verify we can build an openSUSE image. diff --git a/diskimage_builder/elements/runtime-ssh-host-keys/post-install.d/80-ssh-keygen b/diskimage_builder/elements/runtime-ssh-host-keys/post-install.d/80-ssh-keygen index 926a12d69..48a844485 100755 --- a/diskimage_builder/elements/runtime-ssh-host-keys/post-install.d/80-ssh-keygen +++ b/diskimage_builder/elements/runtime-ssh-host-keys/post-install.d/80-ssh-keygen @@ -24,8 +24,12 @@ case "$DIB_INIT_SYSTEM" in # let dib-init-system's postinstall handle enabling init scripts exit 0 ;; + sysv) + # nothing to do + exit 0 + ;; *) - echo "Unsupported init system" + echo "Unsupported init system $DIB_INIT_SYSTEM" exit 1 ;; esac diff --git a/diskimage_builder/elements/ubuntu-minimal/test-elements/build-succeeds/README.rst b/diskimage_builder/elements/ubuntu-minimal/test-elements/precise-build-succeeds/README.rst similarity index 100% rename from diskimage_builder/elements/ubuntu-minimal/test-elements/build-succeeds/README.rst rename to diskimage_builder/elements/ubuntu-minimal/test-elements/precise-build-succeeds/README.rst diff --git a/diskimage_builder/elements/ubuntu-minimal/test-elements/precise-build-succeeds/environment.d/10-set-distro.bash b/diskimage_builder/elements/ubuntu-minimal/test-elements/precise-build-succeeds/environment.d/10-set-distro.bash new file mode 100644 index 000000000..3747859b1 --- /dev/null +++ b/diskimage_builder/elements/ubuntu-minimal/test-elements/precise-build-succeeds/environment.d/10-set-distro.bash @@ -0,0 +1 @@ +export DIB_RELEASE=precise diff --git a/diskimage_builder/elements/ubuntu-minimal/test-elements/trusty-build-succeeds/README.rst b/diskimage_builder/elements/ubuntu-minimal/test-elements/trusty-build-succeeds/README.rst new file mode 100644 index 000000000..b7190827e --- /dev/null +++ b/diskimage_builder/elements/ubuntu-minimal/test-elements/trusty-build-succeeds/README.rst @@ -0,0 +1 @@ +Verify we can build a ubuntu-minimal image. diff --git a/diskimage_builder/elements/ubuntu-minimal/test-elements/trusty-build-succeeds/environment.d/10-set-distro.bash b/diskimage_builder/elements/ubuntu-minimal/test-elements/trusty-build-succeeds/environment.d/10-set-distro.bash new file mode 100644 index 000000000..02d902a4b --- /dev/null +++ b/diskimage_builder/elements/ubuntu-minimal/test-elements/trusty-build-succeeds/environment.d/10-set-distro.bash @@ -0,0 +1 @@ +export DIB_RELEASE=trusty diff --git a/diskimage_builder/elements/ubuntu-minimal/test-elements/xenial-build-succeeds/README.rst b/diskimage_builder/elements/ubuntu-minimal/test-elements/xenial-build-succeeds/README.rst new file mode 100644 index 000000000..b7190827e --- /dev/null +++ b/diskimage_builder/elements/ubuntu-minimal/test-elements/xenial-build-succeeds/README.rst @@ -0,0 +1 @@ +Verify we can build a ubuntu-minimal image. diff --git a/diskimage_builder/elements/ubuntu-minimal/test-elements/xenial-build-succeeds/environment.d/10-set-distro.bash b/diskimage_builder/elements/ubuntu-minimal/test-elements/xenial-build-succeeds/environment.d/10-set-distro.bash new file mode 100644 index 000000000..7cc2c8877 --- /dev/null +++ b/diskimage_builder/elements/ubuntu-minimal/test-elements/xenial-build-succeeds/environment.d/10-set-distro.bash @@ -0,0 +1 @@ +export DIB_RELEASE=xenial diff --git a/diskimage_builder/elements/zypper-minimal/root.d/08-zypper-chroot b/diskimage_builder/elements/zypper-minimal/root.d/08-zypper-chroot index 7e4b22d08..81d491761 100755 --- a/diskimage_builder/elements/zypper-minimal/root.d/08-zypper-chroot +++ b/diskimage_builder/elements/zypper-minimal/root.d/08-zypper-chroot @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright 2016 SUSE Linux Products Gmb +# Copyright 2016 SUSE Linux GmbH # Copyright 2015 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); you may diff --git a/diskimage_builder/lib/disk-image-create b/diskimage_builder/lib/disk-image-create index 0814bf416..ea0f68354 100644 --- a/diskimage_builder/lib/disk-image-create +++ b/diskimage_builder/lib/disk-image-create @@ -48,7 +48,7 @@ function show_options () { echo "Options:" echo " -a i386|amd64|armhf -- set the architecture of the image(default amd64)" echo " -o imagename -- set the imagename of the output image file(default image)" - echo " -t qcow2,tar,vhd,docker,aci,raw -- set the image types of the output image files (default qcow2)" + echo " -t qcow2,tar,tgz,squashfs,vhd,docker,aci,raw -- set the image types of the output image files (default qcow2)" echo " File types should be comma separated. VHD outputting requires the vhd-util" echo " executable be in your PATH. ACI outputting requires the ACI_MANIFEST " echo " environment variable be a path to a manifest file." @@ -202,12 +202,22 @@ for X in ${!IMAGE_TYPES[@]}; do exit 1 fi ;; + tgz) + # Force tar to be created. + IMAGE_TYPES+=('tar') + ;; vhd) if [ -z "$(which vhd-util)" ]; then echo "vhd output format specified but no vhd-util executable found." exit 1 fi ;; + squashfs) + if [ -z "$(which mksquashfs)" ]; then + echo "squashfs output format specified but no mksquashfs executable found." + exit 1 + fi + ;; docker) if [ -z "$(which docker)" ]; then echo "docker output format specified but no docker executable found." @@ -454,6 +464,10 @@ for X in ${!IMAGE_TYPES[@]} ; do fi sudo chown $USER: $IMAGE_NAME.${IMAGE_TYPES[$X]} unset IMAGE_TYPES[$X] + elif [ "${IMAGE_TYPES[$x]}" == "squashfs" ]; then + sudo mksquashfs ${TMP_BUILD_DIR}/mnt $IMAGE_NAME.squash -comp xz \ + -noappend -root-becomes ${TMP_BUILD_DIR}/mnt \ + -wildcards -e "proc/*" -e "sys/*" -no-recovery elif [ "${IMAGE_TYPES[$X]}" == "docker" ]; then sudo tar -C ${TMP_BUILD_DIR}/mnt -cf - --exclude ./sys \ --exclude ./proc --xattrs --xattrs-include=\* . \ @@ -487,7 +501,7 @@ if [[ (! $IMAGE_ELEMENT =~ no-final-image) && "$IS_RAMDISK" == "0" ]]; then # We have to do raw last because it is destructive if [ "$IMAGE_TYPE" = "raw" ]; then has_raw_type=1 - else + elif [ "$IMAGE_TYPE" != "squashfs" ]; then compress_and_save_image $IMAGE_NAME.$IMAGE_TYPE fi done diff --git a/diskimage_builder/lib/img-functions b/diskimage_builder/lib/img-functions index bc02ff607..2ab320ec4 100644 --- a/diskimage_builder/lib/img-functions +++ b/diskimage_builder/lib/img-functions @@ -70,7 +70,7 @@ function run_in_target () { # Bug: #1330290 # Force the inclusion of a typical set of dirs in PATH, this is needed for guest # distros that have path elements not in the host PATH. - sudo -E chroot $TMP_MOUNT_PATH env -u TMPDIR PATH="\$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" sh -c "$cmd" + sudo -E chroot $TMP_MOUNT_PATH env -u TMPDIR -u VIRTUAL_ENV PATH="\$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" sh -c "$cmd" export HOME=$ORIG_HOME } @@ -129,6 +129,9 @@ function compress_and_save_image () { fi if [ "$IMAGE_TYPE" = "raw" ]; then mv $TMP_IMAGE_PATH $1-new + elif [ "$IMAGE_TYPE" == "tgz" ]; then + gzip -9 < $IMAGE_NAME.tar > $1-new + rm $IMAGE_NAME.tar elif [ "$IMAGE_TYPE" == "vhd" ]; then cp $TMP_IMAGE_PATH $1-intermediate vhd-util convert -s 0 -t 1 -i $1-intermediate -o $1-intermediate diff --git a/doc/source/user_guide/building_an_image.rst b/doc/source/user_guide/building_an_image.rst index a8401364f..4b0c436ad 100644 --- a/doc/source/user_guide/building_an_image.rst +++ b/doc/source/user_guide/building_an_image.rst @@ -51,6 +51,8 @@ formats are: * qcow2 * tar + * tgz + * squashfs * vhd * docker * raw diff --git a/releasenotes/notes/grub-timeout-1cdd14a2b1467d89.yaml b/releasenotes/notes/grub-timeout-1cdd14a2b1467d89.yaml new file mode 100644 index 000000000..cedbc2fd6 --- /dev/null +++ b/releasenotes/notes/grub-timeout-1cdd14a2b1467d89.yaml @@ -0,0 +1,6 @@ +--- +features: + - The ``bootloader`` element will explicitly set the timeout to + ``5`` seconds when using ``grub`` (previously this was undefined, + but platform defaults were usually 5 seconds). Set this to ``0`` + for faster boots. diff --git a/releasenotes/notes/squashfs-output-91c1f0dc37474d3c.yaml b/releasenotes/notes/squashfs-output-91c1f0dc37474d3c.yaml new file mode 100644 index 000000000..98b1c5a2b --- /dev/null +++ b/releasenotes/notes/squashfs-output-91c1f0dc37474d3c.yaml @@ -0,0 +1,3 @@ +--- +features: + - New squashfs image output format. diff --git a/setup.cfg b/setup.cfg index cbc487c76..82df64595 100644 --- a/setup.cfg +++ b/setup.cfg @@ -8,10 +8,11 @@ author-email = openstack-dev@lists.openstack.org license: Apache License (2.0) home-page = http://docs.openstack.org/developer/diskimage-builder/ classifier = - Development Status :: 3 - Alpha + Development Status :: 5 - Production/Stable License :: OSI Approved :: Apache Software License Operating System :: POSIX :: Linux Programming Language :: Python :: 2.7 + Programming Language :: Python :: 3 Environment :: Console [build_sphinx] diff --git a/tests/run_functests.sh b/tests/run_functests.sh index a07a0811b..53334d971 100755 --- a/tests/run_functests.sh +++ b/tests/run_functests.sh @@ -16,6 +16,10 @@ export DIB_ELEMENTS=$(python -c ' import diskimage_builder.paths diskimage_builder.paths.show_path("elements")') +# Setup sane locale defaults, because this information is leaked into DIB. +export LANG=en_US.utf8 +export LC_ALL= + # # Default skip tests # @@ -27,11 +31,11 @@ DEFAULT_SKIP_TESTS=( fedora/build-succeeds # in non-voting gentoo/build-succeeds + opensuse/build-succeeds + ubuntu-minimal/precise-build-succeeds # good to have the test case around - but because of changes # in testing does not work always. debian-minimal/testing-build-succeeds - # Currently failing due to bug in locale generation - centos-minimal/build-succeeds # No longer reasonable to test upstream (lacks a mirror in infra) centos/build-succeeds ) @@ -202,7 +206,12 @@ while getopts ":hlj:t" opt; do echo "The available functional tests are:" echo for t in ${TESTS[@]}; do - echo " $t" + echo -n " $t" + if [[ " ${DEFAULT_SKIP_TESTS[@]} " =~ " ${t} " ]]; then + echo " [skip]" + else + echo " [run]" + fi done echo exit 0 diff --git a/tests/run_output_format_test.sh b/tests/run_output_format_test.sh index b2f435ad4..8f2e968ad 100755 --- a/tests/run_output_format_test.sh +++ b/tests/run_output_format_test.sh @@ -59,8 +59,8 @@ function build_test_image() { fi } -test_formats="tar raw qcow2 docker aci" -for binary in qemu-img docker ; do +test_formats="tar tgz squashfs raw qcow2 docker aci" +for binary in qemu-img docker mksquashfs; do if [ -z "$(which $binary)" ]; then echo "Warning: No $binary binary found, cowardly refusing to run tests." exit 1 diff --git a/tox.ini b/tox.ini index c9ad4159f..b69c03128 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py34,py27,pep8 +envlist = py35,py27,pep8 minversion = 1.6 skipsdist = True