Attempts to download new location, ISP & organization GeoIP databases and
replace the existing ones w/ them.
167222
public function update()
    {
        try {
            Option::set(self::LAST_RUN_TIME_OPTION_NAME, Date::factory('today')->getTimestamp());

            $locUrl = Option::get(self::LOC_URL_OPTION_NAME);
            if (!empty($locUrl)) {
                $this->downloadFile('loc', $locUrl);
            }

            $ispUrl = Option::get(self::ISP_URL_OPTION_NAME);
            if (!empty($ispUrl)) {
                $this->downloadFile('isp', $ispUrl);
            }

            $orgUrl = Option::get(self::ORG_URL_OPTION_NAME);
            if (!empty($orgUrl)) {
                $this->downloadFile('org', $orgUrl);
            }
        } catch (Exception $ex) {
            // message will already be prefixed w/ 'GeoIPAutoUpdater: '
            StaticContainer::get(LoggerInterface::class)->error('Auto-update failed: {exception}', [
                'exception' => $ex,
                'ignoreInScreenWriter' => true,
            ]);
            $this->performRedundantDbChecks();
            throw $ex;
        }

        $this->performRedundantDbChecks();
    }
576746
def update_routing_table(self):
        
        # copied because it can be modified
        existing_routers = list(self.routing_table.routers)

        has_tried_initial_routers = False
        if self.missing_writer:
            has_tried_initial_routers = True
            if self.update_routing_table_from(self.initial_address):
                return

        if self.update_routing_table_from(*existing_routers):
            return

        if not has_tried_initial_routers and self.initial_address not in existing_routers:
            if self.update_routing_table_from(self.initial_address):
                return

        # None of the routers have been successful, so just fail
        raise ServiceUnavailable("Unable to retrieve routing information")
1204248
def replace_heroku_db(self, file_url):
        
        self.print_message("Replacing database for Heroku app '%s'" % self.args.destination_app)

        self.reset_heroku_database()

        if file_url:
            self.print_message("Restoring from URL '%s'" % file_url)
            args = [
                "heroku",
                "pg:backups:restore",
                file_url,
                "--app=%s" % self.args.destination_app,
                "DATABASE",
                "--confirm",
                self.args.destination_app,
            ]
            if self.args.use_pgbackups:
                args = [
                    "heroku",
                    "pgbackups:restore",
                    "--app=%s" % self.args.destination_app,
                    "DATABASE_URL",
                    "--confirm",
                    self.args.destination_app,
                    file_url,
                ]
            subprocess.check_call(args)
        else:
            # TODO perhaps add support for file -> heroku by piping to pg:psql
            self.print_message("Pushing data from database '%s'" % self.databases['source']['name'])
            self.print_message("NOTE: Any postgres authentication settings you passed to paragres "
                               "will be ignored.\nIf desired, you can export PG* variables.\n"
                               "You will be prompted for your psql password.")
            args = [
                "heroku",
                "pg:push",
                self.databases['source']['name'],
                "DATABASE_URL",
                "--app=%s" % self.args.destination_app,
            ]
            subprocess.check_call(args)
516591
def update(connection, silent, hgnc_file_path, hcop_file_path, low_memory):
    """"""
    database.update(connection=connection,
                    silent=silent,
                    hgnc_file_path=hgnc_file_path,
                    hcop_file_path=hcop_file_path,
                    low_memory=low_memory)
