Commit Graph

19 Commits

Author SHA1 Message Date
Ian Wienand
7550d25db0 Export die() function
I realised I'd been using die() in a few places assuming it was
available, but it wasn't exported.  I guess it didn't matter because
whatever was wrong, we were failing anyway :)

This exports the function to make it available to sub-processes, which
should remove the need to source it as done in several places.

Change-Id: I7b9a5a6db406e160099b6ed9fde80455ae227327
2016-05-27 09:25:22 +10:00
Paul Belanger
2be1bdc701 Add openssh-server package-install to local-config
Since we are modifing SSH keys, it should be safe to assume
openssh-server should be installed too.

Change-Id: I17ff05642bb2f0868d4c17819cd91b179068399a
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-12-07 15:23:00 -05:00
Paul Belanger
35b363698b Add DIB_LOCAL_CONFIG_USERNAME to local-config
Allow a user to override the username on where .ssh/authorized_keys is
installed.

Change-Id: I030d5a89260aed8b23a35c4cdc2d67629934b076
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
2015-11-24 10:42:14 -05: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
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
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
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
Ben Nemec
381ff6ab1d Fix set -eu and pipefail failures
Fixes problems found by set -eu and pipefail, including:
-Many unset variables
-Commands that can fail under normal circumstances, which breaks
with set -e.  This change swallows those expected errors to allow
our existing error code to handle them.
-The dkms element was not finding Fedora kernel versions correctly.
This may be an issue for other distros too, but since Fedora was
working fine without this functionality I only changed it to print
a warning message rather than failing the build when it happens.
-The ramdisk init script will not be set -eu because if it fails
the result is a kernel panic, which can be tricky to debug.
However, in testing with set -e a few failing commands were found
and have been fixed in this patch.

Change-Id: I44cf98dfc80cfcaec54b88cc83be80a3dbf2cec3
2014-04-15 20:53:15 -05:00
Ben Nemec
81957625e7 Set +x on executable files
Change-Id: I6007aa3f4e6326b1c7030ad0463c7e8f49fbd507
2014-03-20 15:38:30 -05:00
Robert Collins
2843e8a802 Improve local-config proxy handling.
We were applying proxy settings after apt-get install runs are done
in the Ubuntu element, which made it ineffective. Secondly, we were
not applying no_proxy settings to apt, which caused it to fail in
corporate settings. More explicit control may be facilitated in future
but local-config is a DTRT tool, and so we should help it DTRT.

I think I've correctly setup Zypper for this, and I have no idea
how to make the same improvement for Yum (and also Yum currently
doesn't set HTTPS proxies, which may lead to similar reports there).

Change-Id: Idbb9781d64d44b717ea22a25429383fa45d84148
2014-02-28 00:01:11 +13:00
Ralf Haferkamp
f6c2901b0a local-config: Configure proxy for zypper repos
This allows using the local-config element with openSUSE based images.

Closes-Bug: #1256982
Change-Id: I670c938a44095ea7e7c31b81194acc1555212f06
2013-12-10 15:54:59 +01:00
JUN JIE NAN
08797d44b5 Remove dot after TMP_HOOKS_PATH
"$TMP_HOOKS_PATH." is always be nonzero so we should remove the dot.

Change-Id: I0432bb3e21cc29806e1e2ae245dd4b6301ee9ba6
2013-12-02 12:44:11 +08:00
Robert Collins
5695fbd39e Set correct mode for .ssh/authorized_keys files.
Per bug 1182648 we were not setting the mode and as a result couldn't
log in, defeating the purpose of having a local-config element :).

Change-Id: I4114b9536392f1517eac8f4bbe6f4b60ce1186a1
2013-05-24 12:01:57 +12:00
Clint Byrum
4da169ce6e local-config: Configure proxy for apt and/or yum
Fixes fail to build image on Fedora

Change-Id: I30324081702ffc68e82499d81a841c8ae17119ce
2013-03-08 03:24:45 -08:00
Tim Miller
b880ef9017 local-config element adds authorized_key for root:
Currently, the local-config and stackuser elements
are intertwined.  local-config installs an authorized_key
for stackuser, if the stackuser element is in use.

This change does two things:
- add authorized_key for root from local-config element,
    regardeless of whether stackuser element is in use.
- install key for stack user from stackuser element,
    only if local-config element is in use.

Change-Id: I0d07b61404119ea0650c5c0fb98d6786adcf3ca9
2013-03-05 15:52:03 -08:00
Ghe Rivero
147489f239 Add missing whitespace to local-config.
Fix whitespace error in local-config/install.d/61-http-proxy that prevents
no-proxy being written.

Change-Id: Ie2511bb5b2504c42ff59ec277cd91bf92b56da59
2012-12-20 16:05:50 +13:00
Devananda van der Veen
dba9418f03 Copy both http and https proxy to local-config.
Previously, only http_proxy was copied into the local-config image.
We now preserve both http_proxy and https_proxy settings.

Change-Id: I4de2712f2772fb7d07b228cecdc0c8ec6f3df567
Co-authored-by: Chris Krelle <nobodycam@gmail.com>
2012-12-13 23:49:42 -08:00
Robert Collins
7afabfb06e Generate apt.conf files with correct content, fixes bug 1088805.
Change-Id: I26b855260fdfc472179774779558ed7f0947da6c
2012-12-11 21:23:07 +13:00
Monty Taylor
1eff4a436e Rename flavour to element.
Flavour is overloaded in openstack due to it being used by nova. Element
seems to have the same feeling of combinability without using a term already
in active use in the openstack community.

Change-Id: Ia4c028d4062a8f69c66665821c94dd4bcdf06031
2012-12-05 14:04:58 -08:00