mirror of
https://github.com/ansible/awx.git
synced 2026-05-21 15:57:52 -02:30
Updated all vendored third-party packages.
This commit is contained in:
@@ -17,7 +17,6 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import datetime
|
||||
from functools import wraps
|
||||
|
||||
import pyrax
|
||||
@@ -464,6 +463,48 @@ class CloudLoadBalancerManager(BaseManager):
|
||||
raise exc.InvalidLoadBalancerParameters(errmsg)
|
||||
return resp, resp_body
|
||||
|
||||
|
||||
def _create_body(self, name, port=None, protocol=None, nodes=None,
|
||||
virtual_ips=None, algorithm=None, halfClosed=None, accessList=None,
|
||||
connectionLogging=None, connectionThrottle=None, healthMonitor=None,
|
||||
metadata=None, timeout=None, sessionPersistence=None):
|
||||
"""
|
||||
Used to create the dict required to create a load balancer instance.
|
||||
"""
|
||||
required = (virtual_ips, port, protocol)
|
||||
if not all(required):
|
||||
raise exc.MissingLoadBalancerParameters("Load Balancer creation "
|
||||
"requires at least one virtual IP, a protocol, and a port.")
|
||||
nodes = utils.coerce_string_to_list(nodes)
|
||||
virtual_ips = utils.coerce_string_to_list(virtual_ips)
|
||||
bad_conditions = [node.condition for node in nodes
|
||||
if node.condition.upper() not in ("ENABLED", "DISABLED")]
|
||||
if bad_conditions:
|
||||
raise exc.InvalidNodeCondition("Nodes for new load balancer must be "
|
||||
"created in either 'ENABLED' or 'DISABLED' condition; "
|
||||
"received the following invalid conditions: %s" %
|
||||
", ".join(set(bad_conditions)))
|
||||
node_dicts = [nd.to_dict() for nd in nodes]
|
||||
vip_dicts = [vip.to_dict() for vip in virtual_ips]
|
||||
body = {"loadBalancer": {
|
||||
"name": name,
|
||||
"port": port,
|
||||
"protocol": protocol,
|
||||
"nodes": node_dicts,
|
||||
"virtualIps": vip_dicts,
|
||||
"algorithm": algorithm or "RANDOM",
|
||||
"halfClosed": halfClosed,
|
||||
"accessList": accessList,
|
||||
"connectionLogging": connectionLogging,
|
||||
"connectionThrottle": connectionThrottle,
|
||||
"healthMonitor": healthMonitor,
|
||||
"metadata": metadata,
|
||||
"timeout": timeout,
|
||||
"sessionPersistence": sessionPersistence,
|
||||
}}
|
||||
return body
|
||||
|
||||
|
||||
def add_nodes(self, lb, nodes):
|
||||
"""Adds the list of nodes to the specified load balancer."""
|
||||
if not isinstance(nodes, (list, tuple)):
|
||||
@@ -491,7 +532,6 @@ class CloudLoadBalancerManager(BaseManager):
|
||||
if not lb:
|
||||
raise exc.UnattachedNode("No parent Load Balancer for this node "
|
||||
"could be determined.")
|
||||
|
||||
if diff is None:
|
||||
diff = node._diff()
|
||||
req_body = {"node": diff}
|
||||
@@ -1047,6 +1087,7 @@ class Node(object):
|
||||
return {"address": self.address,
|
||||
"port": self.port,
|
||||
"condition": self.condition,
|
||||
"type": self.type,
|
||||
}
|
||||
|
||||
|
||||
@@ -1156,8 +1197,9 @@ class VirtualIP(object):
|
||||
Convert this VirtualIP to a dict representation for passing
|
||||
to the API.
|
||||
"""
|
||||
return {"type": self.type,
|
||||
"ipVersion": self.ip_version}
|
||||
if self.id:
|
||||
return {"id": self.id}
|
||||
return {"type": self.type, "ipVersion": self.ip_version}
|
||||
|
||||
|
||||
@assure_parent
|
||||
@@ -1192,48 +1234,6 @@ class CloudLoadBalancerClient(BaseClient):
|
||||
response_key="loadBalancer", uri_base="loadbalancers")
|
||||
|
||||
|
||||
def _create_body(self, name, port=None, protocol=None, nodes=None,
|
||||
virtual_ips=None, algorithm=None, halfClosed=None, accessList=None,
|
||||
connectionLogging=None, connectionThrottle=None, healthMonitor=None,
|
||||
metadata=None, timeout=None, sessionPersistence=None):
|
||||
"""
|
||||
Used to create the dict required to create a load balancer instance.
|
||||
"""
|
||||
required = (nodes, virtual_ips, port, protocol)
|
||||
if not all(required):
|
||||
raise exc.MissingLoadBalancerParameters("Load Balancer creation "
|
||||
"requires at least one node, one virtual IP, "
|
||||
"a protocol, and a port.")
|
||||
nodes = utils.coerce_string_to_list(nodes)
|
||||
virtual_ips = utils.coerce_string_to_list(virtual_ips)
|
||||
bad_conditions = [node.condition for node in nodes
|
||||
if node.condition.upper() not in ("ENABLED", "DISABLED")]
|
||||
if bad_conditions:
|
||||
raise exc.InvalidNodeCondition("Nodes for new load balancer must be "
|
||||
"created in either 'ENABLED' or 'DISABLED' condition; "
|
||||
"received the following invalid conditions: %s" %
|
||||
", ".join(set(bad_conditions)))
|
||||
node_dicts = [nd.to_dict() for nd in nodes]
|
||||
vip_dicts = [vip.to_dict() for vip in virtual_ips]
|
||||
body = {"loadBalancer": {
|
||||
"name": name,
|
||||
"port": port,
|
||||
"protocol": protocol,
|
||||
"nodes": node_dicts,
|
||||
"virtualIps": vip_dicts,
|
||||
"algorithm": algorithm or "RANDOM",
|
||||
"halfClosed": halfClosed,
|
||||
"accessList": accessList,
|
||||
"connectionLogging": connectionLogging,
|
||||
"connectionThrottle": connectionThrottle,
|
||||
"healthMonitor": healthMonitor,
|
||||
"metadata": metadata,
|
||||
"timeout": timeout,
|
||||
"sessionPersistence": sessionPersistence,
|
||||
}}
|
||||
return body
|
||||
|
||||
|
||||
def get_usage(self, loadbalancer=None, start=None, end=None):
|
||||
"""
|
||||
Return the load balancer usage records for this account. If 'loadbalancer'
|
||||
|
||||
Reference in New Issue
Block a user