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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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