def _update(self, **kwargs):
        """wrapped with update, override that in a subclass to customize"""

        requests_params, update_uri, session, read_only = \
            self._prepare_put_or_patch(kwargs)

        read_only_mutations = []
        for attr in read_only:
            if attr in kwargs:
                read_only_mutations.append(attr)
        if read_only_mutations:
            msg = 'Attempted to mutate read-only attribute(s): %s' \
                  % read_only_mutations
            raise AttemptedMutationOfReadOnly(msg)

        # Get the current state of the object on BIG-IP® and check the
        # generation Use pop here because we don't want force in the data_dict
        force = self._check_force_arg(kwargs.pop('force', True))
        if not force:
            # generation has a known server-side error
            self._check_generation()

        kwargs = self._check_for_boolean_pair_reduction(kwargs)

        # Save the meta data so we can add it back into self after we
        # load the new object.
        temp_meta = self.__dict__.pop('_meta_data')

        # Need to remove any of the Collection objects from self.__dict__
        # because these are subCollections and _meta_data and
        # other non-BIG-IP® attrs are not removed from the subCollections
        # See issue #146 for details
        tmp = dict()
        for key, value in iteritems(self.__dict__):
            # In Python2 versions we were changing a dictionary in place,
            # but this cannot be done with an iterator as an error is raised.
            # So instead we create a temporary holder for the modified dict
            # and then re-assign it afterwards.
            if isinstance(value, Collection):
                pass
            else:
                tmp[key] = value
        self.__dict__ = tmp
        data_dict = self.to_dict()

        # Remove any read-only attributes from our data_dict before we update
        # the data dict with the attributes.  If they pass in read-only attrs
        # in the method call we are going to let BIG-IP® let them know about it
        # when it fails
        for attr in read_only:
            data_dict.pop(attr, '')

        data_dict.update(kwargs)
        data_dict = self._prepare_request_json(data_dict)

        # Handles ConnectionAborted errors
        #
        # @see https://github.com/F5Networks/f5-ansible/issues/317
        # @see https://github.com/requests/requests/issues/2364
        for _ in range(0, 30):
            try:
                response = session.put(update_uri, json=data_dict, **requests_params)
                self._meta_data = temp_meta
                self._local_update(response.json())
                break
            except iControlUnexpectedHTTPError:
                response = session.get(update_uri, **requests_params)
                self._meta_data = temp_meta
                self._local_update(response.json())
                raise
            except ConnectionError as ex:
                if 'Connection aborted' in str(ex):
                    time.sleep(1)
                    continue
                else:
                    raise
def _update ( self , ** kwargs ) : requests_params , update_uri , session , read_only = self . _prepare_put_or_patch ( kwargs ) read_only_mutations = [ ] for attr in read_only : if attr in kwargs : read_only_mutations . append ( attr ) if read_only_mutations : msg = 'Attempted to mutate read-only attribute(s): %s' % read_only_mutations raise AttemptedMutationOfReadOnly ( msg ) force = self . _check_force_arg ( kwargs . pop ( 'force' , True ) ) if not force : self . _check_generation ( ) kwargs = self . _check_for_boolean_pair_reduction ( kwargs ) temp_meta = self . __dict__ . pop ( '_meta_data' ) tmp = dict ( ) for key , value in iteritems ( self . __dict__ ) : if isinstance ( value , Collection ) : pass else : tmp [ key ] = value self . __dict__ = tmp data_dict = self . to_dict ( ) for attr in read_only : data_dict . pop ( attr , '' ) data_dict . update ( kwargs ) data_dict = self . _prepare_request_json ( data_dict ) for _ in range ( 0 , 30 ) : try : response = session . put ( update_uri , json = data_dict , ** requests_params ) self . _meta_data = temp_meta self . _local_update ( response . json ( ) ) break except iControlUnexpectedHTTPError : response = session . get ( update_uri , ** requests_params ) self . _meta_data = temp_meta self . _local_update ( response . json ( ) ) raise except ConnectionError as ex : if 'Connection aborted' in str ( ex ) : time . sleep ( 1 ) continue else : raise
wrapped with update, override that in a subclass to customize