project-config/nodepool/elements/nodepool-base/extra-data.d/99-copy-nodepool-scripts

40 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
#
# See the License for the specific language governing permissions and
# limitations under the License.
# Copy the nodepools scripts into the image
# This is 99 because it needs to depend on source-repositories having been
# run, because the default fallthrough location for the nodepool scripts
# is the git repo that's been cloned into the image.
# During a nodepool run, it's expected that NODEPOOL_SCRIPTDIR is set, in
# which case ordering doesn't matter - but for a developer hacking locally
# who is not hacking on those scripts, it's an imposition to make them
# set an env var.
if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
NODEPOOL_SCRIPTDIR=${NODEPOOL_SCRIPTDIR:-$TMP_MOUNT_PATH/opt/git/opendev.org/openstack/project-config/nodepool/scripts}
sudo cp -a $NODEPOOL_SCRIPTDIR $TMP_MOUNT_PATH/opt/nodepool-scripts
sudo chmod -R a+rx $TMP_MOUNT_PATH/opt/nodepool-scripts