Skip to content

Commit

Permalink
Merge branch 'trunk' into dependabot/github_actions/actions/setup-dot…
Browse files Browse the repository at this point in the history
…net-4.0.0
  • Loading branch information
Kami authored Apr 14, 2024
2 parents b668d38 + 637c2ac commit c618f17
Show file tree
Hide file tree
Showing 19 changed files with 101 additions and 127 deletions.
1 change: 0 additions & 1 deletion libcloud/common/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@


class BaseHTTPError(Exception):

"""
The base exception class for all HTTP related exceptions.
"""
Expand Down
1 change: 0 additions & 1 deletion libcloud/common/openstack.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@


class OpenStackBaseConnection(ConnectionUserAndKey):

"""
Base class for OpenStack connections.
Expand Down
5 changes: 0 additions & 5 deletions libcloud/compute/drivers/azure.py
Original file line number Diff line number Diff line change
Expand Up @@ -2577,7 +2577,6 @@ def extended_properties_dict_to_xml_fragment(extended_properties):


class WindowsAzureData:

"""
This is the base of data class.
It is only used to check whether it is instance or not.
Expand Down Expand Up @@ -2674,7 +2673,6 @@ def __init__(self):


class CertificateSetting(WindowsAzureData):

"""
Initializes a certificate setting.
Expand Down Expand Up @@ -3141,7 +3139,6 @@ class _Base64String(str):


class _ListOf(list):

"""
A list which carries with it the type that's expected to go in it.
Used for deserializaion and construction of the lists
Expand All @@ -3157,7 +3154,6 @@ def __init__(self, list_type, xml_element_name=None):


class ScalarListOf(list):

