For each attached Elastic IP, disassociate it

        :return: None
        :raises AWSAPIError
765734
def disassociate_elastic_ips(self):
        
        log = logging.getLogger(self.cls_logger + '.disassociate_elastic_ips')

        try:
            address_info = self.get_elastic_ips()
        except AWSAPIError:
            _, ex, trace = sys.exc_info()
            msg = 'Unable to determine Elastic IPs on this EC2 instance'
            log.error(msg)
            raise AWSAPIError, msg, trace

        # Return is no elastic IPs were found
        if not address_info:
            log.info('No elastic IPs found to disassociate')
            return

        # Disassociate each Elastic IP
        for address in address_info['Addresses']:
            association_id = address['AssociationId']
            public_ip = address['PublicIp']
            log.info('Attempting to disassociate address {p} from Association ID: {a}'.format(
                    p=public_ip, a=association_id))
            try:
                self.client.disassociate_address(PublicIp=public_ip, AssociationId=association_id)
            except ClientError:
                _, ex, trace = sys.exc_info()
                msg = 'There was a problem disassociating Public IP {p} from Association ID {a}'.format(
                        p=public_ip, a=association_id)
                log.error(msg)
                raise AWSAPIError, msg, trace
            else:
                log.info('Successfully disassociated Public IP: {p}'.format(p=public_ip))
598934
def unstash_index(self, sync=False, branch=None):
        """"""

        stash_list = self.git_exec(['stash', 'list'], no_verbose=True)

        if branch is None:
            branch = self.get_current_branch_name()

        for stash in stash_list.splitlines():

            verb = 'syncing' if sync else 'switching'

            if (
                (('Legit' in stash) and
                 ('On {0}:'.format(branch) in stash) and
                 (verb in stash)
                 ) or
                (('GitHub' in stash) and
                 ('On {0}:'.format(branch) in stash) and
                 (verb in stash)
                 )
            ):
                return stash[7]
477716
def detachAcceptMsTerminated():
    """"""
    a = TpPd(pd=0x3)
    b = MessageType(mesType=0x6)  # 00000110
    packet = a / b
    return packet
484750
def delete_chain(self, chainname=None):
        
        args = ['-X']
        if chainname: args.append(chainname)
        self.__run_iptables(args)
662611
def delete_api(awsclient, api_name):
    
    _sleep()
    client_api = awsclient.get_client('apigateway')

    print('deleting api: %s' % api_name)
    api = _api_by_name(awsclient, api_name)

    if api is not None:
        print(json2table(api))

        response = client_api.delete_rest_api(
            restApiId=api['id']
        )

        print(json2table(response))
    else:
        print('API name unknown')
980012
def _disconnect_all_my_connectors(session, resource_name, reservation_id, logger):
        
        reservation_details = session.GetReservationDetails(reservation_id)
        connectors = reservation_details.ReservationDescription.Connectors
        endpoints = []
        for endpoint in connectors:
            if endpoint.Target == resource_name or endpoint.Source == resource_name:
                endpoints.append(endpoint.Target)
                endpoints.append(endpoint.Source)

        if len(endpoints) == 0:
            logger.info("No routes to disconnect for resource {0} in reservation {1}"
                        .format(resource_name, reservation_id))
            return

        logger.info("Executing disconnect routes for resource {0} in reservation {1}"
                    .format(resource_name, reservation_id))

        try:
            session.DisconnectRoutesInReservation(reservation_id, endpoints)
        except Exception as exc:
            logger.exception("Error disconnecting routes for resource {0} in reservation {1}. Error: {2}"
                             .format(resource_name, reservation_id, get_error_message_from_exception(exc)))
1172899
def HandleForwardedIps(self, interface, forwarded_ips, interface_ip=None):
    
    desired = self.ip_forwarding_utils.ParseForwardedIps(forwarded_ips)
    configured = self.ip_forwarding_utils.GetForwardedIps(
        interface, interface_ip)
    to_add = sorted(set(desired) - set(configured))
    to_remove = sorted(set(configured) - set(desired))
    self._LogForwardedIpChanges(
        configured, desired, to_add, to_remove, interface)
    self._AddForwardedIps(to_add, interface)
    self._RemoveForwardedIps(to_remove, interface)
