[07/13] libcloud git commit: Removed unused import
Removed unused import Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/009f2266 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/009f2266 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/009f2266 Branch: refs/heads/trunk Commit: 009f2266d4d4d1dff1bd6d83463b37757796f787 Parents: 2eb1b4a Author: Samuel ChongAuthored: Thu Oct 6 11:46:16 2016 +1100 Committer: Samuel Chong Committed: Thu Oct 6 11:46:16 2016 +1100 -- libcloud/compute/drivers/dimensiondata.py | 1 - 1 file changed, 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/009f2266/libcloud/compute/drivers/dimensiondata.py -- diff --git a/libcloud/compute/drivers/dimensiondata.py b/libcloud/compute/drivers/dimensiondata.py index 89f7c66..52283b2 100644 --- a/libcloud/compute/drivers/dimensiondata.py +++ b/libcloud/compute/drivers/dimensiondata.py @@ -44,7 +44,6 @@ from libcloud.common.dimensiondata import DimensionDataIpAddress from libcloud.common.dimensiondata import DimensionDataPortList from libcloud.common.dimensiondata import DimensionDataPort from libcloud.common.dimensiondata import DimensionDataChildPortList -from libcloud.common.dimensiondata import DimensionDataNic from libcloud.common.dimensiondata import NetworkDomainServicePlan from libcloud.common.dimensiondata import DimensionDataTagKey from libcloud.common.dimensiondata import DimensionDataTag
[12/13] libcloud git commit: fix network_adapter_name property in DimensionDataNic data contract class
fix network_adapter_name property in DimensionDataNic data contract class Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/487e0b77 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/487e0b77 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/487e0b77 Branch: refs/heads/trunk Commit: 487e0b77aae6c8bedcc1a0cbe1df038861c1fa29 Parents: a32546f Author: Samuel ChongAuthored: Mon Oct 10 10:53:36 2016 +1100 Committer: Samuel Chong Committed: Mon Oct 10 10:53:36 2016 +1100 -- libcloud/common/dimensiondata.py | 13 +++-- 1 file changed, 7 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/487e0b77/libcloud/common/dimensiondata.py -- diff --git a/libcloud/common/dimensiondata.py b/libcloud/common/dimensiondata.py index 5f618f9..84bca0d 100644 --- a/libcloud/common/dimensiondata.py +++ b/libcloud/common/dimensiondata.py @@ -1729,7 +1729,8 @@ class DimensionDataNic(object): A representation of Network Adapter in Dimension Data """ -def __init__(self, private_ip_v4=None, vlan=None, network_adapter=None): +def __init__(self, private_ip_v4=None, vlan=None, + network_adapter_name=None): """ Initialize an instance of :class:`DimensionDataNic` @@ -1739,14 +1740,14 @@ class DimensionDataNic(object): :param vlan: Network VLAN :type vlan: class: DimensionDataVlan or ``str`` -:param network_adapter: Network Adapter Name -:type network_adapter: ``str`` +:param network_adapter_name: Network Adapter Name +:type network_adapter_name: ``str`` """ self.private_ip_v4 = private_ip_v4 self.vlan = vlan -self.network_adapter_name = network_adapter +self.network_adapter_name = network_adapter_name def __repr__(self): return ('' -% (self.private_ip_v4, self.vlan, self.network_adapter)) +'network_adapter_name=%s>' +% (self.private_ip_v4, self.vlan, self.network_adapter_name))
[09/13] libcloud git commit: rename property name to child_portlist_list
rename property name to child_portlist_list Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/026c973e Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/026c973e Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/026c973e Branch: refs/heads/trunk Commit: 026c973e6f5114825c04c69128401f94e89434c5 Parents: 04c70e2 Author: Samuel ChongAuthored: Thu Oct 6 16:54:54 2016 +1100 Committer: Samuel Chong Committed: Thu Oct 6 16:54:54 2016 +1100 -- libcloud/common/dimensiondata.py | 13 +++-- libcloud/compute/drivers/dimensiondata.py | 6 +++--- 2 files changed, 10 insertions(+), 9 deletions(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/026c973e/libcloud/common/dimensiondata.py -- diff --git a/libcloud/common/dimensiondata.py b/libcloud/common/dimensiondata.py index 6633e64..5f618f9 100644 --- a/libcloud/common/dimensiondata.py +++ b/libcloud/common/dimensiondata.py @@ -1633,7 +1633,7 @@ class DimensionDataPortList(object): """ def __init__(self, id, name, description, port_collection, - child_port_list_lists, + child_portlist_list, state, create_time): Initialize an instance of :class:`DimensionDataPortList` @@ -1650,8 +1650,8 @@ class DimensionDataPortList(object): :param port_collection: Collection of DimensionDataPort :type port_collection: ``List`` -:param child_port_list_lists: Collection of DimensionDataChildPort -:type child_port_list_lists: ``List`` +:param child_portlist_list: Collection of DimensionDataChildPort +:type child_portlist_list: ``List`` :param state: Port list state :type state: ``str`` @@ -1663,16 +1663,17 @@ class DimensionDataPortList(object): self.name = name self.description = description self.port_collection = port_collection -self.child_port_list_lists = child_port_list_lists +self.child_portlist_list = child_portlist_list self.state = state self.create_time = create_time def __repr__(self): return ( "" +"port_collection=%s, child_portlist_list=%s, state=%s, " +"create_time=%s>" % (self.id, self.name, self.description, - self.port_collection, self.child_port_list, self.state, + self.port_collection, self.child_portlist_list, self.state, self.create_time)) http://git-wip-us.apache.org/repos/asf/libcloud/blob/026c973e/libcloud/compute/drivers/dimensiondata.py -- diff --git a/libcloud/compute/drivers/dimensiondata.py b/libcloud/compute/drivers/dimensiondata.py index 52283b2..a76fcdc 100644 --- a/libcloud/compute/drivers/dimensiondata.py +++ b/libcloud/compute/drivers/dimensiondata.py @@ -3416,9 +3416,9 @@ class DimensionDataNodeDriver(NodeDriver): for port in findall(element, 'port', TYPES_URN): ports.append(self._to_port(element=port)) -child_port_list_lists = [] +child_portlist_list = [] for child in findall(element, 'childPortList', TYPES_URN): -child_port_list_lists.append( +child_portlist_list.append( self._to_child_port_list(element=child)) return DimensionDataPortList( @@ -3426,7 +3426,7 @@ class DimensionDataNodeDriver(NodeDriver): name=findtext(element, 'name', TYPES_URN), description=findtext(element, 'description', TYPES_URN), port_collection=ports, -child_port_list_lists=child_port_list_lists, +child_portlist_list=child_portlist_list, state=findtext(element, 'state', TYPES_URN), create_time=findtext(element, 'createTime', TYPES_URN) )
[02/13] libcloud git commit: Merge remote-tracking branch 'apache/trunk' into trunk
Merge remote-tracking branch 'apache/trunk' into trunk Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/7440bf51 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/7440bf51 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/7440bf51 Branch: refs/heads/trunk Commit: 7440bf51c023936c7d1895e8f37ce707b26832d7 Parents: ff06265 e2e3476 Author: Samuel ChongAuthored: Wed Oct 5 17:07:15 2016 +1100 Committer: Samuel Chong Committed: Wed Oct 5 17:07:15 2016 +1100 -- --
[08/13] libcloud git commit: Unit test for firewall edit, portlist CRUD and IPAddressList CRUD
Unit test for firewall edit, portlist CRUD and IPAddressList CRUD Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/04c70e22 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/04c70e22 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/04c70e22 Branch: refs/heads/trunk Commit: 04c70e2285f3e2d64f72b16874f0882374133701 Parents: 009f226 Author: Samuel ChongAuthored: Thu Oct 6 15:14:00 2016 +1100 Committer: Samuel Chong Committed: Thu Oct 6 15:14:00 2016 +1100 -- .../dimensiondata/ip_address_list_create.xml| 9 + .../dimensiondata/ip_address_list_delete.xml| 10 + .../dimensiondata/ip_address_list_edit.xml | 10 + .../fixtures/dimensiondata/ip_address_lists.xml | 46 ++ .../ip_address_lists_FILTERBYNAME.xml | 14 + .../fixtures/dimensiondata/port_list_create.xml | 9 + .../fixtures/dimensiondata/port_list_delete.xml | 10 + .../fixtures/dimensiondata/port_list_edit.xml | 8 + .../fixtures/dimensiondata/port_list_get.xml| 15 + .../fixtures/dimensiondata/port_list_lists.xml | 38 + libcloud/test/compute/test_dimensiondata.py | 753 ++- 11 files changed, 921 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/04c70e22/libcloud/test/compute/fixtures/dimensiondata/ip_address_list_create.xml -- diff --git a/libcloud/test/compute/fixtures/dimensiondata/ip_address_list_create.xml b/libcloud/test/compute/fixtures/dimensiondata/ip_address_list_create.xml new file mode 100644 index 000..09317ef --- /dev/null +++ b/libcloud/test/compute/fixtures/dimensiondata/ip_address_list_create.xml @@ -0,0 +1,9 @@ + + +CREATE_IP_ADDRESS_LIST +OK +IP Address List 'myAddressList' has been created. + + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/libcloud/blob/04c70e22/libcloud/test/compute/fixtures/dimensiondata/ip_address_list_delete.xml -- diff --git a/libcloud/test/compute/fixtures/dimensiondata/ip_address_list_delete.xml b/libcloud/test/compute/fixtures/dimensiondata/ip_address_list_delete.xml new file mode 100644 index 000..13f323a --- /dev/null +++ b/libcloud/test/compute/fixtures/dimensiondata/ip_address_list_delete.xml @@ -0,0 +1,10 @@ + + +DELETE_IP_ADDRESS_LIST +OK +IP Address List with Id 84e34850-595d-436e-a885-7cd37edb24a4 has +been deleted. + + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/libcloud/blob/04c70e22/libcloud/test/compute/fixtures/dimensiondata/ip_address_list_edit.xml -- diff --git a/libcloud/test/compute/fixtures/dimensiondata/ip_address_list_edit.xml b/libcloud/test/compute/fixtures/dimensiondata/ip_address_list_edit.xml new file mode 100644 index 000..3462afa --- /dev/null +++ b/libcloud/test/compute/fixtures/dimensiondata/ip_address_list_edit.xml @@ -0,0 +1,10 @@ + + +EDIT_IP_ADDRESS_LIST +OK +IP Address List 'MyIpAddressList' has been edited +successfully. + + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/libcloud/blob/04c70e22/libcloud/test/compute/fixtures/dimensiondata/ip_address_lists.xml -- diff --git a/libcloud/test/compute/fixtures/dimensiondata/ip_address_lists.xml b/libcloud/test/compute/fixtures/dimensiondata/ip_address_lists.xml new file mode 100644 index 000..708c882 --- /dev/null +++ b/libcloud/test/compute/fixtures/dimensiondata/ip_address_lists.xml @@ -0,0 +1,46 @@ + + + +TestIPList2 +Test web server IP addresses list +IPV4 + + + + +NORMAL +2016-09-01T01:19:53.000Z + + +TestIPList_sub_2 +Test web server IP addresses list +IPV4 + + + + + +NORMAL +2016-09-01T01:20:56.000Z + + +Test_IP_Address_List_2 +Test Description +IPV4 + + +NORMAL +2016-09-05T05:37:56.000Z + + +Test_IP_Address_List_3 +Test Description +IPV4 + + + + +NORMAL +2016-09-05T05:57:53.000Z + + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/libcloud/blob/04c70e22/libcloud/test/compute/fixtures/dimensiondata/ip_address_lists_FILTERBYNAME.xml -- diff --git a/libcloud/test/compute/fixtures/dimensiondata/ip_address_lists_FILTERBYNAME.xml
[GitHub] libcloud pull request #893: New Feature - Edit Dimension Data Firewall Rule
Github user asfgit closed the pull request at: https://github.com/apache/libcloud/pull/893 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[13/13] libcloud git commit: Merge branch 'libcloud893' into trunk Closes #893
Merge branch 'libcloud893' into trunk Closes #893 Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/4d11ec27 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/4d11ec27 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/4d11ec27 Branch: refs/heads/trunk Commit: 4d11ec272957606d07c13171b1f73493b26b8736 Parents: 9ebc0b4 487e0b7 Author: Anthony ShawAuthored: Mon Oct 10 10:58:55 2016 +1100 Committer: Anthony Shaw Committed: Mon Oct 10 10:58:55 2016 +1100 -- libcloud/common/dimensiondata.py| 241 + libcloud/compute/drivers/dimensiondata.py | 929 +++ .../dimensiondata/ip_address_list_create.xml| 9 + .../dimensiondata/ip_address_list_delete.xml| 10 + .../dimensiondata/ip_address_list_edit.xml | 10 + .../fixtures/dimensiondata/ip_address_lists.xml | 46 + .../ip_address_lists_FILTERBYNAME.xml | 14 + .../fixtures/dimensiondata/port_list_create.xml | 9 + .../fixtures/dimensiondata/port_list_delete.xml | 10 + .../fixtures/dimensiondata/port_list_edit.xml | 8 + .../fixtures/dimensiondata/port_list_get.xml| 15 + .../fixtures/dimensiondata/port_list_lists.xml | 38 + libcloud/test/compute/test_dimensiondata.py | 753 ++- 13 files changed, 2091 insertions(+), 1 deletion(-) --
[10/13] libcloud git commit: Add sample code for Edit FW, CRUD for ipaddresslist and portlist
Add sample code for Edit FW, CRUD for ipaddresslist and portlist Add sample codes and rename port_list_list to portlist_list to avoid confusion Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/9e3c7da2 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/9e3c7da2 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/9e3c7da2 Branch: refs/heads/trunk Commit: 9e3c7da2403b30da67441e5a63ca79fff6236e3d Parents: 026c973 Author: Samuel ChongAuthored: Fri Oct 7 17:05:40 2016 +1100 Committer: Samuel Chong Committed: Fri Oct 7 17:05:40 2016 +1100 -- libcloud/compute/drivers/dimensiondata.py | 350 +-- libcloud/test/compute/test_dimensiondata.py | 128 - 2 files changed, 384 insertions(+), 94 deletions(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/9e3c7da2/libcloud/compute/drivers/dimensiondata.py -- diff --git a/libcloud/compute/drivers/dimensiondata.py b/libcloud/compute/drivers/dimensiondata.py index a76fcdc..08343ad 100644 --- a/libcloud/compute/drivers/dimensiondata.py +++ b/libcloud/compute/drivers/dimensiondata.py @@ -1481,6 +1481,44 @@ class DimensionDataNodeDriver(NodeDriver): """ Edit a firewall rule +>>> from pprint import pprint +>>> from libcloud.compute.types import Provider +>>> from libcloud.compute.providers import get_driver +>>> import libcloud.security +>>> +>>> # Get dimension data driver +>>> libcloud.security.VERIFY_SSL_CERT = True +>>> cls = get_driver(Provider.DIMENSIONDATA) +>>> # driver = cls('myusername','mypassword', region='dd-au') +>>> +>>> # Get location +>>> location = driver.ex_get_location_by_id(id='AU9') +>>> +>>> # Get network domain by location +>>> networkDomainName = "Baas QA" +>>> network_domains = driver.ex_list_network_domains(location=location) +>>> my_network_domain = [d for d in network_domains if d.name == + networkDomainName][0] +>>> +>>> +>>> # List firewall rules +>>> firewall_rules = driver.ex_list_firewall_rules(my_network_domain) +>>> +>>> # Get Firewall Rule by name +>>> pprint("List specific firewall rule by name") +>>> fire_rule_under_test = (list(filter(lambda x: x.name == + 'My_New_Firewall_Rule', firewall_rules))[0]) +>>> pprint(fire_rule_under_test.source) +>>> pprint(fire_rule_under_test.destination) +>>> +>>> # Edit Firewall +>>> fire_rule_under_test.destination.address_list_id = +'5e7c323f-c885-4e4b-9a27-94c44217dbd3' +>>> fire_rule_under_test.destination.port_list_id = +'b6557c5a-45fa-4138-89bd-8fe68392691b' +>>> result = driver.ex_edit_firewall_rule(fire_rule_under_test, 'LAST') +>>> pprint(result) + :param rule: (required) The rule in which to create :type rule: :class:`DimensionDataFirewallRule` @@ -2496,6 +2534,30 @@ class DimensionDataNodeDriver(NodeDriver): """ List IP Address List by network domain ID specified +>>> from pprint import pprint +>>> from libcloud.compute.types import Provider +>>> from libcloud.compute.providers import get_driver +>>> import libcloud.security +>>> +>>> # Get dimension data driver +>>> libcloud.security.VERIFY_SSL_CERT = True +>>> cls = get_driver(Provider.DIMENSIONDATA) +>>> driver = cls('myusername','mypassword', region='dd-au') +>>> +>>> # Get location +>>> location = driver.ex_get_location_by_id(id='AU9') +>>> +>>> # Get network domain by location +>>> networkDomainName = "Baas QA" +>>> network_domains = driver.ex_list_network_domains(location=location) +>>> my_network_domain = [d for d in network_domains if d.name == + networkDomainName][0] +>>> +>>> # List IP Address List of network domain +>>> ipaddresslist_list = driver.ex_list_ip_address_list( +>>> ex_network_domain=my_network_domain) +>>> pprint(ipaddresslist_list) + :param ex_network_domain: The network domain or network domain ID :type ex_network_domain: :class:`DimensionDataNetworkDomain` or 'str' @@ -2513,6 +2575,32 @@ class DimensionDataNodeDriver(NodeDriver): """ Get IP Address List by name in network domain specified +>>> from pprint import pprint +>>> from libcloud.compute.types import
[04/13] libcloud git commit: Added post_list_id property to DimensionDataFirewallAddress class
Added post_list_id property to DimensionDataFirewallAddress class Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/5327c110 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/5327c110 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/5327c110 Branch: refs/heads/trunk Commit: 5327c11048392f06eef901547a94bd899a26169d Parents: 2672b78 Author: Samuel ChongAuthored: Thu Oct 6 11:26:56 2016 +1100 Committer: Samuel Chong Committed: Thu Oct 6 11:26:56 2016 +1100 -- libcloud/common/dimensiondata.py | 9 + 1 file changed, 9 insertions(+) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/5327c110/libcloud/common/dimensiondata.py -- diff --git a/libcloud/common/dimensiondata.py b/libcloud/common/dimensiondata.py index 45f2c5e..af792c3 100644 --- a/libcloud/common/dimensiondata.py +++ b/libcloud/common/dimensiondata.py @@ -833,11 +833,20 @@ class DimensionDataFirewallAddress(object): self.any_ip = any_ip self.ip_address = ip_address self.ip_prefix_size = ip_prefix_size +self.port_list_id = port_list_id self.port_begin = port_begin self.port_end = port_end self.address_list_id = address_list_id self.port_list_id = port_list_id +def __repr__(self): +return ( +'' +% (self.any_ip, self.ip_address, self.ip_prefix_size, + self.port_begin, self.port_end, self.address_list_id, + self.port_list_id)) class DimensionDataNatRule(object): """
[03/13] libcloud git commit: Merge branch 'trunk' of https://github.com/samuelchong/libcloud into trunk
Merge branch 'trunk' of https://github.com/samuelchong/libcloud into trunk Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/2672b78f Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/2672b78f Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/2672b78f Branch: refs/heads/trunk Commit: 2672b78f9a9ee5f88656ba5dce9366493b73f65f Parents: 25c5ba9 7440bf5 Author: Samuel ChongAuthored: Thu Oct 6 11:04:39 2016 +1100 Committer: Samuel Chong Committed: Thu Oct 6 11:04:39 2016 +1100 -- --
[11/13] libcloud git commit: fix syntax error of list. Using square bracket instead of curly braces
fix syntax error of list. Using square bracket instead of curly braces Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/a32546f9 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/a32546f9 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/a32546f9 Branch: refs/heads/trunk Commit: a32546f94ba3e8e4e8f505617a8826b2a5fc63d8 Parents: 9e3c7da Author: Samuel ChongAuthored: Mon Oct 10 10:31:14 2016 +1100 Committer: Samuel Chong Committed: Mon Oct 10 10:31:14 2016 +1100 -- libcloud/compute/drivers/dimensiondata.py | 10 libcloud/test/compute/test_dimensiondata.py | 30 2 files changed, 20 insertions(+), 20 deletions(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/a32546f9/libcloud/compute/drivers/dimensiondata.py -- diff --git a/libcloud/compute/drivers/dimensiondata.py b/libcloud/compute/drivers/dimensiondata.py index 08343ad..8900086 100644 --- a/libcloud/compute/drivers/dimensiondata.py +++ b/libcloud/compute/drivers/dimensiondata.py @@ -1489,7 +1489,7 @@ class DimensionDataNodeDriver(NodeDriver): >>> # Get dimension data driver >>> libcloud.security.VERIFY_SSL_CERT = True >>> cls = get_driver(Provider.DIMENSIONDATA) ->>> # driver = cls('myusername','mypassword', region='dd-au') +>>> driver = cls('myusername','mypassword', region='dd-au') >>> >>> # Get location >>> location = driver.ex_get_location_by_id(id='AU9') @@ -2650,7 +2650,7 @@ class DimensionDataNodeDriver(NodeDriver): end='190.2.2.108') >>> ipAddress_3 = DimensionDataIpAddress(begin='190.2.2.0', prefix_size='24') ->>> ip_address_collection = {ipAddress_1, ipAddress_2, ipAddress_3} +>>> ip_address_collection = [ipAddress_1, ipAddress_2, ipAddress_3] >>> >>> # Create IPAddressList >>> result = driver.ex_create_ip_address_list( @@ -2774,7 +2774,7 @@ class DimensionDataNodeDriver(NodeDriver): >>> end='190.2.2.108') >>> ipAddress_3 = DimensionDataIpAddress( >>> begin='190.2.2.0', prefix_size='24') ->>> ip_address_collection = {ipAddress_1, ipAddress_2, ipAddress_3} +>>> ip_address_collection = [ipAddress_1, ipAddress_2, ipAddress_3] >>> >>> # Edit IP Address List >>> ip_address_list_id = '5e7c323f-c885-4e4b-9a27-94c44217dbd3' @@ -2993,7 +2993,7 @@ class DimensionDataNodeDriver(NodeDriver): >>> # Port Collection >>> port_1 = DimensionDataPort(begin='1000') >>> port_2 = DimensionDataPort(begin='1001', end='1003') ->>> port_collection = {port_1, port_2} +>>> port_collection = [port_1, port_2] >>> >>> # Create Port List >>> new_portlist = driver.ex_create_portlist( @@ -3087,7 +3087,7 @@ class DimensionDataNodeDriver(NodeDriver): >>> # Port Collection >>> port_1 = DimensionDataPort(begin='4200') >>> port_2 = DimensionDataPort(begin='4201', end='4210') ->>> port_collection = {port_1, port_2} +>>> port_collection = [port_1, port_2] >>> >>> # Edit Port List >>> editPortlist = driver.ex_get_portlist( http://git-wip-us.apache.org/repos/asf/libcloud/blob/a32546f9/libcloud/test/compute/test_dimensiondata.py -- diff --git a/libcloud/test/compute/test_dimensiondata.py b/libcloud/test/compute/test_dimensiondata.py index 941784e..36e9a63 100644 --- a/libcloud/test/compute/test_dimensiondata.py +++ b/libcloud/test/compute/test_dimensiondata.py @@ -1438,8 +1438,8 @@ class DimensionDataTests(unittest.TestCase, TestCaseMixin): end='190.2.2.108') ip_address_3 = DimensionDataIpAddress(begin='190.2.2.0', prefix_size='24') -ip_address_collection = {ip_address_1, ip_address_2, - ip_address_3} +ip_address_collection = [ip_address_1, ip_address_2, + ip_address_3] # Create IP Address List success = self.driver.ex_create_ip_address_list( @@ -1461,8 +1461,8 @@ class DimensionDataTests(unittest.TestCase, TestCaseMixin): end='190.2.2.108') ip_address_3 = DimensionDataIpAddress(begin='190.2.2.0', prefix_size='24') -ip_address_collection
[GitHub] libcloud pull request #897: Added snapshot management to OVH compute
GitHub user ZuluPro opened a pull request: https://github.com/apache/libcloud/pull/897 Added snapshot management to OVH compute ## Added snapshot management to OVH compute ### Description Added: - `ex_list_snapshots` - `ex_get_volume_snapshot` - `list_volume_snapshots ` - `create_volume_snapshot ` - `destroy_volume_snapshot ` ### Status WIP, missing docstring and arguments checking. ### Checklist (tick everything that applies) - [ ] [Code linting](http://libcloud.readthedocs.org/en/latest/development.html#code-style-guide) (required, can be done after the PR checks) - [ ] Documentation - [ ] [Tests](http://libcloud.readthedocs.org/en/latest/testing.html) - [ ] [ICLA](http://libcloud.readthedocs.org/en/latest/development.html#contributing-bigger-changes) (required for bigger changes) You can merge this pull request into a Git repository by running: $ git pull https://github.com/ZuluPro/libcloud ovh_compute Alternatively you can review and apply these changes as the patch at: https://github.com/apache/libcloud/pull/897.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #897 commit 4f7bc9c74f1bd24c2f034450567d7ac37e62024d Author: ZuluProDate: 2016-10-09T17:22:22Z Added OVH compute snapshot management commit 0124f761610d8429427b3a9bace07e37278bfba5 Author: ZuluPro Date: 2016-10-09T17:23:09Z Added OVH snapshot tests --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
libcloud git commit: update provider tables
Repository: libcloud Updated Branches: refs/heads/trunk bdccdb03e -> 9ebc0b49e update provider tables Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/9ebc0b49 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/9ebc0b49 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/9ebc0b49 Branch: refs/heads/trunk Commit: 9ebc0b49e59cb771c65a3d789432d9e4f010b4f9 Parents: bdccdb0 Author: Anthony ShawAuthored: Sun Oct 9 20:45:31 2016 +1100 Committer: Anthony Shaw Committed: Sun Oct 9 20:45:31 2016 +1100 -- docs/compute/_supported_methods_block_storage.rst | 6 ++ docs/compute/_supported_methods_image_management.rst| 6 ++ docs/compute/_supported_methods_key_pair_management.rst | 6 ++ docs/compute/_supported_methods_main.rst| 6 ++ docs/compute/_supported_providers.rst | 6 ++ docs/container/_supported_methods.rst | 2 ++ docs/container/_supported_providers.rst | 2 ++ docs/storage/_supported_methods_cdn.rst | 4 ++-- docs/storage/_supported_methods_main.rst| 4 ++-- docs/storage/_supported_providers.rst | 4 ++-- 10 files changed, 20 insertions(+), 26 deletions(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/9ebc0b49/docs/compute/_supported_methods_block_storage.rst -- diff --git a/docs/compute/_supported_methods_block_storage.rst b/docs/compute/_supported_methods_block_storage.rst index 60a33c6..877365d 100644 --- a/docs/compute/_supported_methods_block_storage.rst +++ b/docs/compute/_supported_methods_block_storage.rst @@ -10,7 +10,6 @@ Provider list volumes create volume destroy volume `Bluebox Blocks`_ no nono nonono no `Brightbox`_ no nono nonono no `BSNL`_ no nono nonono no -`CiscoCCS`_ no nono nonono no `CloudSigma (API v2.0)`_ no nono nonono no `CloudStack`_ yes yes yes yes yes no yes `Cloudwatt`_ yes yes yes yes yes yesyes @@ -42,12 +41,12 @@ Provider list volumes create volume destroy volume `OpenStack`_ yes yes yes yes yes no no `Outscale INC`_ yes yes yes yes yes yesyes `Outscale SAS`_ yes yes yes yes yes yesyes +`Ovh`_yes yes yes yes yes no no `Packet`_ no nono nonono no `ProfitBricks`_ yes yes yes yes yes no no `Rackspace Cloud (Next Gen)`_ yes yes yes yes yes yesyes `Rackspace Cloud (First Gen)`_yes yes yes yes yes no no `RimuHosting`_no nono nonono no -`RunAbove`_ yes yes yes yes yes no no `ServerLove`_ no nono nonono no `skalicloud`_ no nono nonono no `SoftLayer`_ no nono nonono no @@ -67,7 +66,6 @@ Provider
[GitHub] libcloud pull request #896: remove CiscoCCS driver
Github user asfgit closed the pull request at: https://github.com/apache/libcloud/pull/896 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] libcloud pull request #896: remove CiscoCCS driver
GitHub user tonybaloney opened a pull request: https://github.com/apache/libcloud/pull/896 remove CiscoCCS driver I found out it doesn't actually exist. You can merge this pull request into a Git repository by running: $ git pull https://github.com/tonybaloney/libcloud ccs Alternatively you can review and apply these changes as the patch at: https://github.com/apache/libcloud/pull/896.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #896 commit bdccdb03e8b36ad4eefbca7601952bc7757e838a Author: Anthony ShawDate: 2016-10-09T09:41:52Z remove CiscoCCS driver --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
libcloud git commit: remove CiscoCCS driver
Repository: libcloud Updated Branches: refs/heads/trunk 82df6e961 -> bdccdb03e remove CiscoCCS driver Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/bdccdb03 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/bdccdb03 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/bdccdb03 Branch: refs/heads/trunk Commit: bdccdb03e8b36ad4eefbca7601952bc7757e838a Parents: 82df6e9 Author: Anthony ShawAuthored: Sun Oct 9 20:41:52 2016 +1100 Committer: Anthony Shaw Committed: Sun Oct 9 20:41:52 2016 +1100 -- libcloud/compute/drivers/ciscoccs.py | 56 --- libcloud/compute/providers.py| 2 -- 2 files changed, 58 deletions(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/bdccdb03/libcloud/compute/drivers/ciscoccs.py -- diff --git a/libcloud/compute/drivers/ciscoccs.py b/libcloud/compute/drivers/ciscoccs.py deleted file mode 100644 index adc21f1..000 --- a/libcloud/compute/drivers/ciscoccs.py +++ /dev/null @@ -1,56 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -""" -Cisco CCS Driver -""" - -from libcloud.compute.providers import Provider -from libcloud.common.dimensiondata import (DimensionDataConnection, - API_ENDPOINTS) -from libcloud.compute.drivers.dimensiondata import DimensionDataNodeDriver - -DEFAULT_REGION = 'cisco-na' - - -class CiscoCCSNodeDriver(DimensionDataNodeDriver): -""" -Cisco CCS node driver, based on Dimension Data driver -""" - -selected_region = None -connectionCls = DimensionDataConnection -name = 'CiscoCCS' -website = 'http://www.cisco.com/' -type = Provider.CISCOCCS -features = {'create_node': ['password']} -api_version = 1.0 - -def __init__(self, key, secret=None, secure=True, host=None, port=None, - api_version=None, region=DEFAULT_REGION, **kwargs): - -if region not in API_ENDPOINTS: -raise ValueError('Invalid region: %s' % (region)) - -self.selected_region = API_ENDPOINTS[region] - -super(CiscoCCSNodeDriver, self).__init__( -key=key, -secret=secret, -secure=secure, -host=host, -port=port, -api_version=api_version, -region=region, -**kwargs) http://git-wip-us.apache.org/repos/asf/libcloud/blob/bdccdb03/libcloud/compute/providers.py -- diff --git a/libcloud/compute/providers.py b/libcloud/compute/providers.py index 459335e..b6ce56c 100644 --- a/libcloud/compute/providers.py +++ b/libcloud/compute/providers.py @@ -135,8 +135,6 @@ DRIVERS = { ('libcloud.compute.drivers.medone', 'MedOneNodeDriver'), Provider.BSNL: ('libcloud.compute.drivers.bsnl', 'BSNLNodeDriver'), -Provider.CISCOCCS: -('libcloud.compute.drivers.ciscoccs', 'CiscoCCSNodeDriver'), Provider.NTTA: ('libcloud.compute.drivers.ntta', 'NTTAmericaNodeDriver'), Provider.ALIYUN_ECS:
[jira] [Commented] (LIBCLOUD-850) Docker Driver missing '/' prior to URI
[ https://issues.apache.org/jira/browse/LIBCLOUD-850?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15559675#comment-15559675 ] ASF subversion and git services commented on LIBCLOUD-850: -- Commit 053d57469b502e5e548e2bbfa0322ec018387764 in libcloud's branch refs/heads/trunk from [~mloria] [ https://git-wip-us.apache.org/repos/asf?p=libcloud.git;h=053d574 ] fix LIBCLOUD-850 > Docker Driver missing '/' prior to URI > -- > > Key: LIBCLOUD-850 > URL: https://issues.apache.org/jira/browse/LIBCLOUD-850 > Project: Libcloud > Issue Type: Bug >Reporter: Mario Loria >Priority: Critical > > Just tried the docker driver and found that it's improperly sending requests > to the Docker API: > {{http://127.0.0.1:4243v1.24/containers/json?all=1}} > which yields: > {code} > >>> conn.list_containers() > Traceback (most recent call last): > File "", line 1, in > conn.list_containers() > File > "/home/mloria/arrovenv/lib/python3.5/site-packages/libcloud/container/drivers/docker.py > ", line 279, in list_containers > "v%s/containers/json%s" % (self.version, ex)).object > File > "/home/mloria/arrovenv/lib/python3.5/site-packages/libcloud/common/base.py", > line 862, > in request > response = responseCls(**kwargs) > File > "/home/mloria/arrovenv/lib/python3.5/site-packages/libcloud/common/base.py", > line 179, > in __init__ > headers=self.headers) > libcloud.common.exceptions.BaseHTTPError: 400 Bad Request > {code} > I've verified this by making the same GET request with Postman, which worked > properly (with the missing '/'). Also, Wireshark: http://imgur.com/a/ogEge -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (LIBCLOUD-850) Docker Driver missing '/' prior to URI
[ https://issues.apache.org/jira/browse/LIBCLOUD-850?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15559676#comment-15559676 ] ASF GitHub Bot commented on LIBCLOUD-850: - Github user asfgit closed the pull request at: https://github.com/apache/libcloud/pull/874 > Docker Driver missing '/' prior to URI > -- > > Key: LIBCLOUD-850 > URL: https://issues.apache.org/jira/browse/LIBCLOUD-850 > Project: Libcloud > Issue Type: Bug >Reporter: Mario Loria >Priority: Critical > > Just tried the docker driver and found that it's improperly sending requests > to the Docker API: > {{http://127.0.0.1:4243v1.24/containers/json?all=1}} > which yields: > {code} > >>> conn.list_containers() > Traceback (most recent call last): > File "", line 1, in > conn.list_containers() > File > "/home/mloria/arrovenv/lib/python3.5/site-packages/libcloud/container/drivers/docker.py > ", line 279, in list_containers > "v%s/containers/json%s" % (self.version, ex)).object > File > "/home/mloria/arrovenv/lib/python3.5/site-packages/libcloud/common/base.py", > line 862, > in request > response = responseCls(**kwargs) > File > "/home/mloria/arrovenv/lib/python3.5/site-packages/libcloud/common/base.py", > line 179, > in __init__ > headers=self.headers) > libcloud.common.exceptions.BaseHTTPError: 400 Bad Request > {code} > I've verified this by making the same GET request with Postman, which worked > properly (with the missing '/'). Also, Wireshark: http://imgur.com/a/ogEge -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[GitHub] libcloud pull request #895: Combine #850 and #874
Github user asfgit closed the pull request at: https://github.com/apache/libcloud/pull/895 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[3/8] libcloud git commit: fix ending :
fix ending : Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/3b1c9f4f Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/3b1c9f4f Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/3b1c9f4f Branch: refs/heads/trunk Commit: 3b1c9f4f1fe5ce06301d54f0647895645d12da8a Parents: 053d574 Author: Mario LoriaAuthored: Fri Sep 30 11:17:05 2016 -0400 Committer: Mario Loria Committed: Fri Sep 30 11:17:05 2016 -0400 -- libcloud/common/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/3b1c9f4f/libcloud/common/base.py -- diff --git a/libcloud/common/base.py b/libcloud/common/base.py index 4716ef5..3b03fa3 100644 --- a/libcloud/common/base.py +++ b/libcloud/common/base.py @@ -867,7 +867,7 @@ class Connection(object): return response def morph_action_hook(self, action): -if not action.startswith("/") +if not action.startswith("/"): action = "/" + action return self.request_path + action
[4/8] libcloud git commit: test fixes
test fixes Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/ea920443 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/ea920443 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/ea920443 Branch: refs/heads/trunk Commit: ea92044356633fb608b63a53b4e7684a00423c09 Parents: 3b1c9f4 Author: Mario LoriaAuthored: Fri Oct 7 22:24:57 2016 -0400 Committer: Mario Loria Committed: Fri Oct 7 22:24:57 2016 -0400 -- libcloud/test/container/test_docker.py | 48 ++--- 1 file changed, 24 insertions(+), 24 deletions(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/ea920443/libcloud/test/container/test_docker.py -- diff --git a/libcloud/test/container/test_docker.py b/libcloud/test/container/test_docker.py index 0f57fed..73c9f4e 100644 --- a/libcloud/test/container/test_docker.py +++ b/libcloud/test/container/test_docker.py @@ -129,101 +129,101 @@ class DockerMockHttp(MockHttp): raise AssertionError('Unsupported method') return (httplib.OK, body, {}, httplib.responses[httplib.OK]) -def vlinux_121_images_search( +def _vlinux_121_images_search( self, method, url, body, headers): return (httplib.OK, self.fixtures.load('linux_121/search.json'), {}, httplib.responses[httplib.OK]) -def vmac_124_images_search( +def _vmac_124_images_search( self, method, url, body, headers): return (httplib.OK, self.fixtures.load('mac_124/search.json'), {}, httplib.responses[httplib.OK]) -def vlinux_121_images_json( +def _vlinux_121_images_json( self, method, url, body, headers): return (httplib.OK, self.fixtures.load('linux_121/images.json'), {}, httplib.responses[httplib.OK]) -def vmac_124_images_json( +def _vmac_124_images_json( self, method, url, body, headers): return (httplib.OK, self.fixtures.load('linux_121/images.json'), {}, httplib.responses[httplib.OK]) -def vlinux_121_images_create( +def _vlinux_121_images_create( self, method, url, body, headers): return (httplib.OK, self.fixtures.load('linux_121/create_image.json'), {'Content-Type': 'application/json'}, httplib.responses[httplib.OK]) -def vmac_124_images_create( +def _vmac_124_images_create( self, method, url, body, headers): return (httplib.OK, self.fixtures.load('mac_124/create_image.json'), {'Content-Type': 'application/json'}, httplib.responses[httplib.OK]) -def vlinux_121_containers_json( +def _vlinux_121_containers_json( self, method, url, body, headers): return (httplib.OK, self.fixtures.load('linux_121/containers.json'), {}, httplib.responses[httplib.OK]) -def vmac_124_containers_json( +def _vmac_124_containers_json( self, method, url, body, headers): return (httplib.OK, self.fixtures.load('mac_124/containers.json'), {}, httplib.responses[httplib.OK]) -def vlinux_121_containers_create( +def _vlinux_121_containers_create( self, method, url, body, headers): return (httplib.OK, self.fixtures.load('linux_121/create_container.json'), {}, httplib.responses[httplib.OK]) -def vmac_124_containers_create( +def _vmac_124_containers_create( self, method, url, body, headers): return (httplib.OK, self.fixtures.load('mac_124/create_container.json'), {}, httplib.responses[httplib.OK]) -def vlinux_121_containers_a68c1872c74630522c7aa74b85558b06824c5e672cee334296c50fb209825303( +def _vlinux_121_containers_a68c1872c74630522c7aa74b85558b06824c5e672cee334296c50fb209825303( self, method, url, body, headers): return (httplib.NO_CONTENT, '', {}, httplib.responses[httplib.OK]) -def vmac_124_containers_a68c1872c74630522c7aa74b85558b06824c5e672cee334296c50fb209825303( +def _vmac_124_containers_a68c1872c74630522c7aa74b85558b06824c5e672cee334296c50fb209825303( self, method, url, body, headers): return (httplib.NO_CONTENT, '', {}, httplib.responses[httplib.OK]) -def vlinux_121_containers_a68c1872c74630522c7aa74b85558b06824c5e672cee334296c50fb209825303_start( +def _vlinux_121_containers_a68c1872c74630522c7aa74b85558b06824c5e672cee334296c50fb209825303_start( self, method, url, body, headers): return (httplib.NO_CONTENT, '', {}, httplib.responses[httplib.OK]) -def vmac_124_containers_a68c1872c74630522c7aa74b85558b06824c5e672cee334296c50fb209825303_start( +def
[7/8] libcloud git commit: linting
linting Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/3fafba8d Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/3fafba8d Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/3fafba8d Branch: refs/heads/trunk Commit: 3fafba8d57da4cec3a89de973180486a380c2056 Parents: 139278f Author: Anthony ShawAuthored: Sun Oct 9 20:21:31 2016 +1100 Committer: Anthony Shaw Committed: Sun Oct 9 20:21:31 2016 +1100 -- libcloud/__init__.py | 1 - libcloud/container/drivers/docker.py | 8 2 files changed, 4 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/3fafba8d/libcloud/__init__.py -- diff --git a/libcloud/__init__.py b/libcloud/__init__.py index aaa74c6..753b639 100644 --- a/libcloud/__init__.py +++ b/libcloud/__init__.py @@ -26,7 +26,6 @@ from libcloud.base import DriverTypeFactoryMap # NOQA from libcloud.base import get_driver # NOQA - try: import paramiko have_paramiko = True http://git-wip-us.apache.org/repos/asf/libcloud/blob/3fafba8d/libcloud/container/drivers/docker.py -- diff --git a/libcloud/container/drivers/docker.py b/libcloud/container/drivers/docker.py index 6b6839e..faf5117 100644 --- a/libcloud/container/drivers/docker.py +++ b/libcloud/container/drivers/docker.py @@ -473,7 +473,7 @@ class DockerContainerDriver(ContainerDriver): :rtype: ``bool`` """ result = self.connection.request('/v%s/containers/%s' % (self.version, -container.id), + container.id), method='DELETE') return result.status in VALID_RESPONSE_CODES @@ -535,8 +535,8 @@ class DockerContainerDriver(ContainerDriver): logs = result else: result = self.connection.request( -"/v%s/containers/%s/attach?logs=1=%s=1=1" % -(self.version, container.id, str(stream)), +"/v%s/containers/%s/attach?logs=1=%s=1=1" +% (self.version, container.id, str(stream)), method='POST', data=data) logs = result.body @@ -592,7 +592,7 @@ class DockerContainerDriver(ContainerDriver): :rtype: ``bool`` """ result = self.connection.request('/v%s/images/%s' % (self.version, -image.name), + image.name), method='DELETE') return result.status in VALID_RESPONSE_CODES
[GitHub] libcloud pull request #874: [LIBCLOUD-850] Docker Driver missing '/' prior t...
Github user asfgit closed the pull request at: https://github.com/apache/libcloud/pull/874 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[1/8] libcloud git commit: Fix a missing / in requests made by the DockerContainerDriver
Repository: libcloud Updated Branches: refs/heads/trunk 31897dd69 -> 82df6e961 Fix a missing / in requests made by the DockerContainerDriver Following the examples provided by the documentation would result in a "400 Bad Request" error due to the fact that the requests didn't begin with a '/' for example: GET v1.24/images/json HTTP/1.1 would result in a 400 Bad Request error, but: GET /v1.24/images/json HTTP/1.1 does not. Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/66fa5e31 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/66fa5e31 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/66fa5e31 Branch: refs/heads/trunk Commit: 66fa5e31604f782000d0096704f51ff20798fbf1 Parents: 2d4a6d3 Author: Jamie HankinsAuthored: Tue Aug 9 20:44:32 2016 +0100 Committer: GitHub Committed: Tue Aug 9 20:44:32 2016 +0100 -- libcloud/container/drivers/docker.py | 32 +++ 1 file changed, 16 insertions(+), 16 deletions(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/66fa5e31/libcloud/container/drivers/docker.py -- diff --git a/libcloud/container/drivers/docker.py b/libcloud/container/drivers/docker.py index 880618b..6b6839e 100644 --- a/libcloud/container/drivers/docker.py +++ b/libcloud/container/drivers/docker.py @@ -205,7 +205,7 @@ class DockerContainerDriver(ContainerDriver): } data = json.dumps(payload) -result = self.connection.request('v%s/images/create?fromImage=%s' % +result = self.connection.request('/v%s/images/create?fromImage=%s' % (self.version, path), data=data, method='POST') if "errorDetail" in result.body: @@ -235,7 +235,7 @@ class DockerContainerDriver(ContainerDriver): :rtype: ``list`` of :class:`libcloud.container.base.ContainerImage` """ -result = self.connection.request('v%s/images/json' % +result = self.connection.request('/v%s/images/json' % (self.version)).object images = [] for image in result: @@ -276,7 +276,7 @@ class DockerContainerDriver(ContainerDriver): ex = '' try: result = self.connection.request( -"v%s/containers/json%s" % (self.version, ex)).object +"/v%s/containers/json%s" % (self.version, ex)).object except Exception as exc: errno = getattr(exc, 'errno', None) if errno == 111: @@ -355,7 +355,7 @@ class DockerContainerDriver(ContainerDriver): data = json.dumps(payload) try: -result = self.connection.request('v%s/containers/create' +result = self.connection.request('/v%s/containers/create' % (self.version), data=data, params=params, method='POST') @@ -377,7 +377,7 @@ class DockerContainerDriver(ContainerDriver): data = json.dumps(payload) if start: result = self.connection.request( -'v%s/containers/%s/start' % +'/v%s/containers/%s/start' % (self.version, id_), data=data, method='POST') @@ -392,7 +392,7 @@ class DockerContainerDriver(ContainerDriver): :rtype: :class:`libcloud.container.base.Container` """ -result = self.connection.request("v%s/containers/%s/json" % +result = self.connection.request("/v%s/containers/%s/json" % (self.version, id)).object return self._to_container(result) @@ -413,7 +413,7 @@ class DockerContainerDriver(ContainerDriver): } data = json.dumps(payload) result = self.connection.request( -'v%s/containers/%s/start' % +'/v%s/containers/%s/start' % (self.version, container.id), method='POST', data=data) if result.status in VALID_RESPONSE_CODES: @@ -432,7 +432,7 @@ class DockerContainerDriver(ContainerDriver): :return: The container refreshed with current data :rtype: :class:`libcloud.container.base.Container` """ -result = self.connection.request('v%s/containers/%s/stop' % +result = self.connection.request('/v%s/containers/%s/stop' % (self.version, container.id), method='POST') if result.status in VALID_RESPONSE_CODES: @@ -453,7 +453,7 @@ class
[8/8] libcloud git commit: Merge remote-tracking branch 'me/combine_docker_fix' into trunk Closes #895
Merge remote-tracking branch 'me/combine_docker_fix' into trunk Closes #895 Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/82df6e96 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/82df6e96 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/82df6e96 Branch: refs/heads/trunk Commit: 82df6e961b6f3e581cb404a01acfee4ce498d1c6 Parents: 31897dd 3fafba8 Author: Anthony ShawAuthored: Sun Oct 9 20:32:04 2016 +1100 Committer: Anthony Shaw Committed: Sun Oct 9 20:32:04 2016 +1100 -- libcloud/common/base.py| 2 ++ libcloud/container/drivers/docker.py | 38 +++ libcloud/test/container/test_docker.py | 48 ++--- 3 files changed, 45 insertions(+), 43 deletions(-) --
[GitHub] libcloud pull request #850: Fix a missing / in requests made by the DockerCo...
Github user asfgit closed the pull request at: https://github.com/apache/libcloud/pull/850 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[6/8] libcloud git commit: Merge branch 'patch-1' into trunk Closes #850
Merge branch 'patch-1' into trunk Closes #850 Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/139278f7 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/139278f7 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/139278f7 Branch: refs/heads/trunk Commit: 139278f7d473ef5ec511e2c8a65a49b90f66f048 Parents: 503f33c 66fa5e3 Author: Anthony ShawAuthored: Sun Oct 9 20:05:16 2016 +1100 Committer: Anthony Shaw Committed: Sun Oct 9 20:05:16 2016 +1100 -- libcloud/container/drivers/docker.py | 32 +++ 1 file changed, 16 insertions(+), 16 deletions(-) --
libcloud git commit: lint fix
Repository: libcloud Updated Branches: refs/heads/trunk bb95abe85 -> 31897dd69 lint fix Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/31897dd6 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/31897dd6 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/31897dd6 Branch: refs/heads/trunk Commit: 31897dd69fd2bfe4946dc00bcf97efaf26be31ce Parents: bb95abe Author: Anthony ShawAuthored: Sun Oct 9 20:17:16 2016 +1100 Committer: Anthony Shaw Committed: Sun Oct 9 20:17:16 2016 +1100 -- libcloud/__init__.py | 1 - 1 file changed, 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/31897dd6/libcloud/__init__.py -- diff --git a/libcloud/__init__.py b/libcloud/__init__.py index aaa74c6..753b639 100644 --- a/libcloud/__init__.py +++ b/libcloud/__init__.py @@ -26,7 +26,6 @@ from libcloud.base import DriverTypeFactoryMap # NOQA from libcloud.base import get_driver # NOQA - try: import paramiko have_paramiko = True
[GitHub] libcloud pull request #895: Combine #850 and #874
GitHub user tonybaloney opened a pull request: https://github.com/apache/libcloud/pull/895 Combine #850 and #874 ## Changes Title (replace this with a logical title for your changes) ### Description Replace this with the PR description (mention the changes you have made, why you have made them, provide some background and any references to the provider documentation if needed, etc.). For more information on contributing, please see [Contributing](http://libcloud.readthedocs.org/en/latest/development.html#contributing) section of our documentation. ### Status Replace this: describe the PR status. Examples: - work in progress - done, ready for review ### Checklist (tick everything that applies) - [ ] [Code linting](http://libcloud.readthedocs.org/en/latest/development.html#code-style-guide) (required, can be done after the PR checks) - [ ] Documentation - [ ] [Tests](http://libcloud.readthedocs.org/en/latest/testing.html) - [ ] [ICLA](http://libcloud.readthedocs.org/en/latest/development.html#contributing-bigger-changes) (required for bigger changes) You can merge this pull request into a Git repository by running: $ git pull https://github.com/tonybaloney/libcloud combine_docker_fix Alternatively you can review and apply these changes as the patch at: https://github.com/apache/libcloud/pull/895.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #895 commit 66fa5e31604f782000d0096704f51ff20798fbf1 Author: Jamie HankinsDate: 2016-08-09T19:44:32Z Fix a missing / in requests made by the DockerContainerDriver Following the examples provided by the documentation would result in a "400 Bad Request" error due to the fact that the requests didn't begin with a '/' for example: GET v1.24/images/json HTTP/1.1 would result in a 400 Bad Request error, but: GET /v1.24/images/json HTTP/1.1 does not. commit 053d57469b502e5e548e2bbfa0322ec018387764 Author: Mario Loria Date: 2016-09-28T20:11:23Z fix LIBCLOUD-850 commit 3b1c9f4f1fe5ce06301d54f0647895645d12da8a Author: Mario Loria Date: 2016-09-30T15:17:05Z fix ending : commit ea92044356633fb608b63a53b4e7684a00423c09 Author: Mario Loria Date: 2016-10-08T02:24:57Z test fixes commit 503f33cc404388e43aa5393e91f93490320083dc Author: Anthony Shaw Date: 2016-10-09T09:03:32Z Merge branch 'slash_fix' into trunk Closes #874 commit 139278f7d473ef5ec511e2c8a65a49b90f66f048 Author: Anthony Shaw Date: 2016-10-09T09:05:16Z Merge branch 'patch-1' into trunk Closes #850 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] libcloud pull request #822: Lazy entry
Github user asfgit closed the pull request at: https://github.com/apache/libcloud/pull/822 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[10/10] libcloud git commit: changes for #822
changes for #822 Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/bb95abe8 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/bb95abe8 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/bb95abe8 Branch: refs/heads/trunk Commit: bb95abe85d9cd57ba77e23961095c072efeabb66 Parents: 3faee65 Author: Anthony ShawAuthored: Sun Oct 9 19:50:37 2016 +1100 Committer: Anthony Shaw Committed: Sun Oct 9 19:50:37 2016 +1100 -- CHANGES.rst | 4 1 file changed, 4 insertions(+) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/bb95abe8/CHANGES.rst -- diff --git a/CHANGES.rst b/CHANGES.rst index 09ea680..f94040e 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -7,6 +7,10 @@ Changes in current version of Apache Libcloud General ~~~ +- Introduced new base API for instantiating drivers + (GITHUB-822) + [Anthony Shaw] + - Added certificate path for SLES12/OpenSUSE12 (GITHUB-884) [Michael Calmer]
[09/10] libcloud git commit: Merge branch 'lazy_entry' into trunk
Merge branch 'lazy_entry' into trunk Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/3faee650 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/3faee650 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/3faee650 Branch: refs/heads/trunk Commit: 3faee650f71b89c0bab2977d50aea45ed543d494 Parents: a64b0ea 7db284c Author: Anthony ShawAuthored: Sun Oct 9 19:49:50 2016 +1100 Committer: Anthony Shaw Committed: Sun Oct 9 19:49:50 2016 +1100 -- docs/getting_started.rst | 14 +++ libcloud/__init__.py | 8 +++- libcloud/base.py | 81 + libcloud/test/test_init.py | 9 + libcloud/utils/py3.py | 6 ++- setup.py | 5 ++- 6 files changed, 111 insertions(+), 12 deletions(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/3faee650/libcloud/__init__.py -- diff --cc libcloud/__init__.py index 56248bd,4c42e91..aaa74c6 --- a/libcloud/__init__.py +++ b/libcloud/__init__.py @@@ -21,8 -21,14 +21,12 @@@ libcloud provides a unified interface t import os import codecs + from libcloud.base import DriverType # NOQA + from libcloud.base import DriverTypeFactoryMap # NOQA + from libcloud.base import get_driver # NOQA + + -__all__ = ['__version__', 'enable_debug'] -__version__ = '1.0.0' + try: import paramiko have_paramiko = True http://git-wip-us.apache.org/repos/asf/libcloud/blob/3faee650/setup.py --
[06/10] libcloud git commit: warning when backports not available as will attempted to be imported on module-level import, in setuptools this causes an issue as it's before the pip job runs
warning when backports not available as will attempted to be imported on module-level import, in setuptools this causes an issue as it's before the pip job runs Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/2888c720 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/2888c720 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/2888c720 Branch: refs/heads/trunk Commit: 2888c720e4b130dadbc2d566b8083bf172524845 Parents: 5d7c437 Author: Anthony ShawAuthored: Fri Jun 24 16:52:13 2016 +1000 Committer: Anthony Shaw Committed: Fri Jun 24 16:52:13 2016 +1000 -- libcloud/utils/py3.py | 6 +- setup.py | 9 - 2 files changed, 5 insertions(+), 10 deletions(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/2888c720/libcloud/utils/py3.py -- diff --git a/libcloud/utils/py3.py b/libcloud/utils/py3.py index 742d409..ef38eed 100644 --- a/libcloud/utils/py3.py +++ b/libcloud/utils/py3.py @@ -64,7 +64,11 @@ if sys.version_info >= (3, 2) and sys.version_info < (3, 3): PY32 = True if PY2_pre_279 or PY3_pre_32: -from backports.ssl_match_hostname import match_hostname, CertificateError # NOQA +try: +from backports.ssl_match_hostname import match_hostname, CertificateError # NOQA +except ImportError: +import warnings +warnings.warn("Missing backports.ssl_match_hostname package") else: # ssl module in Python >= 3.2 includes match hostname function from ssl import match_hostname, CertificateError # NOQA http://git-wip-us.apache.org/repos/asf/libcloud/blob/2888c720/setup.py -- diff --git a/setup.py b/setup.py index 2de4048..8a3df01 100644 --- a/setup.py +++ b/setup.py @@ -28,15 +28,6 @@ try: except ImportError: has_epydoc = False -# Mock out the backports module incase an import is requested. -class MockBackports: -def match_hostname(): -pass - -def CertificateError(): -pass - -sys.modules['backports.ssl_match_hostname'] = MockBackports import libcloud.utils # NOQA from libcloud.utils.dist import get_packages, get_data_files # NOQA
[02/10] libcloud git commit: added doc example and test
added doc example and test Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/93d38700 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/93d38700 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/93d38700 Branch: refs/heads/trunk Commit: 93d387006d0eb5a1a194098aa480809d2d7baa03 Parents: f33df13 Author: Anthony ShawAuthored: Fri Jun 24 15:53:31 2016 +1000 Committer: Anthony Shaw Committed: Fri Jun 24 15:53:31 2016 +1000 -- docs/getting_started.rst| 14 +-- libcloud/__init__.py| 26 +--- .../fixtures/docker/mac_124/create_image.json | 1 + libcloud/test/test_init.py | 4 +++ 4 files changed, 35 insertions(+), 10 deletions(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/93d38700/docs/getting_started.rst -- diff --git a/docs/getting_started.rst b/docs/getting_started.rst index 29ddb4b..c407e9c 100644 --- a/docs/getting_started.rst +++ b/docs/getting_started.rst @@ -40,10 +40,10 @@ with any of the Libcloud drivers. from pprint import pprint -from libcloud.compute.types import Provider -from libcloud.compute.providers import get_driver +import libcloud + +cls = libcloud.get_driver(libcloud.DriverType.COMPUTE, libcloud.DriverType.COMPUTE.RACKSPACE) -cls = get_driver(Provider.RACKSPACE) 2. Instantiate the driver with your provider credentials @@ -70,10 +70,10 @@ see provider-specific documentation and the driver docstrings. from pprint import pprint -from libcloud.compute.types import Provider -from libcloud.compute.providers import get_driver - -cls = get_driver(Provider.RACKSPACE) +import libcloud + +cls = libcloud.get_driver(libcloud.DriverType.COMPUTE, libcloud.DriverType.COMPUTE.RACKSPACE) + driver = cls('my username', 'my api key') pprint(driver.list_sizes()) http://git-wip-us.apache.org/repos/asf/libcloud/blob/93d38700/libcloud/__init__.py -- diff --git a/libcloud/__init__.py b/libcloud/__init__.py index 69b2a0a..38ebfcb 100644 --- a/libcloud/__init__.py +++ b/libcloud/__init__.py @@ -22,11 +22,22 @@ import os import codecs from libcloud.backup.providers import Provider as BackupProvider +from libcloud.backup.providers import get_driver as get_backup_driver + from libcloud.compute.providers import Provider as ComputeProvider +from libcloud.compute.providers import get_driver as get_compute_driver + from libcloud.container.providers import Provider as ContainerProvider +from libcloud.container.providers import get_driver as get_container_driver + from libcloud.dns.providers import Provider as DnsProvider +from libcloud.dns.providers import get_driver as get_dns_driver + from libcloud.loadbalancer.providers import Provider as LoadBalancerProvider +from libcloud.loadbalancer.providers import get_driver as get_loadbalancer_driver + from libcloud.storage.providers import Provider as StorageProvider +from libcloud.storage.providers import get_driver as get_storage_driver __all__ = ['__version__', 'enable_debug'] @@ -104,9 +115,18 @@ class DriverType: STORAGE = StorageProvider -def get_driver(provider): -""" +DriverTypeFactoryMap = { +DriverType.BACKUP: get_backup_driver, +DriverType.COMPUTE: get_compute_driver, +DriverType.CONTAINER: get_container_driver, +DriverType.DNS: get_dns_driver, +DriverType.LOADBALANCER: get_loadbalancer_driver, +DriverType.STORAGE: get_storage_driver +} + +def get_driver(type, provider): +""" Get a driver """ -pass \ No newline at end of file +return DriverTypeFactoryMap[type](provider) http://git-wip-us.apache.org/repos/asf/libcloud/blob/93d38700/libcloud/test/container/fixtures/docker/mac_124/create_image.json -- diff --git a/libcloud/test/container/fixtures/docker/mac_124/create_image.json b/libcloud/test/container/fixtures/docker/mac_124/create_image.json new file mode 100644 index 000..4509f55 --- /dev/null +++ b/libcloud/test/container/fixtures/docker/mac_124/create_image.json @@ -0,0 +1 @@ +{"status":"Download complete","progressDetail":{},"id":"cf55d61f5307b7a18a45980971d6cfd40b737dd661879c4a6b3f2aecc3bc37b0"} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/libcloud/blob/93d38700/libcloud/test/test_init.py -- diff --git a/libcloud/test/test_init.py b/libcloud/test/test_init.py index ad709d7..0276850 100644 ---
[08/10] libcloud git commit: added type to error and added test
added type to error and added test Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/7db284c6 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/7db284c6 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/7db284c6 Branch: refs/heads/trunk Commit: 7db284c6b5bbd021361fd98bc2fbe1a783ad4d2b Parents: 7a1bb84 Author: Anthony ShawAuthored: Fri Jul 1 16:19:30 2016 +1000 Committer: Anthony Shaw Committed: Fri Jul 1 16:19:30 2016 +1000 -- libcloud/base.py | 6 +++--- libcloud/test/test_init.py | 5 + 2 files changed, 8 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/7db284c6/libcloud/base.py -- diff --git a/libcloud/base.py b/libcloud/base.py index 6491f98..94e9f17 100644 --- a/libcloud/base.py +++ b/libcloud/base.py @@ -64,8 +64,8 @@ DriverTypeFactoryMap = { class DriverTypeNotFoundError(KeyError): -def __init__(self): -self.message = "Driver type not found." +def __init__(self, type): +self.message = "Driver type '%s' not found." % type def __repr__(self): return self.message @@ -78,4 +78,4 @@ def get_driver(type, provider): try: return DriverTypeFactoryMap[type](provider) except KeyError: -raise DriverTypeNotFoundError() +raise DriverTypeNotFoundError(type) http://git-wip-us.apache.org/repos/asf/libcloud/blob/7db284c6/libcloud/test/test_init.py -- diff --git a/libcloud/test/test_init.py b/libcloud/test/test_init.py index 0276850..97beacc 100644 --- a/libcloud/test/test_init.py +++ b/libcloud/test/test_init.py @@ -26,6 +26,7 @@ except ImportError: import libcloud from libcloud import _init_once +from libcloud.base import DriverTypeNotFoundError from libcloud.common.base import LoggingHTTPConnection from libcloud.common.base import LoggingHTTPSConnection @@ -61,5 +62,9 @@ class TestUtils(unittest.TestCase): driver = libcloud.get_driver(libcloud.DriverType.COMPUTE, libcloud.DriverType.COMPUTE.EC2) self.assertEqual(driver.__name__, 'EC2NodeDriver') +def test_raises_error(self): +with self.assertRaises(DriverTypeNotFoundError): +libcloud.get_driver('potato', 'potato') + if __name__ == '__main__': sys.exit(unittest.main())
[03/10] libcloud git commit: fix linting issue
fix linting issue Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/e28aa409 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/e28aa409 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/e28aa409 Branch: refs/heads/trunk Commit: e28aa409a3665ff509afe2add7508c95458ea2ac Parents: 93d3870 Author: Anthony ShawAuthored: Fri Jun 24 16:00:58 2016 +1000 Committer: Anthony Shaw Committed: Fri Jun 24 16:00:58 2016 +1000 -- libcloud/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/e28aa409/libcloud/__init__.py -- diff --git a/libcloud/__init__.py b/libcloud/__init__.py index 38ebfcb..eea2bbb 100644 --- a/libcloud/__init__.py +++ b/libcloud/__init__.py @@ -34,7 +34,8 @@ from libcloud.dns.providers import Provider as DnsProvider from libcloud.dns.providers import get_driver as get_dns_driver from libcloud.loadbalancer.providers import Provider as LoadBalancerProvider -from libcloud.loadbalancer.providers import get_driver as get_loadbalancer_driver +from libcloud.loadbalancer.providers import get_driver as \ +get_loadbalancer_driver from libcloud.storage.providers import Provider as StorageProvider from libcloud.storage.providers import get_driver as get_storage_driver
[05/10] libcloud git commit: mock out backports for the setuptools module
mock out backports for the setuptools module Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/5d7c4377 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/5d7c4377 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/5d7c4377 Branch: refs/heads/trunk Commit: 5d7c43774932934bab0ff7ebfab469a09bfa620d Parents: 2ea10dc Author: Anthony ShawAuthored: Fri Jun 24 16:30:09 2016 +1000 Committer: Anthony Shaw Committed: Fri Jun 24 16:30:09 2016 +1000 -- setup.py | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/5d7c4377/setup.py -- diff --git a/setup.py b/setup.py index e8cc1bf..2de4048 100644 --- a/setup.py +++ b/setup.py @@ -28,8 +28,18 @@ try: except ImportError: has_epydoc = False -import libcloud.utils -from libcloud.utils.dist import get_packages, get_data_files +# Mock out the backports module incase an import is requested. +class MockBackports: +def match_hostname(): +pass + +def CertificateError(): +pass + +sys.modules['backports.ssl_match_hostname'] = MockBackports + +import libcloud.utils # NOQA +from libcloud.utils.dist import get_packages, get_data_files # NOQA libcloud.utils.SHOW_DEPRECATION_WARNING = False
[01/10] libcloud git commit: added lazy entry
Repository: libcloud Updated Branches: refs/heads/trunk a64b0eacd -> bb95abe85 added lazy entry Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/f33df134 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/f33df134 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/f33df134 Branch: refs/heads/trunk Commit: f33df13476b6a3a0db5e3dc448c7d7c266abead2 Parents: d960e65 Author: Anthony ShawAuthored: Fri Jun 24 15:18:29 2016 +1000 Committer: Anthony Shaw Committed: Fri Jun 24 15:18:29 2016 +1000 -- libcloud/__init__.py | 41 ++--- 1 file changed, 38 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/f33df134/libcloud/__init__.py -- diff --git a/libcloud/__init__.py b/libcloud/__init__.py index 78ad2ee..69b2a0a 100644 --- a/libcloud/__init__.py +++ b/libcloud/__init__.py @@ -18,13 +18,20 @@ libcloud provides a unified interface to the cloud computing resources. :var __version__: Current version of libcloud """ +import os +import codecs + +from libcloud.backup.providers import Provider as BackupProvider +from libcloud.compute.providers import Provider as ComputeProvider +from libcloud.container.providers import Provider as ContainerProvider +from libcloud.dns.providers import Provider as DnsProvider +from libcloud.loadbalancer.providers import Provider as LoadBalancerProvider +from libcloud.storage.providers import Provider as StorageProvider + __all__ = ['__version__', 'enable_debug'] __version__ = '1.0.0' -import os -import codecs - try: import paramiko have_paramiko = True @@ -75,3 +82,31 @@ def _init_once(): paramiko.common.logging.basicConfig(level=paramiko.common.DEBUG) _init_once() + + +class DriverType: +""" Backup-as-a-service driver """ +BACKUP = BackupProvider + +""" Compute-as-a-Service driver """ +COMPUTE = ComputeProvider + +""" Container-as-a-Service driver """ +CONTAINER = ContainerProvider + +""" DNS service provider driver """ +DNS = DnsProvider + +""" Load balancer provider-driver """ +LOADBALANCER = LoadBalancerProvider + +""" Storage-as-a-Service driver """ +STORAGE = StorageProvider + + +def get_driver(provider): +""" + +Get a driver +""" +pass \ No newline at end of file
[04/10] libcloud git commit: remove accidental import
remove accidental import Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/2ea10dc9 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/2ea10dc9 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/2ea10dc9 Branch: refs/heads/trunk Commit: 2ea10dc92546130c529b5a1d16450cb8c007214e Parents: e28aa40 Author: Anthony ShawAuthored: Fri Jun 24 16:02:45 2016 +1000 Committer: Anthony Shaw Committed: Fri Jun 24 16:02:45 2016 +1000 -- libcloud/test/container/fixtures/docker/mac_124/create_image.json | 1 - 1 file changed, 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/2ea10dc9/libcloud/test/container/fixtures/docker/mac_124/create_image.json -- diff --git a/libcloud/test/container/fixtures/docker/mac_124/create_image.json b/libcloud/test/container/fixtures/docker/mac_124/create_image.json deleted file mode 100644 index 4509f55..000 --- a/libcloud/test/container/fixtures/docker/mac_124/create_image.json +++ /dev/null @@ -1 +0,0 @@ -{"status":"Download complete","progressDetail":{},"id":"cf55d61f5307b7a18a45980971d6cfd40b737dd661879c4a6b3f2aecc3bc37b0"} \ No newline at end of file
[07/10] libcloud git commit: update code from PR review notes
update code from PR review notes Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/7a1bb847 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/7a1bb847 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/7a1bb847 Branch: refs/heads/trunk Commit: 7a1bb8475e9d767b1eef51d23e93822325a2f4e3 Parents: 2888c72 Author: Anthony ShawAuthored: Sat Jun 25 20:18:59 2016 +1000 Committer: Anthony Shaw Committed: Sat Jun 25 20:18:59 2016 +1000 -- libcloud/__init__.py | 58 ++--- libcloud/base.py | 81 +++ 2 files changed, 84 insertions(+), 55 deletions(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/7a1bb847/libcloud/__init__.py -- diff --git a/libcloud/__init__.py b/libcloud/__init__.py index eea2bbb..4c42e91 100644 --- a/libcloud/__init__.py +++ b/libcloud/__init__.py @@ -21,24 +21,9 @@ libcloud provides a unified interface to the cloud computing resources. import os import codecs -from libcloud.backup.providers import Provider as BackupProvider -from libcloud.backup.providers import get_driver as get_backup_driver - -from libcloud.compute.providers import Provider as ComputeProvider -from libcloud.compute.providers import get_driver as get_compute_driver - -from libcloud.container.providers import Provider as ContainerProvider -from libcloud.container.providers import get_driver as get_container_driver - -from libcloud.dns.providers import Provider as DnsProvider -from libcloud.dns.providers import get_driver as get_dns_driver - -from libcloud.loadbalancer.providers import Provider as LoadBalancerProvider -from libcloud.loadbalancer.providers import get_driver as \ -get_loadbalancer_driver - -from libcloud.storage.providers import Provider as StorageProvider -from libcloud.storage.providers import get_driver as get_storage_driver +from libcloud.base import DriverType # NOQA +from libcloud.base import DriverTypeFactoryMap # NOQA +from libcloud.base import get_driver # NOQA __all__ = ['__version__', 'enable_debug'] @@ -94,40 +79,3 @@ def _init_once(): paramiko.common.logging.basicConfig(level=paramiko.common.DEBUG) _init_once() - - -class DriverType: -""" Backup-as-a-service driver """ -BACKUP = BackupProvider - -""" Compute-as-a-Service driver """ -COMPUTE = ComputeProvider - -""" Container-as-a-Service driver """ -CONTAINER = ContainerProvider - -""" DNS service provider driver """ -DNS = DnsProvider - -""" Load balancer provider-driver """ -LOADBALANCER = LoadBalancerProvider - -""" Storage-as-a-Service driver """ -STORAGE = StorageProvider - - -DriverTypeFactoryMap = { -DriverType.BACKUP: get_backup_driver, -DriverType.COMPUTE: get_compute_driver, -DriverType.CONTAINER: get_container_driver, -DriverType.DNS: get_dns_driver, -DriverType.LOADBALANCER: get_loadbalancer_driver, -DriverType.STORAGE: get_storage_driver -} - - -def get_driver(type, provider): -""" -Get a driver -""" -return DriverTypeFactoryMap[type](provider) http://git-wip-us.apache.org/repos/asf/libcloud/blob/7a1bb847/libcloud/base.py -- diff --git a/libcloud/base.py b/libcloud/base.py new file mode 100644 index 000..6491f98 --- /dev/null +++ b/libcloud/base.py @@ -0,0 +1,81 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from libcloud.backup.providers import Provider as BackupProvider +from libcloud.backup.providers import get_driver as get_backup_driver + +from libcloud.compute.providers import Provider as ComputeProvider +from libcloud.compute.providers import get_driver as get_compute_driver + +from libcloud.container.providers import Provider as ContainerProvider +from libcloud.container.providers import get_driver as get_container_driver + +from libcloud.dns.providers import Provider as
[jira] [Commented] (LIBCLOUD-858) Unable to list nodes with Libvirt provider on Python 3
[ https://issues.apache.org/jira/browse/LIBCLOUD-858?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15559578#comment-15559578 ] ASF subversion and git services commented on LIBCLOUD-858: -- Commit f5ff0cfb080b767b542e9deec5ecc34dedcb4f0c in libcloud's branch refs/heads/trunk from [~femnad] [ https://git-wip-us.apache.org/repos/asf?p=libcloud.git;h=f5ff0cf ] LIBCLOUD-858: Fix Listing Libvirt Nodes with Python 3 Closes #894 > Unable to list nodes with Libvirt provider on Python 3 > -- > > Key: LIBCLOUD-858 > URL: https://issues.apache.org/jira/browse/LIBCLOUD-858 > Project: Libcloud > Issue Type: Bug > Components: Compute > Environment: Ubuntu 16.04.1 LTS > Python 3.5.2 > Libcloud installed from 1a836148250ebf852a7f28e4d93007417ee7639d >Reporter: Fahri Cihan Demirci > > Using the {{list_nodes}} methods of the Libvirt provider driver results in an > error when using Python 3. A simple script to trigger this is as follows: > {code} > from libcloud.compute.providers import get_driver > from libcloud.compute.types import Provider > cls = get_driver(Provider.LIBVIRT) > driver = cls('qemu:///system') > nodes = driver.list_nodes() > {code} > It results in the following error: > {code} > Traceback (most recent call last): > File "libcloud_list_nodes.py", line 6, in > nodes = driver.list_nodes() > File > "/home/femnad/v/libcloud3-pristine/lib/python3.5/site-packages/apache_libcloud-1.2.1-py3.5.egg/libcloud/compute/drivers/libvirt_driver.py", > line 120, in list_nodes > nodes = self._to_nodes(domains=domains) > File > "/home/femnad/v/libcloud3-pristine/lib/python3.5/site-packages/apache_libcloud-1.2.1-py3.5.egg/libcloud/compute/drivers/libvirt_driver.py", > line 276, in _to_nodes > nodes = [self._to_node(domain=domain) for domain in domains] > File > "/home/femnad/v/libcloud3-pristine/lib/python3.5/site-packages/apache_libcloud-1.2.1-py3.5.egg/libcloud/compute/drivers/libvirt_driver.py", > line 276, in > nodes = [self._to_node(domain=domain) for domain in domains] > File > "/home/femnad/v/libcloud3-pristine/lib/python3.5/site-packages/apache_libcloud-1.2.1-py3.5.egg/libcloud/compute/drivers/libvirt_driver.py", > line 285, in _to_node > ip_addresses = self._get_ip_addresses_for_domain(domain) > File > "/home/femnad/v/libcloud3-pristine/lib/python3.5/site-packages/apache_libcloud-1.2.1-py3.5.egg/libcloud/compute/drivers/libvirt_driver.py", > line 333, in _get_ip_addresses_for_domain > arp_table = self._parse_ip_table_arp(arp_output=stdout) > File > "/home/femnad/v/libcloud3-pristine/lib/python3.5/site-packages/apache_libcloud-1.2.1-py3.5.egg/libcloud/compute/drivers/libvirt_driver.py", > line 410, in _parse_ip_table_arp > return self._parse_mac_addr_table(arp_output, arp_regex) > File > "/home/femnad/v/libcloud3-pristine/lib/python3.5/site-packages/apache_libcloud-1.2.1-py3.5.egg/libcloud/compute/drivers/libvirt_driver.py", > line 431, in _parse_mac_addr_table > lines = cmd_output.split('\n') > TypeError: a bytes-like object is required, not 'str' > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (LIBCLOUD-858) Unable to list nodes with Libvirt provider on Python 3
[ https://issues.apache.org/jira/browse/LIBCLOUD-858?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15559579#comment-15559579 ] ASF GitHub Bot commented on LIBCLOUD-858: - Github user asfgit closed the pull request at: https://github.com/apache/libcloud/pull/894 > Unable to list nodes with Libvirt provider on Python 3 > -- > > Key: LIBCLOUD-858 > URL: https://issues.apache.org/jira/browse/LIBCLOUD-858 > Project: Libcloud > Issue Type: Bug > Components: Compute > Environment: Ubuntu 16.04.1 LTS > Python 3.5.2 > Libcloud installed from 1a836148250ebf852a7f28e4d93007417ee7639d >Reporter: Fahri Cihan Demirci > > Using the {{list_nodes}} methods of the Libvirt provider driver results in an > error when using Python 3. A simple script to trigger this is as follows: > {code} > from libcloud.compute.providers import get_driver > from libcloud.compute.types import Provider > cls = get_driver(Provider.LIBVIRT) > driver = cls('qemu:///system') > nodes = driver.list_nodes() > {code} > It results in the following error: > {code} > Traceback (most recent call last): > File "libcloud_list_nodes.py", line 6, in > nodes = driver.list_nodes() > File > "/home/femnad/v/libcloud3-pristine/lib/python3.5/site-packages/apache_libcloud-1.2.1-py3.5.egg/libcloud/compute/drivers/libvirt_driver.py", > line 120, in list_nodes > nodes = self._to_nodes(domains=domains) > File > "/home/femnad/v/libcloud3-pristine/lib/python3.5/site-packages/apache_libcloud-1.2.1-py3.5.egg/libcloud/compute/drivers/libvirt_driver.py", > line 276, in _to_nodes > nodes = [self._to_node(domain=domain) for domain in domains] > File > "/home/femnad/v/libcloud3-pristine/lib/python3.5/site-packages/apache_libcloud-1.2.1-py3.5.egg/libcloud/compute/drivers/libvirt_driver.py", > line 276, in > nodes = [self._to_node(domain=domain) for domain in domains] > File > "/home/femnad/v/libcloud3-pristine/lib/python3.5/site-packages/apache_libcloud-1.2.1-py3.5.egg/libcloud/compute/drivers/libvirt_driver.py", > line 285, in _to_node > ip_addresses = self._get_ip_addresses_for_domain(domain) > File > "/home/femnad/v/libcloud3-pristine/lib/python3.5/site-packages/apache_libcloud-1.2.1-py3.5.egg/libcloud/compute/drivers/libvirt_driver.py", > line 333, in _get_ip_addresses_for_domain > arp_table = self._parse_ip_table_arp(arp_output=stdout) > File > "/home/femnad/v/libcloud3-pristine/lib/python3.5/site-packages/apache_libcloud-1.2.1-py3.5.egg/libcloud/compute/drivers/libvirt_driver.py", > line 410, in _parse_ip_table_arp > return self._parse_mac_addr_table(arp_output, arp_regex) > File > "/home/femnad/v/libcloud3-pristine/lib/python3.5/site-packages/apache_libcloud-1.2.1-py3.5.egg/libcloud/compute/drivers/libvirt_driver.py", > line 431, in _parse_mac_addr_table > lines = cmd_output.split('\n') > TypeError: a bytes-like object is required, not 'str' > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[GitHub] libcloud pull request #894: LIBCLOUD-858: Fix Listing Libvirt Nodes with Pyt...
Github user asfgit closed the pull request at: https://github.com/apache/libcloud/pull/894 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[1/2] libcloud git commit: LIBCLOUD-858: Fix Listing Libvirt Nodes with Python 3
Repository: libcloud Updated Branches: refs/heads/trunk 1a8361482 -> a64b0eacd LIBCLOUD-858: Fix Listing Libvirt Nodes with Python 3 Closes #894 Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/f5ff0cfb Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/f5ff0cfb Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/f5ff0cfb Branch: refs/heads/trunk Commit: f5ff0cfb080b767b542e9deec5ecc34dedcb4f0c Parents: 1a83614 Author: Fahri Cihan DemirciAuthored: Sun Oct 9 02:15:10 2016 -0400 Committer: Anthony Shaw Committed: Sun Oct 9 19:23:04 2016 +1100 -- libcloud/compute/drivers/libvirt_driver.py | 3 ++- libcloud/test/compute/test_libvirt_driver.py | 6 ++ 2 files changed, 8 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/libcloud/blob/f5ff0cfb/libcloud/compute/drivers/libvirt_driver.py -- diff --git a/libcloud/compute/drivers/libvirt_driver.py b/libcloud/compute/drivers/libvirt_driver.py index 13b0c95..c6f168f 100644 --- a/libcloud/compute/drivers/libvirt_driver.py +++ b/libcloud/compute/drivers/libvirt_driver.py @@ -33,6 +33,7 @@ from libcloud.compute.base import NodeDriver, Node from libcloud.compute.base import NodeState from libcloud.compute.types import Provider from libcloud.utils.networking import is_public_subnet +from libcloud.utils.py3 import ensure_string try: import libvirt @@ -428,7 +429,7 @@ class LibvirtNodeDriver(NodeDriver): :return: Dictionary which maps mac address to IP address. :rtype: ``dict`` """ -lines = cmd_output.split('\n') +lines = ensure_string(cmd_output).split('\n') arp_table = defaultdict(list) for line in lines: http://git-wip-us.apache.org/repos/asf/libcloud/blob/f5ff0cfb/libcloud/test/compute/test_libvirt_driver.py -- diff --git a/libcloud/test/compute/test_libvirt_driver.py b/libcloud/test/compute/test_libvirt_driver.py index 0cfd517..a9f6b9c 100644 --- a/libcloud/test/compute/test_libvirt_driver.py +++ b/libcloud/test/compute/test_libvirt_driver.py @@ -19,6 +19,7 @@ import mock from libcloud.compute.drivers.libvirt_driver import LibvirtNodeDriver from libcloud.compute.drivers.libvirt_driver import have_libvirt +from libcloud.utils.py3 import PY3 from libcloud.test import unittest @@ -42,6 +43,11 @@ class LibvirtNodeDriverTestCase(unittest.TestCase): 1.2.10.33 dev br0 lladdr 52:54:00:04:89:51 REACHABLE 1.2.10.97 dev br0 lladdr 1.2.10.40 dev br0 lladdr 52:54:00:77:1c:83 STALE""" +if PY3: +from libcloud.utils.py3 import b +arp_output_str = b(arp_output_str) +ip_output_str = b(ip_output_str) +bad_output_str = b(bad_output_str) def _assert_arp_table(self, arp_table): self.assertIn('52:54:00:bc:f9:6c', arp_table)
[jira] [Commented] (LIBCLOUD-858) Unable to list nodes with Libvirt provider on Python 3
[ https://issues.apache.org/jira/browse/LIBCLOUD-858?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15559390#comment-15559390 ] ASF GitHub Bot commented on LIBCLOUD-858: - GitHub user femnad opened a pull request: https://github.com/apache/libcloud/pull/894 LIBCLOUD-858: Fix Listing Libvirt Nodes with Python 3 ## Fix Listing Libvirt Nodes with Python 3 ### Description Listing nodes with the `Libvirt` provider fails on Python 3 because of a `split` operation on a `bytes` object where the delimiter is not a `bytes` object. Use the `ensure_string` function from the `py3` module to ensure that the output of a `subprocess.Popen` call is always a string for Python 2 and 3. Also add a test to convert the mock command output results to `bytes` objects if the active Python version is 3. ### Status - done, ready for review ### Checklist (tick everything that applies) - [ ] [Code linting](http://libcloud.readthedocs.org/en/latest/development.html#code-style-guide) (required, can be done after the PR checks) - [ ] Documentation - [ ] [Tests](http://libcloud.readthedocs.org/en/latest/testing.html) - [ ] [ICLA](http://libcloud.readthedocs.org/en/latest/development.html#contributing-bigger-changes) (required for bigger changes) You can merge this pull request into a Git repository by running: $ git pull https://github.com/femnad/libcloud LIBCLOUD-858_fix-libvirt-node-listing-with-python-3 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/libcloud/pull/894.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #894 commit 9c01bf6eb970eb3ba315d135ffd6fb5ee7b45b7e Author: Fahri Cihan DemirciDate: 2016-10-09T06:15:10Z LIBCLOUD-858: Fix Listing Libvirt Nodes with Python 3 > Unable to list nodes with Libvirt provider on Python 3 > -- > > Key: LIBCLOUD-858 > URL: https://issues.apache.org/jira/browse/LIBCLOUD-858 > Project: Libcloud > Issue Type: Bug > Components: Compute > Environment: Ubuntu 16.04.1 LTS > Python 3.5.2 > Libcloud installed from 1a836148250ebf852a7f28e4d93007417ee7639d >Reporter: Fahri Cihan Demirci > > Using the {{list_nodes}} methods of the Libvirt provider driver results in an > error when using Python 3. A simple script to trigger this is as follows: > {code} > from libcloud.compute.providers import get_driver > from libcloud.compute.types import Provider > cls = get_driver(Provider.LIBVIRT) > driver = cls('qemu:///system') > nodes = driver.list_nodes() > {code} > It results in the following error: > {code} > Traceback (most recent call last): > File "libcloud_list_nodes.py", line 6, in > nodes = driver.list_nodes() > File > "/home/femnad/v/libcloud3-pristine/lib/python3.5/site-packages/apache_libcloud-1.2.1-py3.5.egg/libcloud/compute/drivers/libvirt_driver.py", > line 120, in list_nodes > nodes = self._to_nodes(domains=domains) > File > "/home/femnad/v/libcloud3-pristine/lib/python3.5/site-packages/apache_libcloud-1.2.1-py3.5.egg/libcloud/compute/drivers/libvirt_driver.py", > line 276, in _to_nodes > nodes = [self._to_node(domain=domain) for domain in domains] > File > "/home/femnad/v/libcloud3-pristine/lib/python3.5/site-packages/apache_libcloud-1.2.1-py3.5.egg/libcloud/compute/drivers/libvirt_driver.py", > line 276, in > nodes = [self._to_node(domain=domain) for domain in domains] > File > "/home/femnad/v/libcloud3-pristine/lib/python3.5/site-packages/apache_libcloud-1.2.1-py3.5.egg/libcloud/compute/drivers/libvirt_driver.py", > line 285, in _to_node > ip_addresses = self._get_ip_addresses_for_domain(domain) > File > "/home/femnad/v/libcloud3-pristine/lib/python3.5/site-packages/apache_libcloud-1.2.1-py3.5.egg/libcloud/compute/drivers/libvirt_driver.py", > line 333, in _get_ip_addresses_for_domain > arp_table = self._parse_ip_table_arp(arp_output=stdout) > File > "/home/femnad/v/libcloud3-pristine/lib/python3.5/site-packages/apache_libcloud-1.2.1-py3.5.egg/libcloud/compute/drivers/libvirt_driver.py", > line 410, in _parse_ip_table_arp > return self._parse_mac_addr_table(arp_output, arp_regex) > File > "/home/femnad/v/libcloud3-pristine/lib/python3.5/site-packages/apache_libcloud-1.2.1-py3.5.egg/libcloud/compute/drivers/libvirt_driver.py", > line 431, in _parse_mac_addr_table > lines = cmd_output.split('\n') > TypeError: a bytes-like object is required, not 'str' > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[GitHub] libcloud pull request #894: LIBCLOUD-858: Fix Listing Libvirt Nodes with Pyt...
GitHub user femnad opened a pull request: https://github.com/apache/libcloud/pull/894 LIBCLOUD-858: Fix Listing Libvirt Nodes with Python 3 ## Fix Listing Libvirt Nodes with Python 3 ### Description Listing nodes with the `Libvirt` provider fails on Python 3 because of a `split` operation on a `bytes` object where the delimiter is not a `bytes` object. Use the `ensure_string` function from the `py3` module to ensure that the output of a `subprocess.Popen` call is always a string for Python 2 and 3. Also add a test to convert the mock command output results to `bytes` objects if the active Python version is 3. ### Status - done, ready for review ### Checklist (tick everything that applies) - [ ] [Code linting](http://libcloud.readthedocs.org/en/latest/development.html#code-style-guide) (required, can be done after the PR checks) - [ ] Documentation - [ ] [Tests](http://libcloud.readthedocs.org/en/latest/testing.html) - [ ] [ICLA](http://libcloud.readthedocs.org/en/latest/development.html#contributing-bigger-changes) (required for bigger changes) You can merge this pull request into a Git repository by running: $ git pull https://github.com/femnad/libcloud LIBCLOUD-858_fix-libvirt-node-listing-with-python-3 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/libcloud/pull/894.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #894 commit 9c01bf6eb970eb3ba315d135ffd6fb5ee7b45b7e Author: Fahri Cihan DemirciDate: 2016-10-09T06:15:10Z LIBCLOUD-858: Fix Listing Libvirt Nodes with Python 3 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---