From daa4e39a0d99748a5981e56f32e90433a0e56c42 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Tue, 12 Apr 2022 06:32:41 -0700 Subject: [PATCH] Fix default python paths in aws, azure, ibmvpc drivers The python-path value should default to "auto" per documentation and to match other drivers. Correct that. Change-Id: Ie8254e10d9c4d8ff8f8f298fac32140a18248293 --- nodepool/driver/aws/config.py | 4 ++-- nodepool/driver/azure/config.py | 4 ++-- nodepool/driver/ibmvpc/config.py | 4 ++-- nodepool/tests/unit/test_driver_aws.py | 1 + nodepool/tests/unit/test_driver_azure.py | 2 ++ nodepool/tests/unit/test_driver_ibmvpc.py | 2 ++ 6 files changed, 11 insertions(+), 6 deletions(-) diff --git a/nodepool/driver/aws/config.py b/nodepool/driver/aws/config.py index b55da85ff..9b4592d65 100644 --- a/nodepool/driver/aws/config.py +++ b/nodepool/driver/aws/config.py @@ -31,7 +31,7 @@ class AwsProviderCloudImage(ConfigValue): self.name = image['name'] self.username = image['username'] self.image_id = image.get('image-id') - self.python_path = image.get('python-path') + self.python_path = image.get('python-path', 'auto') self.shell_type = image.get('shell-type') self.connection_type = image.get('connection-type', 'ssh') self.connection_port = image.get( @@ -89,7 +89,7 @@ class AwsProviderDiskImage(ConfigValue): self.name = image['name'] diskimage.image_types.add(image_type) self.pause = bool(image.get('pause', False)) - self.python_path = image.get('python-path') + self.python_path = image.get('python-path', 'auto') self.shell_type = image.get('shell-type') self.username = image.get('username') self.connection_type = image.get('connection-type', 'ssh') diff --git a/nodepool/driver/azure/config.py b/nodepool/driver/azure/config.py index fc22f2516..6fee50736 100644 --- a/nodepool/driver/azure/config.py +++ b/nodepool/driver/azure/config.py @@ -39,7 +39,7 @@ class AzureProviderCloudImage(ConfigValue): self.image_reference = image.get('image-reference') self.image_filter = image.get('image-filter') self.image_id = image.get('image-id') - self.python_path = image.get('python-path') + self.python_path = image.get('python-path', 'auto') self.shell_type = image.get('shell-type') self.connection_type = image.get('connection-type', 'ssh') self.connection_port = image.get( @@ -100,7 +100,7 @@ class AzureProviderDiskImage(ConfigValue): self.name = image['name'] diskimage.image_types.add('vhd') self.pause = bool(image.get('pause', False)) - self.python_path = image.get('python-path') + self.python_path = image.get('python-path', 'auto') self.shell_type = image.get('shell-type') self.username = image.get('username') self.password = image.get('password') diff --git a/nodepool/driver/ibmvpc/config.py b/nodepool/driver/ibmvpc/config.py index 1148eb8cf..c731ac92b 100644 --- a/nodepool/driver/ibmvpc/config.py +++ b/nodepool/driver/ibmvpc/config.py @@ -36,7 +36,7 @@ class IBMVPCProviderCloudImage(ConfigValue): self.image_id = image.get('image-id') self.image_name = image.get('image-name') self.image_filter = image.get('image-filter') - self.python_path = image.get('python-path') + self.python_path = image.get('python-path', 'auto') self.shell_type = image.get('shell-type') self.connection_type = image.get('connection-type', 'ssh') self.connection_port = image.get( @@ -97,7 +97,7 @@ class IBMVPCProviderDiskImage(ConfigValue): self.name = image['name'] diskimage.image_types.add(image_type) self.pause = bool(image.get('pause', False)) - self.python_path = image.get('python-path') + self.python_path = image.get('python-path', 'auto') self.shell_type = image.get('shell-type') self.username = diskimage.username self.connection_type = image.get('connection-type', 'ssh') diff --git a/nodepool/tests/unit/test_driver_aws.py b/nodepool/tests/unit/test_driver_aws.py index 7132301ab..8f741994a 100644 --- a/nodepool/tests/unit/test_driver_aws.py +++ b/nodepool/tests/unit/test_driver_aws.py @@ -189,6 +189,7 @@ class TestDriverAws(tests.DBTestCase): self.assertEqual(node.public_ipv4, node.interface_ip) self.assertTrue(node.private_ipv4.startswith('203.0.113.')) self.assertFalse(node.public_ipv4.startswith('203.0.113.')) + self.assertEqual(node.python_path, 'auto') instance = self.ec2.Instance(node.external_id) response = instance.describe_attribute(Attribute='ebsOptimized') diff --git a/nodepool/tests/unit/test_driver_azure.py b/nodepool/tests/unit/test_driver_azure.py index b1878d414..75236064b 100644 --- a/nodepool/tests/unit/test_driver_azure.py +++ b/nodepool/tests/unit/test_driver_azure.py @@ -87,6 +87,7 @@ class TestDriverAzure(tests.DBTestCase): self.assertEqual(node.attributes, {'key1': 'value1', 'key2': 'value2'}) self.assertEqual(node.host_keys, ['ssh-rsa FAKEKEY']) + self.assertEqual(node.python_path, 'auto') self.assertEqual( self.fake_azure.crud['Microsoft.Compute/virtualMachines']. items[0]['properties']['osProfile']['customData'], @@ -127,6 +128,7 @@ class TestDriverAzure(tests.DBTestCase): self.assertEqual(node.shell_type, None) self.assertEqual(node.attributes, {'key1': 'value1', 'key2': 'value2'}) + self.assertEqual(node.python_path, 'auto') def test_azure_external_image(self): configfile = self.setup_config( diff --git a/nodepool/tests/unit/test_driver_ibmvpc.py b/nodepool/tests/unit/test_driver_ibmvpc.py index 9f8d1f0ea..d8e6aac2d 100644 --- a/nodepool/tests/unit/test_driver_ibmvpc.py +++ b/nodepool/tests/unit/test_driver_ibmvpc.py @@ -94,6 +94,7 @@ class TestDriverIBMVPC(tests.DBTestCase): self.assertIsNotNone(node.launcher) self.assertEqual(node.connection_type, 'ssh') self.assertEqual(node.host_keys, []) + self.assertEqual(node.python_path, 'auto') node.state = zk.USED self.zk.storeNode(node) @@ -120,6 +121,7 @@ class TestDriverIBMVPC(tests.DBTestCase): self.assertIsNotNone(node.launcher) self.assertEqual(node.connection_type, 'ssh') self.assertEqual(node.host_keys, ['ssh-rsa FAKEKEY']) + self.assertEqual(node.python_path, 'auto') node.state = zk.USED self.zk.storeNode(node)