Add shell-type to Azure driver
This should be included to match the functionality of other cloud drivers. Change-Id: I48e0b749cb1b711758997609e14d7327bc7a6468
This commit is contained in:
parent
cfb2283b6d
commit
703494d53f
@ -276,6 +276,20 @@ section of the configuration.
|
|||||||
interpreter on Ansible >=2.8, and default to
|
interpreter on Ansible >=2.8, and default to
|
||||||
``/usr/bin/python2`` for earlier versions.
|
``/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
|
.. attr:: image-reference
|
||||||
:type: dict
|
:type: dict
|
||||||
:required:
|
:required:
|
||||||
|
@ -35,6 +35,7 @@ class AzureProviderCloudImage(ConfigValue):
|
|||||||
self.key = image.get('key', zuul_public_key)
|
self.key = image.get('key', zuul_public_key)
|
||||||
self.image_reference = image['image-reference']
|
self.image_reference = image['image-reference']
|
||||||
self.python_path = image.get('python-path')
|
self.python_path = image.get('python-path')
|
||||||
|
self.shell_type = image.get('shell-type')
|
||||||
self.connection_type = image.get('connection-type', 'ssh')
|
self.connection_type = image.get('connection-type', 'ssh')
|
||||||
self.connection_port = image.get(
|
self.connection_port = image.get(
|
||||||
'connection-port',
|
'connection-port',
|
||||||
@ -63,7 +64,7 @@ class AzureProviderCloudImage(ConfigValue):
|
|||||||
'connection-type': str,
|
'connection-type': str,
|
||||||
'connection-port': int,
|
'connection-port': int,
|
||||||
'python-path': str,
|
'python-path': str,
|
||||||
# TODO(corvus): shell-type
|
'shell-type': str,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -77,6 +78,7 @@ class AzureProviderDiskImage(ConfigValue):
|
|||||||
diskimage.image_types.add('vhd')
|
diskimage.image_types.add('vhd')
|
||||||
self.pause = bool(image.get('pause', False))
|
self.pause = bool(image.get('pause', False))
|
||||||
self.python_path = image.get('python-path')
|
self.python_path = image.get('python-path')
|
||||||
|
self.shell_type = image.get('shell-type')
|
||||||
self.username = image.get('username')
|
self.username = image.get('username')
|
||||||
self.key = image.get('key')
|
self.key = image.get('key')
|
||||||
self.connection_type = image.get('connection-type', 'ssh')
|
self.connection_type = image.get('connection-type', 'ssh')
|
||||||
@ -100,7 +102,7 @@ class AzureProviderDiskImage(ConfigValue):
|
|||||||
'connection-type': str,
|
'connection-type': str,
|
||||||
'connection-port': int,
|
'connection-port': int,
|
||||||
'python-path': str,
|
'python-path': str,
|
||||||
# TODO(corvus): shell-type
|
'shell-type': str,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -117,6 +117,7 @@ class StateMachineNodeLauncher(stats.StatsReporter):
|
|||||||
|
|
||||||
self.node.username = image.username
|
self.node.username = image.username
|
||||||
self.node.python_path = image.python_path
|
self.node.python_path = image.python_path
|
||||||
|
self.node.shell_type = image.shell_type
|
||||||
self.node.connection_port = image.connection_port
|
self.node.connection_port = image.connection_port
|
||||||
self.node.connection_type = image.connection_type
|
self.node.connection_type = image.connection_type
|
||||||
self.zk.storeNode(self.node)
|
self.zk.storeNode(self.node)
|
||||||
|
1
nodepool/tests/fixtures/azure.yaml
vendored
1
nodepool/tests/fixtures/azure.yaml
vendored
@ -28,6 +28,7 @@ providers:
|
|||||||
cloud-images:
|
cloud-images:
|
||||||
- name: bionic
|
- name: bionic
|
||||||
username: zuul
|
username: zuul
|
||||||
|
shell-type: sh
|
||||||
image-reference:
|
image-reference:
|
||||||
sku: 18.04-LTS
|
sku: 18.04-LTS
|
||||||
publisher: Canonical
|
publisher: Canonical
|
||||||
|
@ -54,6 +54,7 @@ class TestDriverAzure(tests.DBTestCase):
|
|||||||
self.assertEqual(node.state, zk.READY)
|
self.assertEqual(node.state, zk.READY)
|
||||||
self.assertIsNotNone(node.launcher)
|
self.assertIsNotNone(node.launcher)
|
||||||
self.assertEqual(node.connection_type, 'ssh')
|
self.assertEqual(node.connection_type, 'ssh')
|
||||||
|
self.assertEqual(node.shell_type, 'sh')
|
||||||
self.assertEqual(node.attributes,
|
self.assertEqual(node.attributes,
|
||||||
{'key1': 'value1', 'key2': 'value2'})
|
{'key1': 'value1', 'key2': 'value2'})
|
||||||
|
|
||||||
@ -85,5 +86,6 @@ class TestDriverAzure(tests.DBTestCase):
|
|||||||
self.assertEqual(node.state, zk.READY)
|
self.assertEqual(node.state, zk.READY)
|
||||||
self.assertIsNotNone(node.launcher)
|
self.assertIsNotNone(node.launcher)
|
||||||
self.assertEqual(node.connection_type, 'ssh')
|
self.assertEqual(node.connection_type, 'ssh')
|
||||||
|
self.assertEqual(node.shell_type, None)
|
||||||
self.assertEqual(node.attributes,
|
self.assertEqual(node.attributes,
|
||||||
{'key1': 'value1', 'key2': 'value2'})
|
{'key1': 'value1', 'key2': 'value2'})
|
||||||
|
@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
The shell-type setting has been added to the Azure driver.
|
Loading…
x
Reference in New Issue
Block a user