909856
def replace_route(route_table_id=None, destination_cidr_block=None,
                  route_table_name=None, gateway_id=None,
                  instance_id=None, interface_id=None,
                  region=None, key=None, keyid=None, profile=None,
                  vpc_peering_connection_id=None):
    '''
    

    '''

    if not _exactly_one((route_table_name, route_table_id)):
        raise SaltInvocationError('One (but not both) of route_table_id or route_table_name '
                                  'must be provided.')

    if destination_cidr_block is None:
        raise SaltInvocationError('destination_cidr_block is required.')

    try:
        if route_table_name:
            route_table_id = _get_resource_id('route_table', route_table_name,
                                              region=region, key=key,
                                              keyid=keyid, profile=profile)
            if not route_table_id:
                return {'replaced': False,
                        'error': {'message': 'route table {0} does not exist.'.format(route_table_name)}}
        conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)

        if conn.replace_route(route_table_id, destination_cidr_block,
                              gateway_id=gateway_id, instance_id=instance_id,
                              interface_id=interface_id, vpc_peering_connection_id=vpc_peering_connection_id):
            log.info(
                'Route with cidr block %s on route table %s was replaced',
                route_table_id, destination_cidr_block
            )
            return {'replaced': True}
        else:
            log.warning(
                'Route with cidr block %s on route table %s was not replaced',
                route_table_id, destination_cidr_block
            )
            return {'replaced': False}
    except BotoServerError as e:
        return {'replaced': False, 'error': __utils__['boto.get_error'](e)}
292039
def update(gandi, address, dest_add, dest_del):
    """"""
    source, domain = address

    if not dest_add and not dest_del:
        gandi.echo('Nothing to update: you must provide destinations to '
                   'update, use --dest-add/-a or -dest-del/-d parameters.')
        return

    result = gandi.forward.update(domain, source, dest_add, dest_del)

    return result
55913
public void actionReplace() throws JspException {

        try {
            // get the file item from the multipart request
            Iterator<FileItem> i = getMultiPartFileItems().iterator();
            FileItem fi = null;
            while (i.hasNext()) {
                fi = i.next();
                if (fi.getName() != null) {
                    // found the file object, leave iteration
                    break;
                }
            }

            if (fi != null) {
                // get file object information
                long size = fi.getSize();
                long maxFileSizeBytes = OpenCms.getWorkplaceManager().getFileBytesMaxUploadSize(getCms());
                // check file size
                if ((maxFileSizeBytes > 0) && (size > maxFileSizeBytes)) {
                    // file size is larger than maximum allowed file size, throw an error
                    throw new CmsException(
                        Messages.get().container(
                            Messages.ERR_FILE_SIZE_TOO_LARGE_1,
                            new Long((maxFileSizeBytes / 1024))));
                }
                byte[] content = fi.get();
                fi.delete();

                // determine the resource type id from the resource to replace
                CmsResource res = getCms().readResource(getParamResource(), CmsResourceFilter.IGNORE_EXPIRATION);
                CmsFile file = getCms().readFile(res);
                byte[] contents = file.getContents();
                int resTypeId = res.getTypeId();
                // check the lock state and replace resource
                checkLock(getParamResource());
                try {
                    getCms().replaceResource(getParamResource(), resTypeId, content, null);
                } catch (CmsDbSqlException sqlExc) {
                    // SQL error, probably the file is too large for the database settings, restore old content
                    file.setContents(contents);
                    getCms().writeFile(file);
                    throw sqlExc;
                }
                // close dialog
                actionCloseDialog();
            } else {
                throw new CmsException(Messages.get().container(Messages.ERR_UPLOAD_FILE_NOT_FOUND_0));
            }
        } catch (Throwable e) {
            // error replacing file, show error dialog
            includeErrorpage(this, e);
        }
    }
391254
def convert_old(data):
    ""
    ret = default_config()
    ret['sync'].update(data.get('peeringdb', {}))
    ret['orm']['database'].update(data.get('database', {}))
    return ret
659028
def update_records(self, headers, zoneID, updateRecords):
        """"""
        IP = requests.get(self.GET_EXT_IP_URL).text
        message = True
        errorsRecords = []
        sucessRecords = []
        for record in updateRecords:
            updateEndpoint = '/' + zoneID + '/dns_records/' + record[0]
            updateUrl = self.BASE_URL + updateEndpoint
            data = json.dumps({
                'id': zoneID,
                'type': record[2],
                'name': record[1],
                'content': IP,
                'proxied': record[4]
                })
            if record[3] != IP and record[2] == 'A':
                result = requests.put(updateUrl,
                    headers=headers, data=data).json()
                if result['success'] == True:
                    sucessRecords.append(record[1])
                else:
                    errorsRecords.append(record[1])
                if errorsRecords != []:
                    message = ("There was an error updating these records: "
                        + str(errorsRecords) + " , the rest is OK.")
                else:
                    message = ("These records got updated: "
                        + str(sucessRecords))
        return message
