Update SOA serial.

    Arguments:

        prs:  parser object of argparse
        conn: dictionary of connection information
356894
def parse_update_soa(prs, conn):
    
    prs_soa = prs.add_parser('soa', help='update SOA record')
    prs_soa.add_argument('--domain', action='store', required=True,
                         help='specify domain FQDN')
    prs_soa.add_argument('--mname', action='store',
                         help='specify MNAME of SOA record')
    prs_soa.add_argument('--rname', action='store',
                         help='specify RNAME of SOA record')
    prs_soa.add_argument('--refresh', action='store', type=int,
                         help='specify REFRESH of SOA record')
    prs_soa.add_argument('--retry', action='store', type=int,
                         help='specify RETRY of SOA record')
    prs_soa.add_argument('--expire', action='store', type=int,
                         help='specify EXPIRE of SOA record')
    prs_soa.add_argument('--minimum', action='store', type=int,
                         help='specify MINIMUM of SOA record')
    conn_options(prs_soa, conn)
    prs_soa.set_defaults(func=update_soa_serial)
1169102
def _update_version(connection, version):
    
    if connection.engine.name == 'sqlite':
        connection.execute('PRAGMA user_version = {}'.format(version))

    elif connection.engine.name == 'postgresql':

        connection.execute(DDL('CREATE SCHEMA IF NOT EXISTS {};'.format(POSTGRES_SCHEMA_NAME)))
        connection.execute(DDL('CREATE SCHEMA IF NOT EXISTS {};'.format(POSTGRES_PARTITION_SCHEMA_NAME)))

        connection.execute('CREATE TABLE IF NOT EXISTS {}.user_version(version INTEGER NOT NULL);'
                           .format(POSTGRES_SCHEMA_NAME))

        # upsert.
        if connection.execute('SELECT * FROM {}.user_version;'.format(POSTGRES_SCHEMA_NAME)).fetchone():
            # update
            connection.execute('UPDATE {}.user_version SET version = {};'
                               .format(POSTGRES_SCHEMA_NAME, version))
        else:
            # insert
            connection.execute('INSERT INTO {}.user_version (version) VALUES ({})'
                               .format(POSTGRES_SCHEMA_NAME, version))
    else:
        raise DatabaseMissingError('Do not know how to migrate {} engine.'
                                   .format(connection.engine.driver))
257124
def update(self, argv):
        """"""

        if len(argv) == 0: 
            error("Command requires an index name", 2)
        name = argv[0]

        if name not in self.service.indexes:
            error("Index '%s' does not exist" % name, 2)
        index = self.service.indexes[name]

        # Read index metadata and construct command line parser rules that 
        # correspond to each editable field.

        # Request editable fields
        fields = self.service.indexes.itemmeta().fields.optional

        # Build parser rules
        rules = dict([(field, {'flags': ["--%s" % field]}) for field in fields])

        # Parse the argument vector
        opts = cmdline(argv, rules)

        # Execute the edit request
        index.update(**opts.kwargs)
7190
async def Update(self, application, charm_url, constraints, force_charm_url, force_series, min_units, settings, settings_yaml):
        '''
        
        '''
        # map input types to rpc msg
        _params = dict()
        msg = dict(type='Application',
                   request='Update',
                   version=4,
                   params=_params)
        _params['application'] = application
        _params['charm-url'] = charm_url
        _params['constraints'] = constraints
        _params['force-charm-url'] = force_charm_url
        _params['force-series'] = force_series
        _params['min-units'] = min_units
        _params['settings'] = settings
        _params['settings-yaml'] = settings_yaml
        reply = await self.rpc(msg)
        return reply
421874
async def parse_update(self, bot):
        
        data = await self.request.json()
        update = types.Update(**data)
        return update
