Merge "Add shell-type to Azure driver"

This commit is contained in:
Zuul 2021-12-09 02:33:53 +00:00 committed by Gerrit Code Review
commit ee21d8ac79
6 changed files with 26 additions and 2 deletions

View File

@ -276,6 +276,20 @@ section of the configuration.
interpreter on Ansible >=2.8, and default to
``/usr/bin/python2`` for earlier versions.
.. attr:: shell-type
:type: str
The shell type of the node's default shell executable. Used by Zuul
to set ``ansible_shell_type``. This setting should only be used
- For a windows image with the experimental `connection-type` ``ssh``
in which case ``cmd`` or ``powershell`` should be set
and reflect the node's ``DefaultShell`` configuration.
- If the default shell is not Bourne compatible (sh), but instead
e.g. ``csh`` or ``fish``, and the user is aware that there is a
long-standing issue with ``ansible_shell_type`` in combination
with ``become``
.. attr:: image-reference
:type: dict
:required:

View File

@ -35,6 +35,7 @@ class AzureProviderCloudImage(ConfigValue):
self.key = image.get('key', zuul_public_key)
self.image_reference = image['image-reference']
self.python_path = image.get('python-path')
self.shell_type = image.get('shell-type')
self.connection_type = image.get('connection-type', 'ssh')
self.connection_port = image.get(
'connection-port',
@ -63,7 +64,7 @@ class AzureProviderCloudImage(ConfigValue):
'connection-type': str,
'connection-port': int,
'python-path': str,
# TODO(corvus): shell-type
'shell-type': str,
}
@ -77,6 +78,7 @@ class AzureProviderDiskImage(ConfigValue):
diskimage.image_types.add('vhd')
self.pause = bool(image.get('pause', False))
self.python_path = image.get('python-path')
self.shell_type = image.get('shell-type')
self.username = image.get('username')
self.key = image.get('key')
self.connection_type = image.get('connection-type', 'ssh')
@ -100,7 +102,7 @@ class AzureProviderDiskImage(ConfigValue):
'connection-type': str,
'connection-port': int,
'python-path': str,
# TODO(corvus): shell-type
'shell-type': str,
}

View File

@ -117,6 +117,7 @@ class StateMachineNodeLauncher(stats.StatsReporter):
self.node.username = image.username
self.node.python_path = image.python_path
self.node.shell_type = image.shell_type
self.node.connection_port = image.connection_port
self.node.connection_type = image.connection_type
self.zk.storeNode(self.node)

View File

@ -28,6 +28,7 @@ providers:
cloud-images:
- name: bionic
username: zuul
shell-type: sh
image-reference:
sku: 18.04-LTS
publisher: Canonical

View File

@ -54,6 +54,7 @@ class TestDriverAzure(tests.DBTestCase):
self.assertEqual(node.state, zk.READY)
self.assertIsNotNone(node.launcher)
self.assertEqual(node.connection_type, 'ssh')
self.assertEqual(node.shell_type, 'sh')
self.assertEqual(node.attributes,
{'key1': 'value1', 'key2': 'value2'})
@ -85,5 +86,6 @@ class TestDriverAzure(tests.DBTestCase):
self.assertEqual(node.state, zk.READY)
self.assertIsNotNone(node.launcher)
self.assertEqual(node.connection_type, 'ssh')
self.assertEqual(node.shell_type, None)
self.assertEqual(node.attributes,
{'key1': 'value1', 'key2': 'value2'})

View File

@ -0,0 +1,4 @@
---
features:
- |
The shell-type setting has been added to the Azure driver.