From 42af1ad069ce09c465101cd2dcad93940c856c94 Mon Sep 17 00:00:00 2001
From: Gevorg Davoian <gdavoian@mirantis.com>
Date: Wed, 16 Nov 2016 14:55:37 +0200
Subject: [PATCH] Fix conversion to item_type on __call__ in List type

Change-Id: I365eec5785023135ce6aaceaec425e23fe4301f0
Closes-Bug: #1640962
---
 oslo_config/tests/test_types.py | 5 +++++
 oslo_config/types.py            | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/oslo_config/tests/test_types.py b/oslo_config/tests/test_types.py
index 2389d9b2..c4942979 100644
--- a/oslo_config/tests/test_types.py
+++ b/oslo_config/tests/test_types.py
@@ -531,6 +531,11 @@ class ListTypeTests(TypeTestHelper, unittest.TestCase):
         self.assertConvertedValue('1,2,3,5',
                                   [1, 2, 3, 5])
 
+    def test_tuple_of_custom_type(self):
+        self.type_instance = types.List(types.Integer())
+        self.assertConvertedValue(('1', '2', '3', '5'),
+                                  [1, 2, 3, 5])
+
     def test_bounds_parsing(self):
         self.type_instance = types.List(types.Integer(), bounds=True)
         self.assertConvertedValue('[1,2,3]', [1, 2, 3])
diff --git a/oslo_config/types.py b/oslo_config/types.py
index 4096f2eb..24768bc0 100644
--- a/oslo_config/types.py
+++ b/oslo_config/types.py
@@ -441,7 +441,7 @@ class List(ConfigType):
 
     def __call__(self, value):
         if isinstance(value, (list, tuple)):
-            return list(value)
+            return list(six.moves.map(self.item_type, value))
 
         s = value.strip()
         if self.bounds: