You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by GitBox <gi...@apache.org> on 2019/08/26 19:36:21 UTC

[GitHub] [libcloud] kartiksubbarao opened a new issue #1346: GCE ex_list_instancegroups('all') raises KeyError 'zone'

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:
users@infra.apache.org


With regards,
Apache Git Services