Includes "Don't match editor backup files in environment" and "Order
execution of environment.d scripts". These had to be squashed because
the first change alone changes the order env.d scripts are sourced in.
The current glob match for environment files can source editor backup
files (foo.bash~) which will override the real changes you have made.
Other parts use the regex to avoid matching such files, so do
the same for environment file matching. Note this has to match "."
unlike the other regex, as most env files are "foo.bash"
Also sort the files before sourcing them to ensure a reliable order.
This change should be in line with current expectations, given the
convention is to numerically prefix scripts in this directory.
Update of: I934486b3ff5884063d29c6d9b66fd9b11140464c
Subsumes: Icc509f695d7a15a8026d8c7e463f06acf65499d7
Change-Id: Ibfb562c5970b40598fc95da1e8d4beb9d51d7612
This reverts commit 32eda4b92f.
I noticed today that environment.d files no longer seem to get sourced
by DIB. Reverting this commit fixes it.
Change-Id: I08a8feab541901c8fd0a803628f5aeb6c0eec598
Closes-bug: #1339116
The current glob match for environment files can source editor backup
files (foo.bash~) which will override the real changes you have made.
Other parts matche use the regex to avoid matching such files, so do
the same for environment file matching. Note this has to match "."
unlike the other regex, as most env files are "foo.bash"
Change-Id: I934486b3ff5884063d29c6d9b66fd9b11140464c
Force LC_ALL to C to allow printf to work independently
from the locale. Gives invalid number error if run in non-english
locale.
Change-Id: Ia68853505485fefbf0890313456e7edb6097666b
Closes-Bug: #1335932
This change adjusts the "inline" python function used to profile
run-parts duration to make it run successfully on both py2 and py3
Change-Id: Ib5287a56b8e2b3e882dca489192f01d9f01cd8ba
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
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
The phrase is no longer needed as of August 23, 2000 with Nicaragua's
joining of the Berne Convention.
Additionally, in at least one instance,
elements/cache-url/bin/cache-url, its existence in the file between
Copyright lines is just weird and feels misleading, even though it is
not.
Remove all of the lines, because sanity.
Change-Id: I24fd76c2b4f66b8036010b5079db39ead729abee
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
Don't assume environment.d is always under /tmp/in_target.d. This makes
dib-run-parts more flexible, and less specific to diskimage-builder. For
instance, dib-run-parts is already used by os-refresh-config, but
/tmp/in_target.d/environment.d is never going to exist when it's called
by os-refresh-config.
This is useful b/c elements can now install os-refresh-config scripts
under /opt/stack/os-config-refresh/environment.d to influence how
further scripts are run. Specifically, the OpenSuse packages prepend the
OpenStack user accounts with "openstack-". Instead of checking for which
users exists with an if/else in all the os-refresh-config scripts that
need to do user related things, we can just update the scripts to use
$NOVA_USER, etc. The OpenSuse element can then install a file under
/opt/stack/os-config-refresh/environment.d to set NOVA_USER to
openstack-nova. We could have files that declare defaults as well within
each specific element, or just set a default variable at the top of each
os-refresh-config script.
Change-Id: Iadbfad995da657e2965fd55fc4ba3a88138b4cfc
dib-run-parts should dereference symlinks, and if they point to an
executable file, execute that file as a script. This can be accomplished
by using the xtype predicate in the find command instead of the type
predicate.
This change is needed so that we can dynamically symlink hook scripts
into hook directories such as install.d at runtime to support different
install types.
Change-Id: I933e7f4b4dcf16956841d8c14aa63b0f9a18fc5d
When LC_NUMERIC is set to a format that doesn't use a decimal point,
`printf` will fail.
Change-Id: Ie6c4d075928f47b17cc413d537fc31c9d0734bdb
Signed-off-by: Tomas Sedovic <tsedovic@redhat.com>
Our custom dib-run-parts now supports --list for better compatibility
with some OS-provided run-parts tools.
Change-Id: I2feb615b2094d9d6522bfe9b422362223bb8e652
Closes-Bug: #1190521
- Ensures /sbin and friends are in $PATH when invoked (without this,
various sudo invocations fail in exciting ways).
- Use dib-run-parts in lib/common-functions instead of run-parts
(neither SLES nor openSUSE ship run-parts).
- Ensure dib-run-parts doesn't descend into subdirectories (same
behaviour as run-parts).
- Move dib-run-parts from root.d to bin (cleaner, consistent with
other elements with separate bin scripts).
- Tested by building Ubuntu image on openSUSE 12.3.
- Note: this doesn't add support for creating SUSE images, it just
lets you run disk-image-create on SUSE-based distros.
Change-Id: I906c6bc3cf51cdf2c4415adeae1ca250faac25e1
Before each phase dib-run-parts will pick these up to setup the
environment for the commands it runs.
Change-Id: I56697d7bc370918d4063eee67a1c35d4988a5359
When the target directory is empty, the for loop printing our profile
data was failing because of a glob problem.
Change-Id: I34e612021c70d6b8f75423de0d8be969c52e58e2
Also modified dib-run-parts to apply a more workable solution for
filtering out unwanted files such as editor backups and VCS.
The script is installed in its own element, depended on by the OS
specific ubuntu element. This is because the ubuntu element (and
later other OS's) are responsible for populating the root filesystem.
If we try to install this in base, the root filesystem will look to
be populated already and we will skip automatically choosing ubuntu.
Change-Id: I017646748c1a8360299106289b57d976d45875a8