Pass in hostname as a script parameter
Pass the hostname in as the first parameter to both the setup script and the ready script. Change-Id: I0de51156b56ae750dd519da0da68b85ac5d41267
This commit is contained in:
parent
174a5d7f6d
commit
8e254b4994
@ -121,27 +121,9 @@ communicate directly with each other. In the example above, for each
|
||||
Precise node added to the target system, two additional nodes will be
|
||||
created and associated with it.
|
||||
|
||||
The script specified by `ready-script` (which is expected to be in
|
||||
`/opt/nodepool-scripts` along with the setup script) can be used to
|
||||
perform any last minute changes to a node after it has been launched
|
||||
but before it is put in the READY state to receive jobs. In
|
||||
particular, it can read the files in /etc/nodepool to perform
|
||||
multi-node related setup.
|
||||
|
||||
Those files include:
|
||||
|
||||
**/etc/nodepool/role**
|
||||
Either the string ``primary`` or ``sub`` indicating whether this
|
||||
node is the primary (the node added to the target and which will run
|
||||
the job), or a sub-node.
|
||||
**/etc/nodepool/primary_node**
|
||||
The IP address of the primary node.
|
||||
**/etc/nodepool/sub_nodes**
|
||||
The IP addresses of the sub nodes, one on each line.
|
||||
**/etc/nodepool/id_rsa**
|
||||
An OpenSSH private key generated specifically for this node group.
|
||||
**/etc/nodepool/id_rsa.pub**
|
||||
The corresponding public key.
|
||||
A script specified by `ready-script` can be used to perform any last minute
|
||||
changes to a node after it has been launched but before it is put in the READY
|
||||
state to receive jobs. For more information, see :ref:`scripts`.
|
||||
|
||||
providers
|
||||
---------
|
||||
@ -205,7 +187,7 @@ For providers, the `name`, `username`, `password`, `auth-url`,
|
||||
`name`, `base-image`, and `min-ram` keys are required. The `username`
|
||||
and `private-key` values default to the values indicated. Nodepool
|
||||
expects that user to exist after running the script indicated by
|
||||
`setup`.
|
||||
`setup`. See :ref:`scripts` for setup script details.
|
||||
|
||||
Both `boot-timeout` and `launch-timeout` keys are optional. The
|
||||
`boot-timeout` key defaults to 60 seconds and `launch-timeout` key
|
||||
|
@ -18,3 +18,36 @@ 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.
|
||||
|
||||
|
||||
Ready script
|
||||
------------
|
||||
|
||||
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
|
||||
but before it is put in the READY state to receive jobs. In particular, it
|
||||
can read the files in /etc/nodepool to perform multi-node related setup.
|
||||
|
||||
Those files include:
|
||||
|
||||
**/etc/nodepool/role**
|
||||
Either the string ``primary`` or ``sub`` indicating whether this
|
||||
node is the primary (the node added to the target and which will run
|
||||
the job), or a sub-node.
|
||||
**/etc/nodepool/primary_node**
|
||||
The IP address of the primary node.
|
||||
**/etc/nodepool/sub_nodes**
|
||||
The IP addresses of the sub nodes, one on each line.
|
||||
**/etc/nodepool/id_rsa**
|
||||
An OpenSSH private key generated specifically for this node group.
|
||||
**/etc/nodepool/id_rsa.pub**
|
||||
The corresponding public key.
|
||||
|
||||
|
@ -527,8 +527,8 @@ class NodeLauncher(threading.Thread):
|
||||
if k.startswith('NODEPOOL_'):
|
||||
env_vars += ' %s="%s"' % (k, v)
|
||||
host.ssh("run ready script",
|
||||
"cd /opt/nodepool-scripts && %s ./%s" %
|
||||
(env_vars, self.label.ready_script))
|
||||
"cd /opt/nodepool-scripts && %s ./%s %s" %
|
||||
(env_vars, self.label.ready_script, n.hostname))
|
||||
|
||||
|
||||
class SubNodeLauncher(threading.Thread):
|
||||
@ -863,8 +863,8 @@ class ImageUpdater(threading.Thread):
|
||||
if k.startswith('NODEPOOL_'):
|
||||
env_vars += ' %s="%s"' % (k, v)
|
||||
host.ssh("run setup script",
|
||||
"cd /opt/nodepool-scripts && %s ./%s" %
|
||||
(env_vars, self.image.setup))
|
||||
"cd /opt/nodepool-scripts && %s ./%s %s" %
|
||||
(env_vars, self.image.setup, server['name']))
|
||||
|
||||
|
||||
class ConfigValue(object):
|
||||
|
Loading…
Reference in New Issue
Block a user