Repository: libcloud Updated Branches: refs/heads/trunk 7123206a9 -> e27ad982b
fixed comparison to test a boolean instead of a string in OpenStack drive; fixed corresponding unittest (newer versions of OpenStack now return a boolean and not a string) Closes #437 Signed-off-by: Tomaz Muraus <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/e27ad982 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/e27ad982 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/e27ad982 Branch: refs/heads/trunk Commit: e27ad982b9b46eb668f4a7faf76355e233abad1b Parents: 7123206 Author: quilombo <[email protected]> Authored: Fri Jan 23 17:08:20 2015 +0100 Committer: Tomaz Muraus <[email protected]> Committed: Tue Jan 27 22:43:19 2015 +0100 ---------------------------------------------------------------------- CHANGES.rst | 5 +++++ libcloud/compute/drivers/openstack.py | 6 +----- libcloud/test/compute/test_openstack.py | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/e27ad982/CHANGES.rst ---------------------------------------------------------------------- diff --git a/CHANGES.rst b/CHANGES.rst index fa123ff..ee24dfd 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -144,6 +144,11 @@ Compute (GITHUB-439) [Stephen D. Spencer] +- Fix a bug with config_drive attribute in the OpenStack driver. New versions + of OpenStack now return a boolean and not a string. + (GITHUB-433) + [quilombo] + Storage ~~~~~~~ http://git-wip-us.apache.org/repos/asf/libcloud/blob/e27ad982/libcloud/compute/drivers/openstack.py ---------------------------------------------------------------------- diff --git a/libcloud/compute/drivers/openstack.py b/libcloud/compute/drivers/openstack.py index 1688c5f..feab9b3 100644 --- a/libcloud/compute/drivers/openstack.py +++ b/libcloud/compute/drivers/openstack.py @@ -1989,11 +1989,7 @@ class OpenStack_1_1_NodeDriver(OpenStackNodeDriver): # state image = api_node.get('image', None) image_id = image.get('id', None) if image else None - - if api_node.get("config_drive", "false").lower() == "true": - config_drive = True - else: - config_drive = False + config_drive = api_node.get("config_drive", False) return Node( id=api_node['id'], http://git-wip-us.apache.org/repos/asf/libcloud/blob/e27ad982/libcloud/test/compute/test_openstack.py ---------------------------------------------------------------------- diff --git a/libcloud/test/compute/test_openstack.py b/libcloud/test/compute/test_openstack.py index 19f0eb8..0640898 100644 --- a/libcloud/test/compute/test_openstack.py +++ b/libcloud/test/compute/test_openstack.py @@ -926,7 +926,7 @@ class OpenStack_1_1_Tests(unittest.TestCase, TestCaseMixin): ex_config_drive=True) self.assertEqual(node.id, '26f7fbee-8ce1-4c28-887a-bfe8e4bb10fe') self.assertEqual(node.name, 'racktest') - self.assertEqual(node.extra['config_drive'], True) + self.assertTrue(node.extra['config_drive']) def test_destroy_node(self): self.assertTrue(self.node.destroy())