666382
def execute_update(args):
    

    provider_class = getattr(dnsupdater,
                             dnsupdater.AVAILABLE_PLUGINS.get(args.provider))
    updater_options = {}
    process_message = None
    auth = None

    if args.store:  # --store argument
        if provider_class.auth_type == 'T':
            user_arg = args.usertoken or utils.read_input(
                "Paste your auth token: ")
            auth = authinfo.ApiAuth(usertoken=user_arg)
        else:
            user_arg = args.usertoken or utils.read_input(
                "Type your username: ")
            pass_arg = args.password or getpass.getpass("Type your password: ")
            auth = authinfo.ApiAuth(user_arg, pass_arg)

        authinfo.store(auth, args.provider, args.config)
        exec_result = EXECUTION_RESULT_OK
        if not args.hostname:
            update_ddns = False
            process_message = "Auth info stored."
        else:
            update_ddns = True

    # informations arguments
    elif args.usertoken and args.hostname:
        if provider_class.auth_type == 'T':
            auth = authinfo.ApiAuth(args.usertoken)
        else:
            auth = authinfo.ApiAuth(args.usertoken, args.password)
        update_ddns = True
        exec_result = EXECUTION_RESULT_OK
    elif args.hostname:
        if authinfo.exists(args.provider, args.config):
            auth = authinfo.load(args.provider, args.config)
            update_ddns = True
            exec_result = EXECUTION_RESULT_OK
        else:
            update_ddns = False
            exec_result = EXECUTION_RESULT_NOK
            process_message = "No stored auth information found for " \
                              "provider: '%s'" % args.provider
    else:  # no arguments
        update_ddns = False
        exec_result = EXECUTION_RESULT_NOK
        process_message = "Warning: The hostname to be updated must be " \
                          "provided.\nUsertoken and password can be either " \
                          "provided via command line or stored with --store " \
                          "option.\nExecute noipy --help for more details."

    if update_ddns and args.provider == 'generic':
        if args.url:
            if not URL_RE.match(args.url):
                process_message = "Malformed URL."
                exec_result = EXECUTION_RESULT_NOK
                update_ddns = False
            else:
                updater_options['url'] = args.url
        else:
            process_message = "Must use --url if --provider is 'generic' " \
                              "(default)"
            exec_result = EXECUTION_RESULT_NOK
            update_ddns = False

    response_code = None
    response_text = None
    if update_ddns:
        ip_address = args.ip if args.ip else utils.get_ip()
        if not ip_address:
            process_message = "Unable to get IP address. Check connection."
            exec_result = EXECUTION_RESULT_NOK
        elif ip_address == utils.get_dns_ip(args.hostname):
            process_message = "No update required."
        else:
            updater = provider_class(auth, args.hostname, updater_options)
            print("Updating hostname '%s' with IP address %s "
                  "[provider: '%s']..."
                  % (args.hostname, ip_address, args.provider))
            response_code, response_text = updater.update_dns(ip_address)
            process_message = updater.status_message

    proc_result = {
        'exec_result': exec_result,
        'response_code': response_code,
        'response_text': response_text,
        'process_message': process_message,
    }

    return proc_result
550457
def update_dns(config, record, sa_version):
    ""
    try:
        domain = config.get('domain_name', 'sa.baruwa.com.')
        dns_key = config.get('domain_key')
        dns_ip = config.get('domain_ip', '127.0.0.1')
        keyring = tsigkeyring.from_text({domain: dns_key})
        transaction = update.Update(
            domain,
            keyring=keyring,
            keyalgorithm=tsig.HMAC_SHA512)
        txtrecord = '%s.%s' % (sa_version, domain)
        transaction.replace(txtrecord, 120, 'txt', record)
        query.tcp(transaction, dns_ip)
        return True
    except DNSException, msg:
        raise SaChannelUpdateDNSError(msg)
82924
def tls_session_update(self, msg_str):
        
        super(SSLv2ServerHello, self).tls_session_update(msg_str)

        s = self.tls_session
        client_cs = s.sslv2_common_cs
        css = [cs for cs in client_cs if cs in self.ciphers]
        s.sslv2_common_cs = css
        s.sslv2_connection_id = self.connection_id
        s.tls_version = self.version
        if self.cert is not None:
            s.server_certs = [self.cert]
1123702
def update(verbose=False):
    
    local = local_list()
    remote = dict(remote_list())

    updated = False

    for name, date in local:
        if name in remote and remote[name] > date:
            updated = True
            if verbose:
                print("Updating '%s'..." % name)
            download(name)

    if not updated and verbose:
        print("Nothing to update.")
960140
def update(self, pbar):
        ''

        if pbar.seconds_elapsed < 2e-6 or pbar.currval < 2e-6:  # =~ 0
            scaled = power = 0
        else:
            scaled, power = self._speed(pbar)

        return self.format % (scaled, self.prefixes[power], self.unit)
810767
def run_query_series(queries, conn):
    
    results = []
    for item in queries:
        qry = item
        kwargs = {}
        if isinstance(item, tuple):
            qry = item[0]
            kwargs = item[1]
        result = conn.update_query(qry, **kwargs)
        # pdb.set_trace()
        results.append(result)
    return results
