[
https://issues.apache.org/jira/browse/LIBCLOUD-343?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13694020#comment-13694020
]
Tomaz Muraus commented on LIBCLOUD-343:
---------------------------------------
"u" character is not located inside a string, but outside of it.
This u just indicates the string is a "unicode" and not "str" type. If for some
reason, you don't want to operate with "unicode" type, you can do the following
to get a regular "str":
* value.encode('utf-8')
* str(encode) - only supports characters in the ASCII range
On a side note, I just checked it and the actual type I get back is "str" and
not "unicode":
{quote}
[<Node: uuid=c5e23a26b2c513f4c8e669b8b3498ca31b238e3c, name=test-lc1, state=3,
public_ips=['192.241.199.139'], provider=Digital Ocean ...>]
{'private_ips': [], 'extra': {'backups_active': None, 'region_id': 3}, 'image':
None, '_uuid': None, 'driver':
<libcloud.compute.drivers.digitalocean.DigitalOceanNodeDriver object at
0x12f16d0>, 'state': 3, 'public_ips': ['192.241.199.139'], 'size': None, 'id':
'252595', 'name': 'test-lc1'}
{/quote}
In any case, like I've said above, even if you get unicode types, that's not an
issue.
> digitalocean json response bug on list_nodes
> --------------------------------------------
>
> Key: LIBCLOUD-343
> URL: https://issues.apache.org/jira/browse/LIBCLOUD-343
> Project: Libcloud
> Issue Type: Bug
> Components: Compute
> Environment: python="2.6"
> hardwaremodel="x86_64"
> installed_libcloud_version="0.12.4"
> is_virtual="true"
> kernel="Linux"
> kernelrelease="2.6.32-358.6.2.el6.x86_64"
> lsbdistdescription="CentOS release 6.4 (Final)"
> Reporter: Gary Wilson
>
> Running 0.12.4
> list_nodes is returning a rogue 'u' char in the responses from digitalocean,
> however rackspace and AWS remain OK
> <pre>
> from libcloud.compute.types import Provider
> from libcloud.compute.providers import get_driver
> DIGITALOCEAN_USER = 'xxxxx'
> DIGITALOCEAN_KEY = 'xxxxx'
> DigitalOceanDriver = get_driver(Provider.DIGITAL_OCEAN)
> driver = DigitalOceanDriver(DIGITALOCEAN_USER, DIGITALOCEAN_KEY)
> nodes = driver.list_nodes()
> for node in nodes:
> print(node.__dict__)
> </pre>
> The response with rogue u's on public_ips and name:
> <pre>
> {'private_ips': [], 'extra': {'backups_active': None, 'region_id': 2},
> 'image': None, '_uuid': None, 'driver':
> <libcloud.compute.drivers.digitalocean.DigitalOceanNodeDriver object at
> 0x7fd0870aded0>, 'state': 0, 'public_ips': [u'123.123.123.123'], 'size':
> None, 'id': '237305', 'name': u'dev-20g-doa'}
> {'private_ips': [], 'extra': {'backups_active': None, 'region_id': 2},
> 'image': None, '_uuid': None, 'driver':
> <libcloud.compute.drivers.digitalocean.DigitalOceanNodeDriver object at
> 0x7fd0870aded0>, 'state': 0, 'public_ips': [u'123.123.123.123'], 'size':
> None, 'id': '238143', 'name': u'test'}
> </pre>
> The digitalocean json response seems fine:
> <pre>
> {"status":"OK","droplets":[{"id":237305,"name":"dev-20g-doa","image_id":365680,"size_id":66,"region_id":2,"backups_active":null,"ip_address":"123.123.123.123","status":"active","created_at":"2013-06-18T15:36:30Z"},{"id":238143,"name":"test","image_id":449303,"size_id":66,"region_id":2,"backups_active":null,"ip_address":"123.123.123.123","status":"active","created_at":"2013-06-18T23:26:06Z"}]}
> </pre>
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira