Merge "Support winrm hosts in static driver"

This commit is contained in:
Zuul 2018-04-18 17:10:46 +00:00 committed by Gerrit Code Review
commit badb7e48ad
7 changed files with 39 additions and 10 deletions

View File

@ -714,7 +714,7 @@ Example::
labels: trusty-static
host-key: fake-key
timeout: 13
ssh-port: 22022
connection-port: 22022
username: zuul
max-parallel-jobs: 1
@ -747,8 +747,14 @@ corresponding label.
``host-key``
The ssh host key of the node.
``ssh-port``
The ssh port, default to *22*
``connection-type`` (string)
The connection type that a consumer should use when connecting to the
node. Should be set to either 'ssh' or 'winrm'. Defaults to 'ssh'.
``connection-port`` (int)
The port that a consumer should use when connecting to the node.
For most nodes this is not necessary. This defaults to 22 when
``connection-type`` is 'ssh' and 5986 when it is 'winrm'.
``max-parallel-jobs``
The number of jobs that can run in parallel on this node, default to *1*.

View File

@ -57,7 +57,10 @@ class StaticProviderConfig(ProviderConfig):
'labels': as_list(node['labels']),
'host-key': as_list(node.get('host-key', [])),
'timeout': int(node.get('timeout', 5)),
'ssh-port': int(node.get('ssh-port', 22)),
# Read ssh-port values for backward compat, but prefer port
'connection-port': int(
node.get('port', node.get('ssh-port', 22))),
'connection-type': node.get('connection-type', 'ssh'),
'username': node.get('username', 'zuul'),
'max-parallel-jobs': int(node.get('max-parallel-jobs', 1)),
})
@ -72,7 +75,8 @@ class StaticProviderConfig(ProviderConfig):
'username': str,
'timeout': int,
'host-key': v.Any(str, [str]),
'ssh-port': int,
'connection-port': int,
'connection-type': str,
'max-parallel-jobs': int,
}
pool = {

View File

@ -64,8 +64,8 @@ class StaticNodeRequestHandler(NodeRequestHandler):
node.hostname = static_node["name"]
node.username = static_node["username"]
node.interface_ip = static_node["name"]
node.connection_port = static_node["ssh-port"]
node.connection_type = "ssh"
node.connection_port = static_node["connection-port"]
node.connection_type = static_node["connection-type"]
nodeutils.set_node_ip(node)
node.host_keys = self.manager.nodes_keys[static_node["name"]]
self.zk.storeNode(node)

View File

@ -35,9 +35,11 @@ class StaticNodeProvider(Provider):
def checkHost(self, node):
# Check node is reachable
if node["connection-type"] != "ssh":
return
try:
keys = nodescan(node["name"],
port=node["ssh-port"],
port=node["connection-port"],
timeout=node["timeout"])
except exceptions.ConnectionTimeoutException:
raise StaticNodeError(

View File

@ -90,7 +90,7 @@ providers:
labels: trusty-static
host-key: fake-key
timeout: 13
ssh-port: 22022
connection-port: 22022
username: zuul
max-parallel-jobs: 1

View File

@ -10,6 +10,9 @@ labels:
- name: fake-concurrent-label
min-ready: 2
- name: fake-windows-label
min-ready: 2
providers:
- name: static-provider
driver: static
@ -20,10 +23,14 @@ providers:
labels: fake-label
host-key: ssh-rsa FAKEKEY
timeout: 13
ssh-port: 22022
connection-port: 22022
username: zuul
max-parallel-jobs: 1
- name: fake-host-2
labels: fake-concurrent-label
host-key: ssh-rsa FAKEKEY
max-parallel-jobs: 2
- name: fake-host-3
labels: fake-windows-label
max-parallel-jobs: 1
connection-type: winrm

View File

@ -0,0 +1,10 @@
---
features:
- |
Added support for configuring windows static nodes. A static node can now
define a ``connection-type``. The ``ssh-port`` option has been renamed
to ``connection-port``.
deprecations:
- |
``ssh-port`` in static node config is deprecated. Please update config to
use ``connection-port`` instead.