510190
def update(self, **kwargs):
        
        if 'useProxyServer' in kwargs and kwargs['useProxyServer'] == 'enabled':
            if 'proxyServerPool' not in kwargs:
                error = 'Missing proxyServerPool parameter value.'
                raise MissingUpdateParameter(error)
        if hasattr(self, 'useProxyServer'):
            if getattr(self, 'useProxyServer') == 'enabled' and 'proxyServerPool' not in self.__dict__:
                error = 'Missing proxyServerPool parameter value.'
                raise MissingUpdateParameter(error)

        self._update(**kwargs)

        return self
996345
def update_ipsec_site_connection(self, ipsecsite_conn, body=None):
        """"""
        return self.put(
            self.ipsec_site_connection_path % (ipsecsite_conn), body=body
        )
178758
def update(connection=None, urls=None, force_download=False):
    
    db = DbManager(connection)
    db.db_import(urls=urls, force_download=force_download)
    db.session.close()
917144
def _update_ssl_params(host):
        
        if host[HostParsing.HOST] \
                and EsParser._is_secure_connection_type(host):
            host[HostParsing.PORT] = EsParser.SSL_DEFAULT_PORT
            host[HostParsing.USE_SSL] = True
            parsed_url = urlparse(EsParser._fix_host_prefix(host[HostParsing.HOST]))
            host[HostParsing.HOST] = parsed_url.hostname
            host[HostParsing.SCHEME] = HostParsing.HTTPS
        return host
922163
def arg_parser(*args, **kwargs):
    """"""
    msg = {
        'site': 'The site to connect to defined in your praw.ini file.',
        'update': 'Prevent the checking for prawtools package updates.'}

    kwargs['version'] = 'BBoe\'s PRAWtools {}'.format(__version__)
    parser = OptionParser(*args, **kwargs)
    parser.add_option('-v', '--verbose', action='count', default=0,
                      help='Increase the verbosity by 1 each time')
    parser.add_option('-U', '--disable-update-check', action='store_true',
                      help=msg['update'])

    group = OptionGroup(parser, 'Site/Authentication options')
    group.add_option('-S', '--site', help=msg['site'])
    parser.add_option_group(group)

    return parser
710806
def console():
    '''
    
    '''
    parser = argparse.ArgumentParser(description="backup/restore PostgreSQL databases", add_help=False)
    parser.add_argument("--version", action='version', version="%(prog)s {}".format(__version__))

    parent_parser = argparse.ArgumentParser(add_help=False)
    parent_parser.add_argument("-d", "--dbname", dest="dbname", help="database name to connect to")
    parent_parser.add_argument("-U", "--username", "--user", dest="username", help="database user name")
    parent_parser.add_argument("-W", "--password", dest="password", help="database password")
    parent_parser.add_argument(
        "-h", "--host", "--hostname",
        dest="host",
        default="localhost",
        help="database server host or socket directory"
    )
    parent_parser.add_argument("-p", "--port", type=int, default=5432, dest="port", help="database server post")
    parent_parser.add_argument(
        "--help",
        action="help",
        default=argparse.SUPPRESS,
        help="show this help message and exit"
    )

    subparsers = parser.add_subparsers(dest="command", help="a sub command")
    subparsers.required = True # https://bugs.python.org/issue9253#msg186387
    backup_parser = subparsers.add_parser(
        "backup",
        parents=[parent_parser],
        help="backup a PostgreSQL database",
        add_help=False
    )
    backup_parser.add_argument(
        "-D", "--dir", "--directory",
        dest="directory",
        help="directory where the backup files should go"
    )
    backup_parser.add_argument(
        "--debug",
        dest="debug",
        action="store_true",
        help="Turn on debugging output"
    )
    backup_parser.add_argument("tables", nargs="+")
    backup_parser.set_defaults(func=console_backup)

    restore_parser = subparsers.add_parser(
        "restore",
        parents=[parent_parser],
        help="restore a PostgreSQL database",
        add_help=False
    )
    restore_parser.add_argument(
        "-D", "--dir", "--directory",
        dest="directory",
        help="directory where the backup files are located"
    )
    restore_parser.add_argument(
        "--debug",
        dest="debug",
        action="store_true",
        help="Turn on debugging output"
    )
    restore_parser.set_defaults(func=console_restore)

    args = parser.parse_args()

    if args.debug:
        logging.basicConfig(format="[%(levelname).1s] %(message)s", level=logging.DEBUG, stream=sys.stdout)
    else:
        logging.basicConfig(format="[%(levelname).1s] %(message)s", level=logging.INFO, stream=sys.stdout)

    ret_code = args.func(args)
    return ret_code