1015785
def pipeline_delete(id, hosts=None, profile=None):
    '''
    
    '''
    es = _get_instance(hosts, profile)

    try:
        ret = es.ingest.delete_pipeline(id=id)
        return ret.get('acknowledged', False)
    except elasticsearch.NotFoundError:
        return True
    except elasticsearch.TransportError as e:
        raise CommandExecutionError("Cannot delete pipeline {0}, server returned code {1} with message {2}".format(id, e.status_code, e.error))
    except AttributeError:
        raise CommandExecutionError("Method is applicable only for Elasticsearch 5.0+")
872851
def geolocate(self, ip: str):
        
        url_path = "/api/geoloc/{ip}".format(ip=ip)
        return self._request_without_api(path=url_path)
1113529
def disassociate_hosting_device_with_config_agent(
            self, client, config_agent_id, hosting_device_id):
        """"""
        return client.delete((ConfigAgentHandlingHostingDevice.resource_path +
                              CFG_AGENT_HOSTING_DEVICES + "/%s") % (
            config_agent_id, hosting_device_id))
867414
def delete_image(self, image_id):

        '''
            
        '''

        title = '%s.delete_image' % self.__class__.__name__

    # validate inputs
        input_fields = {
            'image_id': image_id
        }
        for key, value in input_fields.items():
            object_title = '%s(%s=%s)' % (title, key, str(value))
            self.fields.validate(value, '.%s' % key, object_title)

    # report query
        self.iam.printer('Removing image %s from AWS region %s.' % (image_id, self.iam.region_name))

    # retrieve state
        old_state = self.check_image_state(image_id)

    # discover snapshot id and tags associated with instance id
        image_details = self.read_image(image_id)
        tag_list = image_details['tags']
        snapshot_id = image_details['snapshot_id']

    # remove tags from instance
        try:
            delete_kwargs = {
                'Resources': [ image_id ],
                'Tags': self.iam.prepare(tag_list)
            }
            self.connection.delete_tags(**delete_kwargs)
            self.iam.printer('Tags have been deleted from %s.' % image_id)
        except:
            raise AWSConnectionError(title)

    # deregister image
        try:
            self.connection.deregister_image(
                ImageId=image_id
            )
        except:
            raise AWSConnectionError(title)
        self.iam.printer('Image %s has been deregistered.' % image_id)

    # delete snapshot
        try:
            response = self.connection.delete_snapshot(
                SnapshotId=snapshot_id
            )
        except:
            raise AWSConnectionError(title)
        self.iam.printer('Snapshot %s associated with image %s has been deleted.' % (snapshot_id, image_id))

        return response
227466
def disconnect(self, ip, port):
        
        _check_valid_port_range(port)
        address = (ip, port)

        try:
            self._addresses.remove(address)
        except ValueError:
            error = 'There was no connection to {0} on port {1}'.format(ip, port)
            log.exception(error)
            raise ValueError(error)

        if self._is_ready:
            _disconnect_zmq_sock(self._sock, ip, port)

        return self
59658
def detach_remote(self, id, name):
        

        if name in self.widgets:
            if id in self.widgets[name]:
                del self.widgets[name]
407915
def Delete(self):
		

		self.public_ip.ports = [o for o in self.public_ip.ports if o!=self]

		return(self.public_ip.Update())
212177
def remove(self, address):
        
        with self.lock:
            for connection in self.connections.pop(address, ()):
                try:
                    connection.close()
                except IOError:
                    pass
1176833
def cleanup(self):

        '''
            
        '''

    # find non-running instances
        self.iam.printer('Cleaning up AWS region %s.' % self.iam.region_name)
        response = self.connection.describe_instances()
        instance_list = response['Reservations']
        for instance in instance_list:
            instance_info = instance['Instances'][0]
            if instance_info['State']['Name'] == 'pending':
                self.check_instance_state(instance_info['InstanceId'])
                response = self.connection.describe_instances(
                    InstanceIds=[ instance_info['InstanceId'] ]
                )
                instance_info = response['Reservations'][0]['Instances'][0]
            if instance_info['State']['Name'] != 'running':

    # try to remove tags associated with non-running instance
                try:
                    response = self.connection.describe_tags(
                        Filters=[ { 'Name': 'resource-id', 'Values': [ instance_info['InstanceId'] ] } ]
                    )
                    tag_list = []
                    import re
                    aws_tag_pattern = re.compile('aws:')
                    for i in range(0, len(response['Tags'])):
                        if not aws_tag_pattern.findall(response['Tags'][i]['Key']):
                            tag = {}
                            tag['Key'] = response['Tags'][i]['Key']
                            tag['Value'] = response['Tags'][i]['Value']
                            tag_list.append(tag)
                    self.connection.delete_tags(
                        Resources=[ instance_info['InstanceId'] ],
                        Tags=tag_list
                    )
                    self.iam.printer('Tags have been deleted from instance %s.' % instance_info['InstanceId'])
                except:
                    pass

    # try stopping non-running instance
                try:
                    self.connection.stop_instances(
                        InstanceIds=[ instance_info['InstanceId'] ]
                    )
                    self.iam.printer('Instance %s is stopping.' % instance_info['InstanceId'])
                except:
                    pass

    # try terminating non-running instance
                try:
                    self.connection.terminate_instances(
                        InstanceIds=[ instance_info['InstanceId'] ]
                    )
                    self.iam.printer('Instance %s is terminating.' % instance_info['InstanceId'])
                except:
                    pass

    # find non-available images
        response = self.connection.describe_images(
            Owners=[ self.iam.owner_id ]
        )
        image_list = response['Images']
        for image in image_list:
            image_info = image.copy()
            if image_info['State'] == 'pending':
                self.check_image_state(image_info['ImageId'])
                response = self.connection.describe_images(
                    ImageIds=[ image_info['ImageId'] ]
                )
                image_info = response['Images'][0]
            if image_info['State'] != 'available':

    # try removing tags from non-available images
                try:
                    response = self.connection.describe_images(
                        ImageIds=[ image_info['ImageId'] ]
                    )
                    image_tags = response['Images'][0]['Tags']
                    tag_list = []
                    for i in range(0, len(image_tags)):
                        tag = {}
                        tag['Key'] = image_tags[i]['Key']
                        tag['Value'] = image_tags[i]['Value']
                        tag_list.append(tag)
                    self.connection.delete_tags(
                        Resources=[ image_info['ImageId'] ],
                        Tags=tag_list
                    )
                    self.iam.printer('Tags have been deleted from image %s.' % image_info['ImageId'])
                except:
                    pass

    # try deregistering non-available image
                try:
                    self.connection.deregister_image(
                        ImageId=image_info['ImageId']
                    )
                    self.iam.printer('Image %s has been deregistered.' % image_info['ImageId'])
                except:
                    pass

    # try deleting snapshot associated with non-available image
                try:
                    self.connection.delete_snapshot(
                        SnapshotId=image_info['BlockDeviceMappings'][0]['Ebs']['SnapshotId']
                    )
                    snap_id = image_info['BlockDeviceMappings'][0]['Ebs']['SnapshotId']
                    image_id = image_info['ImageId']
                    self.iam.printer('Snapshot %s associated with image %s has been deleted.' % (snap_id, image_id))
                except:
                    pass

    # find snapshots with errors
        response = self.connection.describe_snapshots(
            OwnerIds=[ self.iam.owner_id ]
        )
        snapshot_list = response['Snapshots']
        for snapshot in snapshot_list:
            snapshot_info = snapshot.copy()
            if snapshot_info['State'] == 'error':

    # try deleting snapshot with errors
                try:
                    self.connection.delete_snapshot(
                        SnapshotId=snapshot_info['SnapshotId']
                    )
                    self.iam.printer('Snapshot %s has been deleted.' % snapshot_info['SnapshotId'])
                except:
                    pass

        return True
1038352
def _update_dest_ip(self):
        ''''''
        global DEST_IP
        if not DEST_IP:
            DEST_IP = self._sock.getsockname()[0]
            PRINT('DEST_IP: %s\n'%DEST_IP, CYAN)