Update config mode based on the prompt analysis.
773017
def update_config_mode(self, prompt):  # pylint: disable=no-self-use
        """"""
        mode = 'global'
        if prompt:
            if 'config' in prompt:
                mode = 'config'
            elif 'admin' in prompt:
                mode = 'admin'

        self.log("Mode: {}".format(mode))
        return mode
1224291
def _update_config_file(username, password, email, url, config_path):
        """"""
        try:
            # read the existing config
            config = json.load(open(config_path, "r"))
        except ValueError:
            config = dict()

        if not config.get('auths'):
            config['auths'] = dict()

        if not config['auths'].get(url):
            config['auths'][url] = dict()
        encoded_credentials = dict(
            auth=base64.b64encode(username + b':' + password),
            email=email
        )
        config['auths'][url] = encoded_credentials
        try:
            json.dump(config, open(config_path, "w"), indent=5, sort_keys=True)
        except Exception as exc:
            raise exceptions.AnsibleContainerConductorException(
                u"Failed to write registry config to {0} - {1}".format(config_path, exc)
            )
1334147
def _reload_maybe(self):
        
        ConfigModel = apps.get_model('djconfig.Config')

        data = dict(
            ConfigModel.objects
                .filter(key='_updated_at')
                .values_list('key', 'value'))

        if (not hasattr(self, '_updated_at') or
                self._updated_at != data.get('_updated_at')):
            self._reload()
1028529
def prompt_update_all(config: 'Config'):
    """"""

    click.echo()
    click.echo('Welcome !')
    click.echo('Press enter to keep the defaults or enter a new value to update the configuration.')
    click.echo('Press Ctrl+C at any time to quit and save')
    click.echo()

    for field in config:

        type_ = config.__type__(field)
        hint = config.__hint__(field) + ' ({})'.format(type_.__name__)

        if isinstance(type_, conftypes.SubConfigType):
            continue

        # we prompt the paths through prompt_file and not click
        if type_ is conftypes.path:
            config[field] = prompt_file(hint, default=config[field])
            continue

        if isinstance(type_, conftypes.ConfigType):
            # config[field] is always real data, but we want to show something that is the closest
            # possible to what the user needs to enter
            # thus, we show what we would store in the json
            default = type_.save(config[field])
        else:
            default = config[field]

        # a too long hint is awful
        if len(str(default)) > 14:
            default = str(default)[:10] + '...'

        # ask untill we have the right type
        value = click.prompt(hint, default=default, type=type_)

        # click doesnt convert() the default if nothing is entered, so it wont be valid
        # however we don't care because default means that we don't have to update
        if value == default:
            LOGGER.debug('same value and default, skipping set. %r == %r', value, default)
            continue

        config[field] = value
1060997
def apply_changes(self):
        """"""
        if self.is_modified:
            self.save_to_conf()
            if self.apply_callback is not None:
                self.apply_callback()

            # Since the language cannot be retrieved by CONF and the language
            # is needed before loading CONF, this is an extra method needed to
            # ensure that when changes are applied, they are copied to a
            # specific file storing the language value. This only applies to
            # the main section config.
            if self.CONF_SECTION == u'main':
                self._save_lang()

            for restart_option in self.restart_options:
                if restart_option in self.changed_options:
                    self.prompt_restart_required()
                    break  # Ensure a single popup is displayed
            self.set_modified(False)
299332
def commit_config(self, message=""):
        """"""
        commit_args = {"comment": message} if message else {}
        self.device.cu.commit(ignore_warning=self.ignore_warning, **commit_args)
        if not self.lock_disable and not self.session_config_lock:
            self._unlock()
1003875
def update_config(self, svc_config, **rt_configs):
    
    path = self._path() + '/config'

    if svc_config:
      data = config_to_api_list(svc_config)
    else:
      data = { }
    if rt_configs:
      rt_list = [ ]
      for rt, cfg in rt_configs.iteritems():
        rt_data = config_to_api_list(cfg)
        rt_data['roleType'] = rt
        rt_list.append(rt_data)
      data[ROLETYPES_CFG_KEY] = rt_list

    resp = self._get_resource_root().put(path, data = json.dumps(data))
    return self._parse_svc_config(resp)
484442
def check_config_mode(self, check_string=")#", pattern="#"):
        """"""
        return super(CiscoNxosSSH, self).check_config_mode(
            check_string=check_string, pattern=pattern
        )
1230450
def configurationChangeAcknowledge():
    """"""
    a = TpPd(pd=0x6)
    b = MessageType(mesType=0x31)  # 00110001
    c = MobileId()
    packet = a / b / c
    return packet
257102
def _prepare_version(self):
        """"""
        if config.VERSION not in self._config:
            self._config[config.VERSION] = __version__
162157
def cli(env):
    """"""

    settings = config.get_settings_from_client(env.client)
    env.fout(config.config_table(settings))
1061192
def config():
    ''''''
    if hasattr(current_app, 'settings_file'):
        log.info('Loaded configuration from %s', current_app.settings_file)

    log.info(white('Current configuration'))
    for key in sorted(current_app.config):
        if key.startswith('__') or not key.isupper():
            continue
        echo('{0}: {1}'.format(white(key), current_app.config[key]))
266797
def on_config_value_changed(self, config_m, prop_name, info):
        
        config_key = info['args'][1]
        # config_value = info['args'][2]

        if config_key == "LIBRARY_PATHS":
            library_manager.refresh_libraries()
        elif config_key == "SHORTCUTS":
            self.refresh_shortcuts()
        elif config_key == "recently_opened_state_machines":
            self._update_recently_opened_state_machines()
446034
def _update_settings(self, dialect):
        """"""

        # the first parameter is the dialect itself --> ignore
        for parameter in self.csv_params[2:]:
            pname, ptype, plabel, phelp = parameter

            widget = self._widget_from_p(pname, ptype)

            if ptype is types.TupleType:
                ptype = types.ObjectType

            digest = Digest(acceptable_types=[ptype])

            if pname == 'self.has_header':
                if self.has_header is not None:
                    widget.SetValue(digest(self.has_header))
            else:
                value = getattr(dialect, pname)
                widget.SetValue(digest(value))
1075134
def _update_cinder_config(cls):
        """"""
        cls._config_string_io.seek(0)
        cls._parser.write(cls._config_string_io)

        # Check if we have any multiopt
        cls._config_string_io.seek(0)
        current_cfg = cls._config_string_io.read()
        if '\n\t' in current_cfg:
            cls._config_string_io.seek(0)
            cls._config_string_io.write(current_cfg.replace('\n\t', '\n'))

        cls._config_string_io.seek(0)
        cfg.CONF.reload_config_files()
95945
def modify_config_file(updates):
    '''
    
    '''
    cmd = '/bin/sed '
    for key in updates:
        cmd = cmd + '-e \'s/^#*{key}.*=.*$/{key}={value}/\' '.format(key=key, value=updates[key])
    cmd = cmd + constants.default_conf_file
    status = run_command_get_output(cmd)
    write_to_disk(constants.default_conf_file, content=status['output'])
134318
static public void update(Configuration configs)
    {
        scoringPolicy = configs.get(MalmoMod.SCORING_CONFIGS, "policy", DEFAULT_NO_SCORING).getInt();
        if (scoringPolicy > 0) {
            String customLogHandler = configs.get(MalmoMod.SCORING_CONFIGS, "handler", "").getString();
            setLogging(Level.INFO, customLogHandler);
        }
        if (logging)
            log("<ScoreInit><Policy>" + scoringPolicy + "</Policy></ScoreInit>");
    }