328907
public static function updateDatabase()
    {
        FileSystem::mkDir(DIR_TEMP . 'GeoIPCountryCSV');

        $file_to_extract = DIR_TEMP . 'GeoIPCountryCSV/GeoIPCountryCSV.zip';
        if (!file_exists($file_to_extract) || filemtime($file_to_extract) < NOW - 86400) {
            $f = @file_get_contents('http://geolite.maxmind.com/download/geoip/database/GeoIPCountryCSV.zip');
            if ($f === false) {
                throw new RuntimeException('Can not connect to MaxMind');
            }

            file_put_contents(DIR_TEMP . 'GeoIPCountryCSV/GeoIPCountryCSV.zip', $f);
            unset($f);
        }


        // Extract file
        $zip = new \ZipArchive;
        $zip->open($file_to_extract);
        $zip->extractTo(DIR_TEMP . 'GeoIPCountryCSV/');
        $zip->close();

        $ranges = new MaxMindGeoIpRangeEntityRepository;
        $countries = new MaxMindGeoIpCountryEntityRepository();

        // Create new tables
        $ranges->ensureDbTableExists();
        $countries->ensureDbTableExists();

        $ranges->deleteObjectCollection();
        $countries->deleteObjectCollection();

        $countries_sql = $ranges_sql = [];
        $fh = fopen(DIR_TEMP . 'GeoIPCountryCSV/GeoIPCountryWhois.csv', 'rb');

        while (($q = fgetcsv($fh, 4096, ',')) !== false) {
            if (!isset($q[4])) {
                continue;
            }

            $ranges_sql[] = '(NULL, "' . sql_prepare($q[4]) . '","' . sql_prepare($q[2]) . '","' . sql_prepare($q[3]) . '")';
            if (!isset($countries_sql[$q[4]])) {
                $countries_sql[$q[4]] = '(NULL, "' . $q[4] . '","' . sql_prepare($q[5]) . '")';
            }
        }
        fclose($fh);

        // Clean SQL works much faster and we now what values are
        q('INSERT INTO `cms_maxmind_geoip_c` VALUES ' . implode(',', $countries_sql), false);

        $q = [];
        $ql = 0;
        $so = count($ranges_sql);

        for ($i = 0; $i < $so; ++$i) {
            $l = strlen($ranges_sql[$i]);
            if ($ql + $l > 983040) {
                q('INSERT INTO `cms_maxmind_geoip_r` VALUES ' . implode(',', $q));
                $q = [];
                $ql = 0;
            }
            $q[] = $ranges_sql[$i];
            $ql += $l;
        }

        // If have anything to save
        if ($q) {
            q('INSERT INTO `cms_maxmind_geoip_r` VALUES ' . implode(',', $q));
        }

        q('OPTIMIZE TABLE `cms_maxmind_geoip_r`,`cms_maxmind_geoip_c`');

        Cacher::getInstance()->getDefaultCacher()->set('geo_ip_lmt', NOW);
    }
323192
def _patch(self, opt={}):
        
        opt_netloc = opt.pop(Request.opt_url_netloc, None)
        opt_scheme = opt.pop(Request.opt_url_scheme, None)
        if opt_netloc or opt_scheme:
            scheme, netloc, path, params, query, fragment = six.moves.urllib.parse.urlparse(self.__url)
            self.__url = six.moves.urllib.parse.urlunparse((
                opt_scheme or scheme,
                opt_netloc or netloc,
                path,
                params,
                query,
                fragment
            ))

            logger.info('patching url: [{0}]'.format(self.__url))
934032
def _construct_update(self, outgoing_route):
        
        update = None
        path = outgoing_route.path
        # Get copy of path's path attributes.
        pathattr_map = path.pathattr_map
        new_pathattr = []

        if path.is_withdraw:
            if isinstance(path, Ipv4Path):
                update = BGPUpdate(withdrawn_routes=[path.nlri])
                return update
            else:
                mpunreach_attr = BGPPathAttributeMpUnreachNLRI(
                    path.route_family.afi, path.route_family.safi, [path.nlri]
                )
                new_pathattr.append(mpunreach_attr)
        elif self.is_route_server_client:
            nlri_list = [path.nlri]
            new_pathattr.extend(pathattr_map.values())
        else:
            if self.is_route_reflector_client:
                # Append ORIGINATOR_ID attribute if not already exist.
                if BGP_ATTR_TYPE_ORIGINATOR_ID not in pathattr_map:
                    originator_id = path.source
                    if originator_id is None:
                        originator_id = self._common_conf.router_id
                    elif isinstance(path.source, Peer):
                        originator_id = path.source.ip_address
                    new_pathattr.append(
                        BGPPathAttributeOriginatorId(value=originator_id))

                # Preppend own CLUSTER_ID into CLUSTER_LIST attribute if exist.
                # Otherwise append CLUSTER_LIST attribute.
                cluster_lst_attr = pathattr_map.get(BGP_ATTR_TYPE_CLUSTER_LIST)
                if cluster_lst_attr:
                    cluster_list = list(cluster_lst_attr.value)
                    if self._common_conf.cluster_id not in cluster_list:
                        cluster_list.insert(0, self._common_conf.cluster_id)
                    new_pathattr.append(
                        BGPPathAttributeClusterList(cluster_list))
                else:
                    new_pathattr.append(
                        BGPPathAttributeClusterList(
                            [self._common_conf.cluster_id]))

            # Supported and un-supported/unknown attributes.
            origin_attr = None
            nexthop_attr = None
            as_path_attr = None
            as4_path_attr = None
            aggregator_attr = None
            as4_aggregator_attr = None
            extcomm_attr = None
            community_attr = None
            localpref_attr = None
            pmsi_tunnel_attr = None
            unknown_opttrans_attrs = None
            nlri_list = [path.nlri]

            if path.route_family.safi in (subaddr_family.IP_FLOWSPEC,
                                          subaddr_family.VPN_FLOWSPEC):
                # Flow Specification does not have next_hop.
                next_hop = []
            elif self.is_ebgp_peer():
                next_hop = self._session_next_hop(path)
                if path.is_local() and path.has_nexthop():
                    next_hop = path.nexthop
            else:
                next_hop = path.nexthop
                # RFC 4271 allows us to change next_hop
                # if configured to announce its own ip address.
                # Also if the BGP route is configured without next_hop,
                # we use path._session_next_hop() as next_hop.
                if (self._neigh_conf.is_next_hop_self
                        or (path.is_local() and not path.has_nexthop())):
                    next_hop = self._session_next_hop(path)
                    LOG.debug('using %s as a next_hop address instead'
                              ' of path.nexthop %s', next_hop, path.nexthop)

            nexthop_attr = BGPPathAttributeNextHop(next_hop)
            assert nexthop_attr, 'Missing NEXTHOP mandatory attribute.'

            if not isinstance(path, Ipv4Path):
                # We construct mpreach-nlri attribute.
                mpnlri_attr = BGPPathAttributeMpReachNLRI(
                    path.route_family.afi,
                    path.route_family.safi,
                    next_hop,
                    nlri_list
                )

            # ORIGIN Attribute.
            # According to RFC this attribute value SHOULD NOT be changed by
            # any other speaker.
            origin_attr = pathattr_map.get(BGP_ATTR_TYPE_ORIGIN)
            assert origin_attr, 'Missing ORIGIN mandatory attribute.'

            # AS_PATH Attribute.
            # Construct AS-path-attr using paths AS_PATH attr. with local AS as
            # first item.
            path_aspath = pathattr_map.get(BGP_ATTR_TYPE_AS_PATH)
            assert path_aspath, 'Missing AS_PATH mandatory attribute.'
            # Deep copy AS_PATH attr value
            as_path_list = path_aspath.path_seg_list
            # If this is a iBGP peer.
            if not self.is_ebgp_peer():
                # When a given BGP speaker advertises the route to an internal
                # peer, the advertising speaker SHALL NOT modify the AS_PATH
                # attribute associated with the route.
                pass
            else:
                # When a given BGP speaker advertises the route to an external
                # peer, the advertising speaker updates the AS_PATH attribute
                # as follows:
                # 1) if the first path segment of the AS_PATH is of type
                #    AS_SEQUENCE, the local system prepends its own AS num as
                #    the last element of the sequence (put it in the left-most
                #    position with respect to the position of  octets in the
                #    protocol message).  If the act of prepending will cause an
                #    overflow in the AS_PATH segment (i.e.,  more than 255
                #    ASes), it SHOULD prepend a new segment of type AS_SEQUENCE
                #    and prepend its own AS number to this new segment.
                #
                # 2) if the first path segment of the AS_PATH is of type AS_SET
                #    , the local system prepends a new path segment of type
                #    AS_SEQUENCE to the AS_PATH, including its own AS number in
                #    that segment.
                #
                # 3) if the AS_PATH is empty, the local system creates a path
                #    segment of type AS_SEQUENCE, places its own AS into that
                #    segment, and places that segment into the AS_PATH.
                if (len(as_path_list) > 0 and
                        isinstance(as_path_list[0], list) and
                        len(as_path_list[0]) < 255):
                    as_path_list[0].insert(0, self.local_as)
                else:
                    as_path_list.insert(0, [self.local_as])
            # Construct AS4_PATH list from AS_PATH list and swap
            # non-mappable AS number with AS_TRANS in AS_PATH.
            as_path_list, as4_path_list = self._trans_as_path(
                as_path_list)
            # If the neighbor supports Four-Octet AS number, send AS_PATH
            # in Four-Octet.
            if self.is_four_octet_as_number_cap_valid():
                as_path_attr = BGPPathAttributeAsPath(
                    as_path_list, as_pack_str='!I')  # specify Four-Octet.
            # Otherwise, send AS_PATH in Two-Octet.
            else:
                as_path_attr = BGPPathAttributeAsPath(as_path_list)
            # If needed, send AS4_PATH attribute.
            if as4_path_list:
                as4_path_attr = BGPPathAttributeAs4Path(as4_path_list)

            # AGGREGATOR Attribute.
            aggregator_attr = pathattr_map.get(BGP_ATTR_TYPE_AGGREGATOR)
            # If the neighbor does not support Four-Octet AS number,
            # swap non-mappable AS number with AS_TRANS.
            if (aggregator_attr and
                    not self.is_four_octet_as_number_cap_valid()):
                # If AS number of AGGREGATOR is Four-Octet AS number,
                # swap with AS_TRANS, else do not.
                aggregator_as_number = aggregator_attr.as_number
                if not is_valid_old_asn(aggregator_as_number):
                    aggregator_attr = bgp.BGPPathAttributeAggregator(
                        bgp.AS_TRANS, aggregator_attr.addr)
                    as4_aggregator_attr = bgp.BGPPathAttributeAs4Aggregator(
                        aggregator_as_number, aggregator_attr.addr)

            # MULTI_EXIT_DISC Attribute.
            # For eBGP session we can send multi-exit-disc if configured.
            multi_exit_disc = None
            if self.is_ebgp_peer():
                if self._neigh_conf.multi_exit_disc:
                    multi_exit_disc = BGPPathAttributeMultiExitDisc(
                        self._neigh_conf.multi_exit_disc
                    )
                else:
                    pass
            if not self.is_ebgp_peer():
                multi_exit_disc = pathattr_map.get(
                    BGP_ATTR_TYPE_MULTI_EXIT_DISC)

            # LOCAL_PREF Attribute.
            if not self.is_ebgp_peer():
                # For iBGP peers we are required to send local-pref attribute
                # for connected or local prefixes. We check if the path matches
                # attribute_maps and set local-pref value.
                # If the path doesn't match, we set default local-pref given
                # from the user. The default value is 100.
                localpref_attr = BGPPathAttributeLocalPref(
                    self._common_conf.local_pref)
                key = const.ATTR_MAPS_LABEL_DEFAULT

                if isinstance(path, (Vpnv4Path, Vpnv6Path)):
                    nlri = nlri_list[0]
                    rf = VRF_RF_IPV4 if isinstance(path, Vpnv4Path)\
                        else VRF_RF_IPV6
                    key = ':'.join([nlri.route_dist, rf])

                attr_type = AttributeMap.ATTR_LOCAL_PREF
                at_maps = self._attribute_maps.get(key, {})
                result = self._lookup_attribute_map(at_maps, attr_type, path)
                if result:
                    localpref_attr = result

            # COMMUNITY Attribute.
            community_attr = pathattr_map.get(BGP_ATTR_TYPE_COMMUNITIES)

            # EXTENDED COMMUNITY Attribute.
            # Construct ExtCommunity path-attr based on given.
            path_extcomm_attr = pathattr_map.get(
                BGP_ATTR_TYPE_EXTENDED_COMMUNITIES
            )
            if path_extcomm_attr:
                # SOO list can be configured per VRF and/or per Neighbor.
                # NeighborConf has this setting we add this to existing list.
                communities = path_extcomm_attr.communities
                if self._neigh_conf.soo_list:
                    # construct extended community
                    soo_list = self._neigh_conf.soo_list
                    subtype = 0x03
                    for soo in soo_list:
                        first, second = soo.split(':')
                        if '.' in first:
                            c = BGPIPv4AddressSpecificExtendedCommunity(
                                subtype=subtype,
                                ipv4_address=first,
                                local_administrator=int(second))
                        else:
                            c = BGPTwoOctetAsSpecificExtendedCommunity(
                                subtype=subtype,
                                as_number=int(first),
                                local_administrator=int(second))
                        communities.append(c)

                extcomm_attr = BGPPathAttributeExtendedCommunities(
                    communities=communities
                )

                pmsi_tunnel_attr = pathattr_map.get(
                    BGP_ATTR_TYEP_PMSI_TUNNEL_ATTRIBUTE
                )

            # UNKNOWN Attributes.
            # Get optional transitive path attributes
            unknown_opttrans_attrs = bgp_utils.get_unknown_opttrans_attr(path)

            # Ordering path attributes according to type as RFC says. We set
            # MPReachNLRI first as advised by experts as a new trend in BGP
            # implementation.
            if isinstance(path, Ipv4Path):
                new_pathattr.append(nexthop_attr)
            else:
                new_pathattr.append(mpnlri_attr)

            new_pathattr.append(origin_attr)
            new_pathattr.append(as_path_attr)
            if as4_path_attr:
                new_pathattr.append(as4_path_attr)
            if aggregator_attr:
                new_pathattr.append(aggregator_attr)
            if as4_aggregator_attr:
                new_pathattr.append(as4_aggregator_attr)
            if multi_exit_disc:
                new_pathattr.append(multi_exit_disc)
            if localpref_attr:
                new_pathattr.append(localpref_attr)
            if community_attr:
                new_pathattr.append(community_attr)
            if extcomm_attr:
                new_pathattr.append(extcomm_attr)
            if pmsi_tunnel_attr:
                new_pathattr.append(pmsi_tunnel_attr)
            if unknown_opttrans_attrs:
                new_pathattr.extend(unknown_opttrans_attrs.values())

        if isinstance(path, Ipv4Path):
            update = BGPUpdate(path_attributes=new_pathattr,
                               nlri=nlri_list)
        else:
            update = BGPUpdate(path_attributes=new_pathattr)
        return update
948241
def sipprverse_method(self):
        
        logging.info('Beginning sipprverse method database downloads')
        if self.overwrite or not os.path.isdir(os.path.join(self.databasepath, 'genesippr')):
            self.sipprverse_targets(databasepath=self.databasepath)
        if self.overwrite or not os.path.isdir(os.path.join(self.databasepath, 'ConFindr')):
            self.confindr_targets()
        if self.overwrite or not os.path.isdir(os.path.join(self.databasepath, 'mash')):
            self.mash(databasepath=self.databasepath)
575400
private File updateMonitoredDirectory(String newMonitoredFolder) {

        File oldDir = monitoredDirectory.get();
        File newDir = new File(newMonitoredFolder);

        // If it is relative, resolve against server dir
        if (!!!newDir.isAbsolute()) {
            newMonitoredFolder = locationService.resolveString(WsLocationConstants.SYMBOL_SERVER_CONFIG_DIR + newMonitoredFolder);
            newDir = new File(newMonitoredFolder);
        }

        if (!!!newDir.equals(oldDir)) {
            if (monitoredDirectory.compareAndSet(oldDir, newDir)) {
                for (ServiceReg<FileMonitor> mon : _monitors.values()) {
                    mon.unregister();
                }
                _monitors.clear();

                if (!!!newDir.exists()) {
                    createdMonitoredDir.set(newDir.mkdirs());
                }
            } else {
                oldDir = null;
            }
        } else {
            oldDir = null;
        }

        return oldDir;
    }
