5
Renders one or more Juju 1+2 bundles from an old-style multiple-inheritance
6
bundle. The source bundle must use "charm: cs:foo" (not branch: foo).
8
New/updated bundles will be written/overwritten to a "rendered" subdir.
11
./render2.sh -t <optional space-separated list of targets> <bundle file(s)>
14
Render specific inheritance targets from a bundle:
15
./render2.sh -t \"trusty-liberty trusty-mitaka\" foo/source_bundle.yaml
17
Render specific inheritance targets from all bundles in a dir:
18
./render2.sh -t \"trusty-liberty trusty-mitaka\" foo/*.yaml
20
Render the default inheritance targets from a bundle:
21
./render2.sh foo/source_bundle.yaml
23
Render the default inheritance targets from a wildcard:
24
./render2.sh foo/*.yaml
26
In all of these examples, the rendered files will reside in the
31
while getopts ":t:" opt
39
shift $(($OPTIND - 1))
41
[[ -z "$SRC_BUNDLE_FILES" ]] && (usage; exit 1)
43
TARGETS_DEFAULT="trusty-liberty trusty-mitaka xenial-mitaka"
44
TARGETS="${TARGETS-$TARGETS_DEFAULT}"
45
WARNING_TXT="# Do not edit this file by hand. Changes may be lost as it was rendered from another bundle."
47
echo "Bundle files: $SRC_BUNDLE_FILES"
48
echo "Targets: $TARGETS"
50
if [[ ! -d $HOME/tools/bot-control ]]; then
52
git clone https://github.com/openstack-charmers/bot-control $HOME/tools/bot-control
55
for SRC_BUNDLE in $SRC_BUNDLE_FILES;do
56
RENDER_DIR="$(dirname "$SRC_BUNDLE")/rendered"
57
[[ ! -d "$RENDER_DIR" ]] && mkdir -vp $RENDER_DIR
59
for COMBO in $TARGETS; do
60
# Reduce bundle to one specific inheritance target
61
OUT_FILE="$RENDER_DIR/$(basename $SRC_BUNDLE .yaml)-$COMBO.yaml"
62
$HOME/tools/bot-control/tools/bundle-reducer -y -i $SRC_BUNDLE -o $OUT_FILE -t $COMBO
64
# Add warning comment to the top of all rendered files
65
sed -i "1i${WARNING_TXT}" $OUT_FILE