Remove script-dir
Script-dir was only used for snapshot building. Since that is no longer supported, remove it. It was also passed through to DIB as an evironment variable. However, the OpenStack infra element that used it defaults to a sensible value. Users who still want to use that can add it as an environment variable to appropriate diskimage entries. Change-Id: Ie72bb9675fdad6364589a6e3823f4ef9a0228e86
This commit is contained in:
parent
4e02388a0a
commit
6e98071f98
@ -67,29 +67,7 @@ function nodepool_create_keypairs {
|
||||
fi
|
||||
}
|
||||
|
||||
function nodepool_write_prepare {
|
||||
sudo mkdir -p $(dirname $NODEPOOL_CONFIG)/scripts
|
||||
local pub_key=$(cat $NODEPOOL_PUBKEY)
|
||||
|
||||
cat > /tmp/prepare_node_ubuntu.sh <<EOF
|
||||
#!/bin/bash -x
|
||||
sudo adduser --disabled-password --gecos "" jenkins
|
||||
sudo mkdir -p /home/jenkins/.ssh
|
||||
cat > tmp_authorized_keys << INNEREOF
|
||||
$pub_key
|
||||
INNEREOF
|
||||
sudo mv tmp_authorized_keys /home/jenkins/.ssh/authorized_keys
|
||||
sudo chmod 700 /home/jenkins/.ssh
|
||||
sudo chmod 600 /home/jenkins/.ssh/authorized_keys
|
||||
sudo chown -R jenkins:jenkins /home/jenkins
|
||||
sleep 5
|
||||
sync
|
||||
EOF
|
||||
sudo mv /tmp/prepare_node_ubuntu.sh \
|
||||
$(dirname $NODEPOOL_CONFIG)/scripts/prepare_node_ubuntu.sh
|
||||
|
||||
sudo chmod a+x $(dirname $NODEPOOL_CONFIG)/scripts/prepare_node_ubuntu.sh
|
||||
|
||||
function nodepool_write_elements {
|
||||
sudo mkdir -p $(dirname $NODEPOOL_CONFIG)/elements/nodepool-setup/install.d
|
||||
cat > /tmp/01-nodepool-setup <<EOF
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y openssh-server
|
||||
@ -169,10 +147,9 @@ EOF
|
||||
sudo mv /tmp/secure.conf $NODEPOOL_SECURE
|
||||
|
||||
cat > /tmp/nodepool.yaml <<EOF
|
||||
# You will need to make and populate these two paths as necessary,
|
||||
# You will need to make and populate this path as necessary,
|
||||
# cloning nodepool does not do this. Further in this doc we have an
|
||||
# example script for /path/to/nodepool/things/scripts.
|
||||
script-dir: $(dirname $NODEPOOL_CONFIG)/scripts
|
||||
# example element.
|
||||
elements-dir: $(dirname $NODEPOOL_CONFIG)/elements
|
||||
images-dir: $NODEPOOL_DIB_BASE_PATH/images
|
||||
# The mysql password here may be different depending on your
|
||||
@ -270,8 +247,8 @@ function configure_nodepool {
|
||||
# write the nodepool config
|
||||
nodepool_write_config
|
||||
|
||||
# write the prepare node script
|
||||
nodepool_write_prepare
|
||||
# write the elements
|
||||
nodepool_write_elements
|
||||
|
||||
# builds a fresh db
|
||||
recreate_database nodepool
|
||||
|
@ -72,19 +72,6 @@ full configuration file may have the ``diskimages``, ``labels``,
|
||||
The following sections are available. All are required unless
|
||||
otherwise indicated.
|
||||
|
||||
script-dir
|
||||
----------
|
||||
When creating an image to use when launching new nodes, Nodepool will
|
||||
run a script that is expected to prepare the machine before the
|
||||
snapshot image is created. The ``script-dir`` parameter indicates a
|
||||
directory that holds all of the scripts needed to accomplish this.
|
||||
Nodepool will copy the entire directory to the machine before invoking
|
||||
the appropriate script for the image being created.
|
||||
|
||||
Example::
|
||||
|
||||
script-dir: /path/to/script/dir
|
||||
|
||||
.. _elements-dir:
|
||||
|
||||
elements-dir
|
||||
|
@ -1,36 +1,7 @@
|
||||
.. _scripts:
|
||||
|
||||
Node Prep Scripts
|
||||
=================
|
||||
|
||||
Nodepool requires the specification of a script directory
|
||||
(`script-dir`) in its configuration. When Nodepool starts a virtual
|
||||
machine for the purpose of creating a snapshot image, all of the files
|
||||
within this directory will be copied to the virtual machine so they
|
||||
are available for use by the setup script.
|
||||
|
||||
At various points in the image and node creation processes, these
|
||||
scripts may be invoked by nodepool. See :ref:`configuration` for
|
||||
details.
|
||||
|
||||
Any environment variables present in the nodepool daemon environment
|
||||
that begin with ``NODEPOOL_`` will be set in the calling environment
|
||||
for the script. This is useful during testing to alter script
|
||||
behavior, for instance, to add a local ssh key that would not
|
||||
otherwise be set in production.
|
||||
|
||||
Setup script
|
||||
------------
|
||||
|
||||
Each provider can specify a setup script with `setup`, and that script is
|
||||
expected to exist in `script_dir`. If it is found, it will be run during image
|
||||
creation. When the script is invoked, the instance hostname will be passed in
|
||||
as the first parameter. This setup script will only be applied when building
|
||||
images using provider snapshots, not using diskimage-builder.
|
||||
|
||||
|
||||
Ready script
|
||||
------------
|
||||
Node Ready Scripts
|
||||
==================
|
||||
|
||||
Each label can specify a ready script with `ready-script`. This script can be
|
||||
used to perform any last minute changes to a node after it has been launched
|
||||
|
@ -682,8 +682,6 @@ class BuildWorker(BaseWorker):
|
||||
# values in this thread.
|
||||
if self._config.elementsdir:
|
||||
env['ELEMENTS_PATH'] = self._config.elementsdir
|
||||
if self._config.scriptdir:
|
||||
env['NODEPOOL_SCRIPTDIR'] = self._config.scriptdir
|
||||
|
||||
# send additional env vars if needed
|
||||
for k, v in diskimage.env_vars.items():
|
||||
|
@ -113,7 +113,6 @@ class ConfigValidator:
|
||||
}
|
||||
|
||||
top_level = {
|
||||
'script-dir': str,
|
||||
'elements-dir': str,
|
||||
'images-dir': str,
|
||||
'dburi': str,
|
||||
|
@ -149,7 +149,6 @@ def loadConfig(config_path):
|
||||
newconfig.providers = {}
|
||||
newconfig.targets = {}
|
||||
newconfig.labels = {}
|
||||
newconfig.scriptdir = config.get('script-dir')
|
||||
newconfig.elementsdir = config.get('elements-dir')
|
||||
newconfig.imagesdir = config.get('images-dir')
|
||||
newconfig.dburi = None
|
||||
|
@ -1,4 +1,3 @@
|
||||
script-dir: /etc/nodepool/scripts
|
||||
elements-dir: /etc/nodepool/elements
|
||||
images-dir: /opt/nodepool_dib
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
script-dir: /etc/nodepool/scripts
|
||||
elements-dir: /etc/nodepool/elements
|
||||
images-dir: /opt/nodepool_dib
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
script-dir: /etc/nodepool/scripts
|
||||
elements-dir: /etc/nodepool/elements
|
||||
images-dir: /opt/nodepool_dib
|
||||
|
||||
|
1
nodepool/tests/fixtures/integration.yaml
vendored
1
nodepool/tests/fixtures/integration.yaml
vendored
@ -1,4 +1,3 @@
|
||||
script-dir: .
|
||||
images-dir: '{images_dir}'
|
||||
|
||||
cron:
|
||||
|
1
nodepool/tests/fixtures/integration_osc.yaml
vendored
1
nodepool/tests/fixtures/integration_osc.yaml
vendored
@ -1,4 +1,3 @@
|
||||
script-dir: .
|
||||
images-dir: '{images_dir}'
|
||||
|
||||
cron:
|
||||
|
1
nodepool/tests/fixtures/leaked_node.yaml
vendored
1
nodepool/tests/fixtures/leaked_node.yaml
vendored
@ -1,4 +1,3 @@
|
||||
script-dir: .
|
||||
elements-dir: .
|
||||
images-dir: '{images_dir}'
|
||||
|
||||
|
1
nodepool/tests/fixtures/node.yaml
vendored
1
nodepool/tests/fixtures/node.yaml
vendored
@ -1,4 +1,3 @@
|
||||
script-dir: .
|
||||
elements-dir: .
|
||||
images-dir: '{images_dir}'
|
||||
|
||||
|
1
nodepool/tests/fixtures/node_az.yaml
vendored
1
nodepool/tests/fixtures/node_az.yaml
vendored
@ -1,4 +1,3 @@
|
||||
script-dir: .
|
||||
elements-dir: .
|
||||
images-dir: '{images_dir}'
|
||||
|
||||
|
1
nodepool/tests/fixtures/node_cmd.yaml
vendored
1
nodepool/tests/fixtures/node_cmd.yaml
vendored
@ -1,4 +1,3 @@
|
||||
script-dir: .
|
||||
images-dir: '{images_dir}'
|
||||
|
||||
cron:
|
||||
|
@ -1,4 +1,3 @@
|
||||
script-dir: .
|
||||
elements-dir: .
|
||||
images-dir: '{images_dir}'
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
script-dir: .
|
||||
elements-dir: .
|
||||
images-dir: '{images_dir}'
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
script-dir: .
|
||||
elements-dir: .
|
||||
images-dir: '{images_dir}'
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
script-dir: .
|
||||
elements-dir: .
|
||||
images-dir: '{images_dir}'
|
||||
|
||||
|
1
nodepool/tests/fixtures/node_ipv6.yaml
vendored
1
nodepool/tests/fixtures/node_ipv6.yaml
vendored
@ -1,4 +1,3 @@
|
||||
script-dir: .
|
||||
elements-dir: .
|
||||
images-dir: '{images_dir}'
|
||||
|
||||
|
1
nodepool/tests/fixtures/node_net_name.yaml
vendored
1
nodepool/tests/fixtures/node_net_name.yaml
vendored
@ -1,4 +1,3 @@
|
||||
script-dir: .
|
||||
elements-dir: .
|
||||
images-dir: '{images_dir}'
|
||||
|
||||
|
1
nodepool/tests/fixtures/node_two_image.yaml
vendored
1
nodepool/tests/fixtures/node_two_image.yaml
vendored
@ -1,4 +1,3 @@
|
||||
script-dir: .
|
||||
elements-dir: .
|
||||
images-dir: '{images_dir}'
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
script-dir: .
|
||||
elements-dir: .
|
||||
images-dir: '{images_dir}'
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
script-dir: .
|
||||
elements-dir: .
|
||||
images-dir: '{images_dir}'
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
script-dir: .
|
||||
elements-dir: .
|
||||
images-dir: '{images_dir}'
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
script-dir: .
|
||||
elements-dir: .
|
||||
images-dir: '{images_dir}'
|
||||
|
||||
|
1
nodepool/tests/fixtures/node_vhd.yaml
vendored
1
nodepool/tests/fixtures/node_vhd.yaml
vendored
@ -1,4 +1,3 @@
|
||||
script-dir: .
|
||||
elements-dir: .
|
||||
images-dir: '{images_dir}'
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
script-dir: .
|
||||
elements-dir: .
|
||||
images-dir: '{images_dir}'
|
||||
|
||||
|
1
nodepool/tests/fixtures/subnodes.yaml
vendored
1
nodepool/tests/fixtures/subnodes.yaml
vendored
@ -1,4 +1,3 @@
|
||||
script-dir: .
|
||||
elements-dir: .
|
||||
images-dir: '{images_dir}'
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
script-dir: .
|
||||
elements-dir: .
|
||||
images-dir: /tmp/nodepool_dib
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
script-dir: .
|
||||
images-dir: tools/images
|
||||
|
||||
cron:
|
||||
|
Loading…
Reference in New Issue
Block a user