Support privateIpAddress and ipAddress

Bug #945176 reported by Roman Yepishev
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Precise Backports
Micah Gersten
Roman Yepishev
txaws (Ubuntu)
Clint Byrum

Bug Description

OpenStack private cloud connection will need to use ipAddress instead of dnsName because the names may not be resolved on the client.

Related branches

Roman Yepishev (rye)
Changed in txaws:
assignee: nobody → Roman Yepishev (rye)
Jamu Kakar (jkakar)
Changed in txaws:
importance: Undecided → Medium
status: New → In Progress
Jamu Kakar (jkakar)
Changed in txaws:
status: In Progress → Fix Committed
Changed in txaws:
status: Fix Committed → Fix Released
Revision history for this message
Clint Byrum (clint-fewbar) wrote :

Evaluating for SRU to precise since this is a huge missing piece of the EC2 API

Changed in txaws (Ubuntu):
status: New → Fix Released
Changed in txaws (Ubuntu Precise):
assignee: nobody → Clint Byrum (clint-fewbar)
James Page (james-page)
Changed in txaws (Ubuntu Precise):
milestone: none → ubuntu-12.04.1
Changed in txaws (Ubuntu Precise):
status: New → Triaged
Changed in txaws (Ubuntu Precise):
milestone: ubuntu-12.04.1 → precise-updates
Revision history for this message
Clint Byrum (clint-fewbar) wrote :

On initial investigation of the given patch, it seemed that this problem would be fairly easy to solve with a cherry picked patch.

But, this is not so. ipAddress and privateIpAddress were not present in the default version of the EC2 API that txaws supported in the release shipped in precise (EC2 API version 2008-12-01).

Passing an EC2 query object which setts the API version at 2009-11-30, when the attributes were added, does work, but then causes failures in other areas of txaws which had to be updated for the newer WSDL, such as changing 'shutdownState' to 'currentState' in terminate_instances.

This is a red flag for me, and I think this has to be either be changed to a micro release update with a ton of regression testing, or the new version must be pushed to precise-backports, and anything (like juju) that wants to take advantage of the new attributes needs to be careful to only use them if they are available.

Marking the Precise SRU as Won't Fix, and opening a task against precise-backports, as that is the more conservative approach. We may decide to go forward with a micro release update if we can come up with a good testing plan, but it doesn't seem likely.

Revision history for this message
Clint Byrum (clint-fewbar) wrote :

Also attaching some test code I wrote to show where ip_address will or will not appear as a valid attribute depending on the version of txaws. If the patch is cherry picked, the ipaddress shows up, but terminateInstances raises an error because of the missing shutdownState.

Changed in txaws (Ubuntu Precise):
status: Triaged → Won't Fix
Revision history for this message
Clint Byrum (clint-fewbar) wrote :

Attaching successful no-change source rebuild on precise of quantal version.

Revision history for this message
Clint Byrum (clint-fewbar) wrote :

This is the output of the test program. Note that the backtrace about NoneType is normal (coding error due to my ignorance of how to do things perfectly in twisted).

$ python ami-9666e9a6
Mon Aug 6 16:32:33 2012: polling ec2...
Mon Aug 6 16:32:33 2012: polling ec2...
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/twisted/protocols/", line 123, in connectionLost
  File "/usr/lib/python2.7/dist-packages/twisted/web/", line 191, in connectionLost
  File "/usr/lib/python2.7/dist-packages/twisted/internet/", line 362, in callback
  File "/usr/lib/python2.7/dist-packages/twisted/internet/", line 458, in _startRunCallbacks
