Commit Graph

21 Commits

Author SHA1 Message Date
James E. Blair 36a7df3677 Fix static driver equality check
A recent refactor of the config objects (which simplified the
repetitive __eq__ methods) missed updating the static driver.  This
could lead to infinite recursion (as the static driver explicitly
called super().__eq__ which itself called __eq__).

This updates the driver to use the new framework, and it also adds
a check to a unit test which exercises it.

Change-Id: I0f443cde147e46d73112025cd2f819159a8b4f86
2021-06-21 15:24:07 -07:00
Albin Vass 0c84b7fa4e Add shell-type config
Ansible needs to know which shell type the node uses to operate
correctly, especially for ssh connections for windows nodes because
otherwise ansible defaults to trying bash.

Change-Id: I71abfefa57aaafd88f199be19ee7caa64efda538
2021-03-05 15:14:29 +01:00
Ian Wienand db87a0845f Set default python-path to "auto"
The "python-path" configuration option makes its way through to Zuul
where it sets the "ansible_interpreter_path" in the inventory.
Currently this defaults to "/usr/bin/python2" which is wrong for
Python 3-only distributions.

Ansible >=2.8 provides for automated discovery of the interpreter to
avoid runtime errors choosing an invalid interpreter [1].  Using this
should mean that "python-path" doesn't need to be explicitly for any
common case.  As more distributions become Python 3 only, this should
"do the right thing" without further configuration.

This switches the default python-path to "auto".  The dependent change
updates Zuul to accept this and use it when running with Ansible
>=2.8, or default back to "/usr/bin/python2" for earlier Ansible
versions.

Testing and documentation is updated, and a release note added.

[1] https://docs.ansible.com/ansible/2.8/reference_appendices/interpreter_discovery.html

Depends-On: https://review.opendev.org/682275
Change-Id: I02a1a618c8806b150049e91b644ec3c0cb826ba4
2019-10-17 09:17:50 +11:00
Tristan Cacqueray 9694382c47 static: add host-key-checking toggle
This change adds a static node toggle to disable checkHost and
nodescan.

Change-Id: If3aefb81624b573faf1129bb82d46ee848ff27cf
2019-07-19 19:34:18 +00:00
Tristan Cacqueray 76aa62230c Add python-path option to node
This change adds a new python_path Node attribute so that zuul executor
can remove the default hard-coded ansible_python_interpreter.

Change-Id: Iddf2cc6b2df579636ec39b091edcfe85a4a4ed10
2019-05-07 02:22:45 +00:00
David Shrewsbury d6ef934b70 Extract common config parsing for ProviderConfig
Adds a ProviderConfig class method that can be called to get
the config schema for the common config options in a Provider.
Drivers are modified to call this method.

Change-Id: Ib67256dddc06d13eb7683226edaa8c8c10a73326
2019-01-07 12:34:05 +00:00
David Shrewsbury a19dffd916 Extract out common config parsing for ConfigPool
Our driver code is in a less-than-ideal situation where each driver
is responsible for parsing config options that are common to all
drivers. This change begins to correct that, starting with ConfigPool.
It changes the driver API in the following ways:

1) Forces objects derived from ConfigPool to implement a load() method
   that should call super's method, then handle loading driver specific
   options from the config.

2) Adds a ConfigPool class method that can be called to get the config
   schema for the common config options leaving drivers to have to only
   define the schema for their own config options.

Other base config objects will be modeled after this pattern in
later changes.

Change-Id: I41620590c355cacd2c4fbe6916acfe80f20e3216
2019-01-03 11:05:26 -05:00
David Shrewsbury c08eb291f7 Fix for pools with different labels
Pools within the same provider that have different labels are
attempting to handle requests for ALL labels defined within the provider.
This is due to change I61263f51be5e957de71d1e2dabaa7391bbe7bddf which
incorrectly changed from getting supported labels from per-pool to
per-provider. This modifies the getSupportedLabels() API to support
pools.

Change-Id: I7a0d472928c6b528f6faa6dd3b9cf1479874cb22
2018-06-28 15:04:35 -04:00
David Shrewsbury 9de68b83dd Pre-register static nodes
This changes the static driver to register nodes from its config
file with ZooKeeper at startup and when the config file changes.
A node is registered max-parallel-jobs times with ZooKeeper (default
is 1).

Once a node is deleted, it is immediately re-registered, unless it
no longer exists in our config, or it's not needed based on a change
to max-parallel-job count.

Change-Id: Ie386e440c2016af390087d109f7e5211c4fd968d
2018-06-13 12:13:40 -04:00
Zuul 879ed2407e Merge "Correctly use connection-port in static driver" 2018-06-11 14:22:09 +00:00
James E. Blair 82d8c51250 Create a base Driver class
This is, like the drivers in zuul, designed to be a single instance
per driver that survives for the life of the process.  It is used
to further instantiate driver-specific interfaces.

Here we have it return the config object for the driver (replacing
the previous system which loaded it from specific config files).

We also move the reset method from the ProviderConfig to the Driver
object.  It's currently only used to clear a global os client config
object, so this better matches its lifecycle.

Change-Id: I1f5a7be9c597be842bfe4dbea8f153d7a96d7b9a
2018-06-06 14:11:43 -04:00
Tobias Henkel ede51699f5
Correctly use connection-port in static driver
There is currently a typo in the static driver which makes it listen
to the 'port' configuration instead of the documented and everywhere
else used 'connection-port' config item. Fix that to align it with the
documentation.

Change-Id: Ic6d5136a33d3cafc729e109d371bde98612be639
2018-05-18 08:21:44 +02:00
David Shrewsbury 814160fb71 Fix ConfigValue comparisons
Our code was terribly inconsistent with implementing the __eq__()
method for ConfigValue based objects (if we did at all). If this
was implemented, not all of the attributes were used in comparison.

This change forces a ConfigValue derived object to implement the
comparison method, and fixes the places we neglected attributes.

Adds some very simple tests to at least exercise this code.

Change-Id: Ia2f600a9a4f3770087372bbc9f07531d5ea569e1
2018-05-11 15:17:33 -04:00
David Shrewsbury 6edb78a36b Make manage_images a property of ProviderConfig
The current driver API does not make it clear that a driver must
set the 'manage_images' property on the driver of the ProviderConfig
to indicate that it can manage external images. Since this is really
a function of the provider, not the driver, make this an abstract
property on the ProviderConfig that must be defined by each driver
implementation.

Change-Id: Iefe257f943aaa5740d0326ca6150632c21a2a8cf
2018-05-09 11:35:36 -04:00
David Shrewsbury 2332724205 Force driver provider configs to define pool attr
There is currently nothing forcing a driver's ProviderConfig
to define a 'pools' attribute, yet the code clearly expects
it to be defined (e.g., PoolWorker.getPoolConfig() method).
Force this by defining an abstract property, which helps define
the interface more clearly, too.

Change-Id: I2d6a0ee98076540cc722835ab6b5c3a077f83edc
2018-05-08 14:15:49 -04:00
Zuul badb7e48ad Merge "Support winrm hosts in static driver" 2018-04-18 17:10:46 +00:00
Monty Taylor da95a817bb
Support winrm hosts in static driver
The static driver currently assumes ssh connectivity. Add a
connection-type parameter and rename the ssh-port to connection-port to
match the diskimages setting name.

Keep the old 'ssh-port' setting for backwards compat.

Change-Id: I1a96f03f9845b0d99d9ce89d2213be4d483afdd9
2018-04-13 11:36:58 -05:00
Tristan Cacqueray f5dc749f2a Refactor run_handler to be generic
This change refactors the OpenStackNodeRequestHandler.run_handler method
so that it is part of the generic interface. A nodepool driver handler now
only needs to implement the launch() method.

Moreover, this change merge the NodeLaunchManager into the RequestHandler.

This change adds the following method to the handler interface:

* nodeReused(node): notify handler a node is re-used
* checkReusableNode(node): verify if a node can be re-used
* setNodeMetadata(node): store extra node metadata such as az
* pollLauncher()

Change-Id: I5b18b49f50e2b416b5e5c4e28e1a4a6a1df1c654
2018-04-12 02:50:49 +00:00
David Shrewsbury c204313801 Extend config API with getSupportedLabels()
New config API method to get all labels that are supported by a
configured provider. Used in the launcher to not have to know
what driver is used and the configuration of its config data
structure.

Change-Id: Ib792e84c546bc52507141835ed57bd72ad9f09d3
2018-03-07 21:42:19 -05:00
David Shrewsbury f19f89777d Rename get_schema to getSchema
This corrects an inconsistency with a class method name, where
camel case is the norm.

Change-Id: I0e02f2425c89b46a780ec99d8053fad4b04d3f9a
2018-03-07 21:24:24 -05:00
Tristan Cacqueray 6ac2f33cb3 Implement a static driver for Nodepool
This change adds a static node driver.

Change-Id: I065f2b42af49a57218f1c04a08b3ddd15ccc0832
Story: 2001044
Task: 4615
2018-01-31 03:55:56 +00:00