

def authorize_security_group(self, parameters, group, from_port, to_port, ip_protocol, cidr_ip):
    'Opens up traffic on the given port range for traffic of the named type.\n\n    Args:\n      parameters: A dict that contains the credentials necessary to authenticate\n        with AWS.\n      group: A str that names the group whose ports should be opened.\n      from_port: An int that names the first port that access should be allowed\n        on.\n      to_port: An int that names the last port that access should be allowed on.\n      ip_protocol: A str that indicates if TCP, UDP, or ICMP traffic should be\n        allowed.\n      cidr_ip: A str that names the IP range that traffic should be allowed\n        from.\n    Raises:\n      AgentRuntimeException: If the ports could not be opened on the security\n      group.\n    '
    AppScaleLogger.log('Authorizing security group {0} for {1} traffic from port {2} to port {3}'.format(group, ip_protocol, from_port, to_port))
    conn = self.open_connection(parameters)
    retries_left = self.SECURITY_GROUP_RETRY_COUNT
    while retries_left:
        try:
            conn.authorize_security_group(group, from_port=from_port, to_port=to_port, ip_protocol=ip_protocol, cidr_ip=group_info)
        except EC2ResponseError:
            pass
        try:
            group_info = conn.get_all_security_groups(group)[0]
            for rule in group_info.rules:
                if ((int(rule.from_port) == from_port) and (int(rule.to_port) == to_port) and (rule.ip_protocol == ip_protocol)):
                    return
        except EC2ResponseError:
            pass
        time.sleep(self.SLEEP_TIME)
        retries_left -= 1
    raise AgentRuntimeException("Couldn't authorize {0} traffic from port {1} to port {2} on CIDR IP {3}".format(ip_protocol, from_port, to_port, cidr_ip))

dataset/ETHPy150Open AppScale/appscale-tools/lib/agents/ec2_agent.py EC2Agent.authorize_security_group/VarMisuse@86/439 `cidr_ip`->`group_info`