--- <exception caught here> ---
  File "/usr/lib/python2.7/dist-packages/twisted/internet/", line 545, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "", line 69, in describeInstances
    d = ec2.describe_instances(instance_id)
  File "/usr/lib/python2.7/dist-packages/txaws/ec2/", line 45, in describe_instances
    d = query.submit()
  File "/usr/lib/python2.7/dist-packages/txaws/ec2/", line 976, in submit
  File "/usr/lib/python2.7/dist-packages/txaws/ec2/", line 969, in sign
    self.params["Signature"] = self.signature.compute()
  File "/usr/lib/python2.7/dist-packages/txaws/ec2/", line 1022, in compute
    bytes = self.signing_text()
  File "/usr/lib/python2.7/dist-packages/txaws/ec2/", line 1041, in signing_text
  File "/usr/lib/python2.7/dist-packages/txaws/ec2/", line 1048, in get_canonical_query_params
    result.append("%s=%s" % (self.encode(key), self.encode(value)))
  File "/usr/lib/python2.7/dist-packages/txaws/ec2/", line 1059, in encode
    return quote(string, safe="~")
  File "/usr/lib/python2.7/", line 1255, in quote
    raise TypeError('None object cannot be quoted')
exceptions.TypeError: None object cannot be quoted
Mon Aug 6 16:32:43 2012: polling ec2...
Mon Aug 6 16:32:53 2012: polling ec2...
Mon Aug 6 16:33:04 2012: polling ec2...
Mon Aug 6 16:33:15 2012: polling ec2...
dns_name =
ip_address =
private_dns_name =
private_ip_address =
[('i-e5269ad6', 'running', 'shutting-down')]

When run on precise w/o this backport, ip_address will = None

Revision history for this message
Clint Byrum (clint-fewbar) wrote :

Testing juju (only rdep of python-txaws) with backported txaws, works perfectly:

Setting up juju (0.5+bzr531-0ubuntu1.2) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
(precise-amd64)root@clint-MacBookPro:/home/clint/pkg/txaws/backport# su - clint
(precise-amd64)clint@clint-MacBookPro:~$ dpkg -l python-txaws
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Description
ii python-txaws 0.2.3-1ubuntu1 Twisted-based Asynchronous Libraries for Amazon Web Services
(precise-amd64)clint@clint-MacBookPro:~$ juju status -e precise-branch
Invalid environment 'precise-branch'
2012-08-06 16:37:31,081 ERROR Invalid environment 'precise-branch'
(precise-amd64)clint@clint-MacBookPro:~$ juju status -e precise-fix
2012-08-06 16:37:34,610 INFO Connecting to environment...
Enter passphrase for key '/home/clint/.ssh/id_rsa':
2012-08-06 16:37:43,170 INFO Connected to environment.
    agent-state: running
    instance-id: i-236cd010
    instance-state: running
    agent-state: running
    instance-id: i-eb6dd1d8
    instance-state: running
    agent-state: running
    instance-id: i-9b6ed2a8
    instance-state: running
    charm: cs:precise/mysql-2
    relations: {}
        agent-state: started
        machine: 1
    charm: cs:precise/wordpress-3
    relations: {}
        agent-state: started
        machine: 2
2012-08-06 16:37:45,727 INFO 'status' command finished successfully
(precise-amd64)clint@clint-MacBookPro:~$ juju destroy-environment -e precise-fix
WARNING: this command will destroy the 'precise-fix' environment (type: ec2).
This includes all machines, services, data, and other resources. Continue [y/N]y
2012-08-06 16:38:02,946 INFO Destroying environment 'precise-fix' (type: ec2)...
2012-08-06 16:38:05,837 INFO Waiting on 3 EC2 instances to transition to terminated state, this may take a while
2012-08-06 16:38:43,354 INFO 'destroy_environment' command finished successfully

Revision history for this message
Clint Byrum (clint-fewbar) wrote :

Also tested backported aws-status, which is an indicator built on top of txaws. Works fine in precise.

Changed in precise-backports:
status: New → Confirmed
Revision history for this message
Clint Byrum (clint-fewbar) wrote :

build log of juju from precise building with backported txaws

Revision history for this message
Micah Gersten (micahg) wrote :

This looks good, uploading based on feedback from SpamapS on IRC.

Changed in precise-backports:
assignee: nobody → Micah Gersten (micahg)
status: Confirmed → In Progress
Revision history for this message
Micah Gersten (micahg) wrote :

This has been accepted into precise-backports.

Changed in precise-backports:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers