kartiksubbarao opened a new issue #1346: GCE ex_list_instancegroups('all') 
raises KeyError 'zone'
URL: https://github.com/apache/libcloud/issues/1346
 
 
   ## Summary
   
   The GCE ex_list_instancegroups('all') call raises KeyError 'zone'.
   
   ## Detailed Information
   
   Libcloud 2.5.0
   Python 3.5
   Ubuntu 16.04.6 LTS
   
   The error is caused by line 9092 of gce.py in the `_to_instancegroup()` 
function:
   ```
   zone = self.ex_get_zone(instancegroup['zone'])
   ```
   The code is expecting the instancegroup dict to have a `zone` attribute, but 
that's not always the case. The underlying GCE API endpoint 
`/aggregated/instanceGroups` can also return objects that have a `region` 
attribute but not a `zone` attribute. Example:
   
   ```
   {'creationTimestamp': '2019-05-20T12:00:00.000-08:00',
    'description': 'This instance group is controlled by Regional Instance 
Group '
                   "Manager 'abcd-ef-ghij'. To modify instances in this group, "
                   'use the Regional Instance Group Manager API: '
                   
'https://cloud.google.com/compute/docs/reference/latest/instanceGroupManagers',
    'fingerprint': 'AbCdEfGHiJK=',
    'id': '12345678901234567',
    'kind': 'compute#instanceGroup',
    'name': 'abcd-ef-ghij',
    'namedPorts': [{'name': 'https', 'port': 443}],
    'network': 
'https://www.googleapis.com/compute/v1/projects/testproj1/global/networks/ab',
    'region': 
'https://www.googleapis.com/compute/v1/projects/testproj1/regions/us-west1',
    'selfLink': 
'https://www.googleapis.com/compute/v1/projects/testproj1/regions/us-west1/instanceGroups/abcd-ef-ghij',
    'size': 0,
    'subnetwork': 
'https://www.googleapis.com/compute/v1/projects/testproj1/regions/us-west1/subnetworks/asdf1234'}
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to