Skip to content

fixing missing parameter exception for ex_add_access_config function#435

Closed
pmoosh wants to merge 1 commit into
apache:trunkfrom
pmoosh:trunk
Closed

fixing missing parameter exception for ex_add_access_config function#435
pmoosh wants to merge 1 commit into
apache:trunkfrom
pmoosh:trunk

Conversation

@pmoosh
Copy link
Copy Markdown
Contributor

@pmoosh pmoosh commented Jan 18, 2015

Missing nic parameter throws exception in gce.ex_add_access_config

stderr: Traceback (most recent call last):
  File "/Users/pmoosh/.ansible/tmp/ansible-tmp-1421538564.46-10999847043196/gce_setip.py", line 139, in <module>
    main(sys.argv[1:])
  File "/Users/pmoosh/.ansible/tmp/ansible-tmp-1421538564.46-10999847043196/gce_setip.py", line 128, in main
    gce.ex_add_access_config(node = my_instance, name = ACC_CNF_NM, nat_ip = item.address)
  File "/Users/pmoosh/src/apache-libcloud/libcloud/compute/drivers/gce.py", line 941, in ex_add_access_config
    self.connection.async_request(request, method='POST', data=config)
  File "/Users/pmoosh/src/apache-libcloud/libcloud/common/base.py", line 866, in async_request
    response = request(**kwargs)
  File "/Users/pmoosh/src/apache-libcloud/libcloud/common/google.py", line 669, in request
    *args, **kwargs)
  File "/Users/pmoosh/src/apache-libcloud/libcloud/common/base.py", line 736, in request
    response = responseCls(**kwargs)
  File "/Users/pmoosh/src/apache-libcloud/libcloud/common/base.py", line 119, in __init__
    self.object = self.parse_body()
  File "/Users/pmoosh/src/apache-libcloud/libcloud/common/google.py", line 267, in parse_body
    raise InvalidRequestError(message, self.status, code)
libcloud.common.google.InvalidRequestError: {'locationType': 'parameter', 'domain': 'global', 'message': 'Required parameter: networkInterface', 'reason': 'required', 'location': 'networkInterface'}

@Kami
Copy link
Copy Markdown
Member

Kami commented Jan 18, 2015

/cc @erjohnso

Comment thread libcloud/compute/drivers/gce.py Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pmoosh - Looks like params should only contain 'networkInterface' [https://cloud.google.com/compute/docs/reference/latest/instances/addAccessConfig]. The rest of the data goes into the body of the request (the config dict). I also don't see an explicit reference to attribute/param called accessConfig. Looks like the body should be,

{
  "kind": "compute#accessConfig",
  "type": string,
  "name": string,
  "natIP": string
}

And we don't need to set kind.

@erjohnso
Copy link
Copy Markdown
Contributor

Thanks for this @pmoosh! After you remove the accessConfig, can you also squash your commits and then I'll go ahead and merge it in.

@asfgit asfgit closed this in b2caf0f Jan 21, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants