@@ -195,19 +195,17 @@ def add_locations(self, image_id, location_names):
195195 :param int image_id: The ID of the image
196196 :param location_names: Locations for the Image.
197197 """
198- locations = self .get_locations_id_list (image_id , location_names )
199- locations_ids = [{'id' : location_id } for location_id in locations ]
200- return self .vgbdtg .addLocations (locations_ids , id = image_id )
198+ locations = self .get_locations_list (image_id , location_names )
199+ return self .vgbdtg .addLocations (locations , id = image_id )
201200
202201 def remove_locations (self , image_id , location_names ):
203202 """Remove available locations from an archive image template.
204203
205204 :param int image_id: The ID of the image
206205 :param location_names: Locations for the Image.
207206 """
208- locations = self .get_locations_id_list (image_id , location_names )
209- locations_ids = [{'id' : location_id } for location_id in locations ]
210- return self .vgbdtg .removeLocations (locations_ids , id = image_id )
207+ locations = self .get_locations_list (image_id , location_names )
208+ return self .vgbdtg .removeLocations (locations , id = image_id )
211209
212210 def get_storage_locations (self , image_id ):
213211 """Get available locations for public image storage.
@@ -216,13 +214,12 @@ def get_storage_locations(self, image_id):
216214 """
217215 return self .vgbdtg .getStorageLocations (id = image_id )
218216
219- def get_locations_id_list (self , image_id , location_names ):
220- """Converts a list of location names to a list of location IDs .
217+ def get_locations_list (self , image_id , location_names ):
218+ """Converts a list of location names to a list of locations .
221219
222220 :param int image_id: The ID of the image.
223221 :param list location_names: A list of location names strings.
224- :returns: A list of locations IDs associated with the given location
225- keynames in the image id.
222+ :returns: A list of locations associated with the given location names in the image.
226223 """
227224 locations = self .get_storage_locations (image_id )
228225 locations_ids = []
@@ -235,10 +232,8 @@ def get_locations_id_list(self, image_id, location_names):
235232 matching_location = location
236233 break
237234 if matching_location .get ('id' ) is None :
238- raise exceptions .SoftLayerError (
239- output_error .format (location_name , image_id )
240- )
235+ raise exceptions .SoftLayerError (output_error .format (location_name , image_id ))
241236
242- locations_ids .append (matching_location . get ( 'id' ) )
237+ locations_ids .append (matching_location )
243238
244239 return locations_ids
0 commit comments