755832
public void update(URI location) {
    try {
      if (mUfs.isFile(mCheckpoint.toString())) {
        UnderFileSystemUtils.deleteFileIfExists(mUfs, mTempBackupCheckpoint.toString());
        UnderFileSystemUtils.deleteFileIfExists(mUfs, mBackupCheckpoint.toString());
        // Rename in two steps so that we never have identical mCheckpointPath and
        // mBackupCheckpointPath. This is a concern since UFS may implement rename as copy + delete.
        mUfs.renameFile(mCheckpoint.toString(), mTempBackupCheckpoint.toString());
        mUfs.renameFile(mTempBackupCheckpoint.toString(), mBackupCheckpoint.toString());
        LOG.info("Backed up the checkpoint file to {}", mBackupCheckpoint.toString());
      }
      mUfs.renameFile(location.getPath(), mCheckpoint.toString());
      LOG.info("Renamed the checkpoint file from {} to {}", location,
          mCheckpoint.toString());

      // The checkpoint already reflects the information in the completed logs.
      mWriter.deleteCompletedLogs();
      UnderFileSystemUtils.deleteFileIfExists(mUfs, mBackupCheckpoint.toString());
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }
668576
def Update(self):
		

		return(clc.v2.Requests(clc.v2.API.Call('PUT','servers/%s/%s/publicIPAddresses/%s' % (self.parent.server.alias,self.parent.server.id,self.id),
						                       json.dumps({'ports': [o.ToDict() for o in self.ports],
											               'sourceRestrictions': [o.ToDict() for o in self.source_restrictions] }),
											   session=self.session),
							   alias=self.parent.server.alias,
							   session=self.session))
491056
def UpdateResources(dstpath, data, type_, names=None, languages=None):
    
    # look for existing resources
    res = GetResources(dstpath, [type_], names, languages)
    # add type_, names and languages not already present in existing resources
    if not type_ in res and type_ != "*":
        res[type_] = {}
    if names:
        for name in names:
            if not name in res[type_] and name != "*":
                res[type_][name] = []
                if languages:
                    for language in languages:
                        if not language in res[type_][name] and language != "*":
                            res[type_][name].append(language)
    # add resource to destination, overwriting existing resources
    hdst = win32api.BeginUpdateResource(dstpath, 0)
    for type_ in res:
        for name in res[type_]:
            for language in res[type_][name]:
                logger.info("Updating resource type %s name %s language %s",
                            type_, name, language)
                win32api.UpdateResource(hdst, type_, name, data, language)
    win32api.EndUpdateResource(hdst, 0)