"""
A list of scalar types which carries with it the type that's
expected to go in it along with its xml element name.
Expand All @@ -3171,7 +3167,6 @@ def __init__(self, list_type, xml_element_name):


class _DictOf(dict):

"""
A dict which carries with it the xml element names for key,val.
Used for deserializaion and construction of the lists
Expand Down
70 changes: 35 additions & 35 deletions libcloud/compute/drivers/dimensiondata.py
Original file line number Diff line number Diff line change
Expand Up @@ -648,9 +648,9 @@ def create_node(
ET.SubElement(additional_nic, "vlanId").text = vlan_id

if nic.network_adapter_name is not None:
ET.SubElement(
additional_nic, "networkAdapter"
).text = nic.network_adapter_name
ET.SubElement(additional_nic, "networkAdapter").text = (
nic.network_adapter_name
)
elif ex_additional_nics is not None:
raise TypeError("ex_additional_NICs must be None or tuple/list")

Expand Down Expand Up @@ -955,9 +955,9 @@ def import_image(
ET.SubElement(import_image_elem, "urn:datacenterId").text = datacenter_id

if is_guest_os_customization is not None:
ET.SubElement(
import_image_elem, "urn:guestOsCustomization"
).text = is_guest_os_customization
ET.SubElement(import_image_elem, "urn:guestOsCustomization").text = (
is_guest_os_customization
)

if len(tagkey_name_value_dictionaries) > 0:
for k, v in tagkey_name_value_dictionaries.items():
Expand Down Expand Up @@ -1847,9 +1847,9 @@ def ex_create_firewall_rule(
positions_with_rule = ("BEFORE", "AFTER")

create_node = ET.Element("createFirewallRule", {"xmlns": TYPES_URN})
ET.SubElement(
create_node, "networkDomainId"
).text = self._network_domain_to_network_domain_id(network_domain)
ET.SubElement(create_node, "networkDomainId").text = (
self._network_domain_to_network_domain_id(network_domain)
)
ET.SubElement(create_node, "name").text = rule.name
ET.SubElement(create_node, "action").text = rule.action
ET.SubElement(create_node, "ipVersion").text = rule.ip_version
Expand Down Expand Up @@ -2514,9 +2514,9 @@ def ex_clone_node_to_image(
ET.SubElement(clone_server_elem, "clusterId").text = cluster_id

if is_guest_Os_Customization is not None:
ET.SubElement(
clone_server_elem, "guestOsCustomization"
).text = is_guest_Os_Customization
ET.SubElement(clone_server_elem, "guestOsCustomization").text = (
is_guest_Os_Customization
)

if tag_key_id is not None:
tag_elem = ET.SubElement(clone_server_elem, "tagById")
Expand Down Expand Up @@ -3179,9 +3179,9 @@ def ex_create_ip_address_list(
)

create_ip_address_list = ET.Element("createIpAddressList", {"xmlns": TYPES_URN})
ET.SubElement(
create_ip_address_list, "networkDomainId"
).text = self._network_domain_to_network_domain_id(ex_network_domain)
ET.SubElement(create_ip_address_list, "networkDomainId").text = (
self._network_domain_to_network_domain_id(ex_network_domain)
)

ET.SubElement(create_ip_address_list, "name").text = name

Expand All @@ -3203,9 +3203,9 @@ def ex_create_ip_address_list(
ip_address.set("prefixSize", ip.prefix_size)

if child_ip_address_list is not None:
ET.SubElement(
create_ip_address_list, "childIpAddressListId"
).text = self._child_ip_address_list_to_child_ip_address_list_id(child_ip_address_list)
ET.SubElement(create_ip_address_list, "childIpAddressListId").text = (
self._child_ip_address_list_to_child_ip_address_list_id(child_ip_address_list)
)

response = self.connection.request_with_orgId_api_2(
"network/createIpAddressList",
Expand Down Expand Up @@ -3301,9 +3301,9 @@ def ex_edit_ip_address_list(
ip_address.set("prefixSize", ip.prefix_size)

if child_ip_address_lists is not None:
ET.SubElement(
edit_ip_address_list, "childIpAddressListId"
).text = self._child_ip_address_list_to_child_ip_address_list_id(child_ip_address_lists)
ET.SubElement(edit_ip_address_list, "childIpAddressListId").text = (
self._child_ip_address_list_to_child_ip_address_list_id(child_ip_address_lists)
)
else:
ET.SubElement(edit_ip_address_list, "childIpAddressListId", {"xsi:nil": "true"})

Expand Down Expand Up @@ -3499,9 +3499,9 @@ def ex_create_portlist(
:rtype: ``bool``
"""
new_port_list = ET.Element("createPortList", {"xmlns": TYPES_URN})
ET.SubElement(
new_port_list, "networkDomainId"
).text = self._network_domain_to_network_domain_id(ex_network_domain)
ET.SubElement(new_port_list, "networkDomainId").text = (
self._network_domain_to_network_domain_id(ex_network_domain)
)

ET.SubElement(new_port_list, "name").text = name

Expand All @@ -3516,9 +3516,9 @@ def ex_create_portlist(

if child_portlist_list is not None:
for child in child_portlist_list:
ET.SubElement(
new_port_list, "childPortListId"
).text = self._child_port_list_to_child_port_list_id(child)
ET.SubElement(new_port_list, "childPortListId").text = (
self._child_port_list_to_child_port_list_id(child)
)

response = self.connection.request_with_orgId_api_2(
"network/createPortList", method="POST", data=ET.tostring(new_port_list)
Expand Down Expand Up @@ -3599,9 +3599,9 @@ def ex_edit_portlist(self, ex_portlist, description, port_collection, child_port

if child_portlist_list is not None:
for child in child_portlist_list:
ET.SubElement(
existing_port_address_list, "childPortListId"
).text = self._child_port_list_to_child_port_list_id(child)
ET.SubElement(existing_port_address_list, "childPortListId").text = (
self._child_port_list_to_child_port_list_id(child)
)
else:
ET.SubElement(existing_port_address_list, "childPortListId", {"xsi:nil": "true"})

Expand Down Expand Up @@ -4367,11 +4367,11 @@ def _to_node(self, element):
"description": findtext(element, "description", TYPES_URN),
"sourceImageId": findtext(element, "sourceImageId", TYPES_URN),
"networkId": findtext(element, "networkId", TYPES_URN),
"networkDomainId": element.find(fixxpath("networkInfo", TYPES_URN)).get(
"networkDomainId"
)
if has_network_info
else None,
"networkDomainId": (
element.find(fixxpath("networkInfo", TYPES_URN)).get("networkDomainId")
if has_network_info
else None
),
"datacenterId": element.get("datacenterId"),
"deployedTime": findtext(element, "createTime", TYPES_URN),
"cpu": cpu_spec,
Expand Down
1 change: 0 additions & 1 deletion libcloud/compute/drivers/ecs.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ def __repr__(self):


class ECSSecurityGroupAttribute:

"""
Security group attribute.
"""
Expand Down
6 changes: 3 additions & 3 deletions libcloud/compute/drivers/equinixmetal.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ def add_default_headers(self, headers):
"""
headers["Content-Type"] = "application/json"
headers["X-Auth-Token"] = self.key
headers[
"X-Consumer-Token"
] = "kcrhMn7hwG8Ceo2hAhGFa2qpxLBvVHxEjS9ue8iqmsNkeeB2iQgMq4dNc1893pYu"
headers["X-Consumer-Token"] = (
"kcrhMn7hwG8Ceo2hAhGFa2qpxLBvVHxEjS9ue8iqmsNkeeB2iQgMq4dNc1893pYu"
)

return headers

Expand Down
82 changes: 42 additions & 40 deletions libcloud/compute/drivers/nttcis.py
Original file line number Diff line number Diff line change
Expand Up @@ -652,9 +652,9 @@ def create_node(
ET.SubElement(additional_nic, "vlanId").text = vlan_id

if nic.network_adapter_name is not None:
ET.SubElement(
additional_nic, "networkAdapter"
).text = nic.network_adapter_name
ET.SubElement(additional_nic, "networkAdapter").text = (
nic.network_adapter_name
)
elif ex_additional_nics is not None:
raise TypeError("ex_additional_NICs must be None or tuple/list")

Expand Down Expand Up @@ -1004,9 +1004,9 @@ def import_image(
ET.SubElement(import_image_elem, "urn:datacenterId").text = datacenter_id

if is_guest_os_customization is not None:
ET.SubElement(
import_image_elem, "urn:guestOsCustomization"
).text = is_guest_os_customization
ET.SubElement(import_image_elem, "urn:guestOsCustomization").text = (
is_guest_os_customization
)

if (
tagkey_name_value_dictionaries is not None
Expand Down Expand Up @@ -2273,9 +2273,9 @@ def ex_create_firewall_rule(
positions_with_rule = ("BEFORE", "AFTER")

create_node = ET.Element("createFirewallRule", {"xmlns": TYPES_URN})
ET.SubElement(
create_node, "networkDomainId"
).text = self._network_domain_to_network_domain_id(network_domain)
ET.SubElement(create_node, "networkDomainId").text = (
self._network_domain_to_network_domain_id(network_domain)
)
ET.SubElement(create_node, "name").text = name
ET.SubElement(create_node, "action").text = action
ET.SubElement(create_node, "ipVersion").text = ip_version
Expand Down Expand Up @@ -3032,9 +3032,9 @@ def ex_clone_node_to_image(
ET.SubElement(clone_server_elem, "clusterId").text = cluster_id

if is_guest_Os_Customization is not None:
ET.SubElement(
clone_server_elem, "guestOsCustomization"
).text = is_guest_Os_Customization
ET.SubElement(clone_server_elem, "guestOsCustomization").text = (
is_guest_Os_Customization
)

if tag_key_id is not None:
tag_elem = ET.SubElement(clone_server_elem, "tagById")
Expand Down Expand Up @@ -3724,9 +3724,9 @@ def ex_create_ip_address_list(
)

create_ip_address_list = ET.Element("createIpAddressList", {"xmlns": TYPES_URN})
ET.SubElement(
create_ip_address_list, "networkDomainId"
).text = self._network_domain_to_network_domain_id(ex_network_domain)
ET.SubElement(create_ip_address_list, "networkDomainId").text = (
self._network_domain_to_network_domain_id(ex_network_domain)
)

ET.SubElement(create_ip_address_list, "name").text = name

Expand All @@ -3748,9 +3748,9 @@ def ex_create_ip_address_list(
ip_address.set("prefixSize", ip.prefix_size)

if child_ip_address_list is not None:
ET.SubElement(
create_ip_address_list, "childIpAddressListId"
).text = self._child_ip_address_list_to_child_ip_address_list_id(child_ip_address_list)
ET.SubElement(create_ip_address_list, "childIpAddressListId").text = (
self._child_ip_address_list_to_child_ip_address_list_id(child_ip_address_list)
)

response = self.connection.request_with_orgId_api_2(
"network/createIpAddressList",
Expand Down Expand Up @@ -3851,9 +3851,9 @@ def ex_edit_ip_address_list(
ip_address.set("prefixSize", ip.prefix_size)

if child_ip_address_lists is not None:
ET.SubElement(
edit_ip_address_list, "childIpAddressListId"
).text = self._child_ip_address_list_to_child_ip_address_list_id(child_ip_address_lists)
ET.SubElement(edit_ip_address_list, "childIpAddressListId").text = (
self._child_ip_address_list_to_child_ip_address_list_id(child_ip_address_lists)
)
else:
ET.SubElement(edit_ip_address_list, "childIpAddressListId", {"xsi:nil": "true"})

Expand Down Expand Up @@ -4051,9 +4051,9 @@ def ex_create_portlist(
"""

new_port_list = ET.Element("createPortList", {"xmlns": TYPES_URN})
ET.SubElement(
new_port_list, "networkDomainId"
).text = self._network_domain_to_network_domain_id(ex_network_domain)
ET.SubElement(new_port_list, "networkDomainId").text = (
self._network_domain_to_network_domain_id(ex_network_domain)
)

ET.SubElement(new_port_list, "name").text = name

Expand All @@ -4068,9 +4068,9 @@ def ex_create_portlist(

if child_portlist_list is not None:
for child in child_portlist_list:
ET.SubElement(
new_port_list, "childPortListId"
).text = self._child_port_list_to_child_port_list_id(child)
ET.SubElement(new_port_list, "childPortListId").text = (
self._child_port_list_to_child_port_list_id(child)
)

response = self.connection.request_with_orgId_api_2(
"network/createPortList", method="POST", data=ET.tostring(new_port_list)
Expand Down Expand Up @@ -4161,9 +4161,9 @@ def ex_edit_portlist(

if child_portlist_list is not None:
for child in child_portlist_list:
ET.SubElement(
existing_port_address_list, "childPortListId"
).text = self._child_port_list_to_child_port_list_id(child)
ET.SubElement(existing_port_address_list, "childPortListId").text = (
self._child_port_list_to_child_port_list_id(child)
)
else:
ET.SubElement(existing_port_address_list, "childPortListId", {"xsi:nil": "true"})

Expand Down Expand Up @@ -5290,19 +5290,21 @@ def _to_node(self, element):
"description": findtext(element, "description", TYPES_URN),
"sourceImageId": findtext(element, "sourceImageId", TYPES_URN),
"networkId": findtext(element, "networkId", TYPES_URN),
"networkDomainId": element.find(fixxpath("networkInfo", TYPES_URN)).get(
"networkDomainId"
)
if has_network_info
else None,
"networkDomainId": (
element.find(fixxpath("networkInfo", TYPES_URN)).get("networkDomainId")
if has_network_info
else None
),
"datacenterId": element.get("datacenterId"),
"deployedTime": findtext(element, "createTime", TYPES_URN),
"window": (
element.find(fixxpath("snapshotService/window", TYPES_URN)).get("dayOfWeek"),
element.find(fixxpath("snapshotService/window", TYPES_URN)).get("startHour"),
)
if has_snapshot
else None,
(
element.find(fixxpath("snapshotService/window", TYPES_URN)).get("dayOfWeek"),
element.find(fixxpath("snapshotService/window", TYPES_URN)).get("startHour"),
)
if has_snapshot
else None
),
"cpu": cpu_spec,
"memoryMb": int(findtext(element, "memoryGb", TYPES_URN)) * 1024,
"OS_id": operation_system.get("id"),
Expand Down
Loading

0 comments on commit c618f17

Please sign in to comment.