Add one or more config lines to the switch running config

    .. code-block:: bash

        salt '*' onyx.cmd add_config 'snmp-server community TESTSTRINGHERE rw'

    .. note::
        For more than one config added per command, lines should be a list.
480918
def add_config(lines):
    '''
    
    '''
    if not isinstance(lines, list):
        lines = [lines]
    try:
        enable()
        configure_terminal()
        for line in lines:
            sendline(line)

        configure_terminal_exit()
        disable()
    except TerminalException as e:
        log.error(e)
        return False
    return True
23125
function addUserSSLConfig(config) {
  if (config.https === true) {
    try {
      config.https = {
        cert: readFileSync(getSSLPath(config.host, SERVER_CERT_FILENAME)),
        key: readFileSync(getSSLPath(config.host, SERVER_KEY_FILENAME))
      };
    } catch (e) {}
  }

  return config;
}
448372
def command_new_config(self):
        
        if len(self.args) == 1 and self.args[0] == "new-config":
            NewConfig().run()
        else:
            usage("")
912450
async def updateconfig(self):
        ""
        exists = {}
        for s in self.connections:
            exists[(s.protocol.vhost, s.rawurl)] = s
        self._createServers(self, '', exists = exists)
        for _,v in exists.items():
            await v.shutdown()
            self.connections.remove(v)
418657
function ( conf ) {
    serverConfig = sqsUtil.copy( conf.server );

    serverConfig.siteurl = serverConfig.siteurl.replace( rSlash, "" );
    serverConfig.port = (serverConfig.port || 5050);
    serverConfig.webroot = process.cwd();
    serverConfig.protocol = serverConfig.siteurl.match( rProtocol )[ 0 ];
    serverConfig.siteData = {};

    // Set config for middleware
    sqsWare.set( "siteurl", serverConfig.siteurl );

    if ( serverConfig.password ) {
        sqsWare.set( "sitepassword", serverConfig.password );
    }

    if ( serverConfig.sandbox ) {
        sqsWare.set( "sandboxmode", true );
    }

    if ( serverConfig.fulldata !== undefined ) {
        sqsWare.set( "fulldata", serverConfig.fulldata );
    }

    sqsTemplate.setConfig( "server", serverConfig );
}
587311
def build_network_settings(**settings):
    '''
    
    '''
    changes = []

    # Read current configuration and store default values
    current_network_settings = _parse_current_network_settings()

    # Build settings
    opts = _parse_network_settings(settings, current_network_settings)

    # Ubuntu has moved away from /etc/default/networking
    # beginning with the 12.04 release so we disable or enable
    # the networking related services on boot
    skip_etc_default_networking = (
        __grains__['osfullname'] == 'Ubuntu' and
        int(__grains__['osrelease'].split('.')[0]) >= 12)
    if skip_etc_default_networking:
        if opts['networking'] == 'yes':
            service_cmd = 'service.enable'
        else:
            service_cmd = 'service.disable'

        if __salt__['service.available']('NetworkManager'):
            __salt__[service_cmd]('NetworkManager')

        if __salt__['service.available']('networking'):
            __salt__[service_cmd]('networking')
    else:
        try:
            template = JINJA.get_template('network.jinja')
        except jinja2.exceptions.TemplateNotFound:
            log.error('Could not load template network.jinja')
            return ''
        network = template.render(opts)

        if 'test' in settings and settings['test']:
            return _read_temp(network)
        # Write settings
        _write_file_network(network, _DEB_NETWORKING_FILE, True)

    # Get hostname and domain from opts
    sline = opts['hostname'].split('.', 1)
    opts['hostname'] = sline[0]
    current_domainname = current_network_settings['domainname']
    current_searchdomain = current_network_settings['searchdomain']

    new_domain = False
    if len(sline) > 1:
        new_domainname = sline[1]
        if new_domainname != current_domainname:
            domainname = new_domainname
            opts['domainname'] = new_domainname
            new_domain = True
        else:
            domainname = current_domainname
            opts['domainname'] = domainname
    else:
        domainname = current_domainname
        opts['domainname'] = domainname

    new_search = False
    if 'search' in opts:
        new_searchdomain = opts['search']
        if new_searchdomain != current_searchdomain:
            searchdomain = new_searchdomain
            opts['searchdomain'] = new_searchdomain
            new_search = True
        else:
            searchdomain = current_searchdomain
            opts['searchdomain'] = searchdomain
    else:
        searchdomain = current_searchdomain
        opts['searchdomain'] = searchdomain

    # If the domain changes, then we should write the resolv.conf file.
    if new_domain or new_search:
        # Look for existing domain line and update if necessary
        resolve = _parse_resolve()
        domain_prog = re.compile(r'domain\s+')
        search_prog = re.compile(r'search\s+')
        new_contents = []

        for item in _read_file(_DEB_RESOLV_FILE):
            if domain_prog.match(item):
                item = 'domain {0}'.format(domainname)
            elif search_prog.match(item):
                item = 'search {0}'.format(searchdomain)
            new_contents.append(item)

        # A domain line didn't exist so we'll add one in
        # with the new domainname
        if 'domain' not in resolve:
            new_contents.insert(0, 'domain {0}' . format(domainname))

        # A search line didn't exist so we'll add one in
        # with the new search domain
        if 'search' not in resolve:
            new_contents.insert('domain' in resolve, 'search {0}'.format(searchdomain))

        new_resolv = '\n'.join(new_contents)

        # Write /etc/resolv.conf
        if not ('test' in settings and settings['test']):
            _write_file_network(new_resolv, _DEB_RESOLV_FILE)

    #  used for returning the results back
    try:
        template = JINJA.get_template('display-network.jinja')
    except jinja2.exceptions.TemplateNotFound:
        log.error('Could not load template display-network.jinja')
        return ''
    network = template.render(opts)
    changes.extend(_read_temp(network))

    return changes
323140
private int showConfig(String cmd, String argv[], int startindex)
      throws IOException {
    int exitCode = 0;
    PolicyInfo[] all = raidnode.getAllPolicies();
    for (PolicyInfo p: all) {
      out.println(p);
    }
    return exitCode;
  }
443083
def build_network_settings(**settings):
    '''
    
    '''
    if __grains__['lsb_distrib_id'] == 'nilrt':
        raise salt.exceptions.CommandExecutionError('Not supported in this version.')
    changes = []
    if 'networking' in settings:
        if settings['networking'] in _CONFIG_TRUE:
            __salt__['service.enable']('connman')
        else:
            __salt__['service.disable']('connman')

    if 'hostname' in settings:
        new_hostname = settings['hostname'].split('.', 1)[0]
        settings['hostname'] = new_hostname
        old_hostname = __salt__['network.get_hostname']
        if new_hostname != old_hostname:
            __salt__['network.mod_hostname'](new_hostname)
            changes.append('hostname={0}'.format(new_hostname))

    return changes
649607
function addConfig(config) {
	lDebug('Check configuration');

	if(!config.root_path) {
    throw new Error('Config need root_path');
  }

  if(config.root_path.substr(-1) !== '/') {
    config.root_path += '/';
  }

	if(!config) {
		config = {};
	}

	const envs = [
		{name: 'rtorrent_host', default: '127.0.0.1'},
		{name: 'rtorrent_port', default: '8080'},
		{name: 'rtorrent_path', default: '/RPC2'},
    {name: 'dir_torrent', default: `${config.root_path}dtorrent/torrent/`},
    {name: 'dir_downloaded', default: `${config.root_path}dtorrent/downloaded/`},
    {name: 'dir_log', default: `${config.root_path}dtorrent/logs/`},
	];

	for(const i in envs) {
		if(config && config[envs[i].name]) {
			process.env[envs[i].name.toUpperCase()] = config[envs[i].name];
		} else if(!process.env[envs[i].name.toUpperCase()]) {
			process.env[envs[i].name.toUpperCase()] = envs[i].default;
		}
	}

	const configs = [
		{name: 'interval_check', default: 1500},
		{name: 'client', default: require('./src/clients/rTorrent')}
	];

	for(const i in configs) {
		if(config && config[configs[i].name]) {
			config[configs[i].name] = config[configs[i].name];
		} else {
			config[configs[i].name] = configs[i].default;
		}
	}

	return config;
}
315464
def add_options(self):
        
        super(AdminTool, self).add_options()

        self.add_bool_option("--create-config",
            help="create default configuration")
        self.add_bool_option("--remove-all-rc-files",
            help="write new versions of BOTH .rc and .rc.default files, and remove stale ones")
        self.add_bool_option("--dump-config",
            help="pretty-print configuration including all defaults")
        self.add_value_option("--create-import", "GLOB-PATTERN",
            action="append", default=[],
            help="create import file for a '.d' directory")
        self.add_bool_option("--dump-rc",
            help="pretty-print dynamic commands defined in 'rtorrent.rc'")
        self.add_value_option("-o", "--output", "KEY,KEY1.KEY2=DEFAULT,...",
            action="append", default=[],
            help="select fields to print, output is separated by TABs;"
                 " default values can be provided after the key")
        self.add_bool_option("--reveal",
            help="show config internals and full announce URL including keys")
        self.add_bool_option("--screenlet",
            help="create screenlet stub")
96787
def _nxapi_config(commands, methods='cli_conf', bsb_arg=None, **kwargs):
    '''
    
    '''
    api_kwargs = __salt__['config.get']('nxos', {})
    api_kwargs.update(**kwargs)
    if not isinstance(commands, list):
        commands = [commands]
    try:
        ret = _nxapi_request(commands, **kwargs)
        if api_kwargs.get('no_save_config'):
            pass
        else:
            _nxapi_request(COPY_RS, **kwargs)
        for each in ret:
            if 'Failure' in each:
                log.error(each)
    except CommandExecutionError as e:
        log.error(e)
        return [commands, repr(e)]
    return [commands, ret]
1025375
def set_snmp(community, host=None,
             admin_username=None, admin_password=None):
    '''
    
    '''
    return __execute_cmd('config -g cfgOobSnmp -o '
                         'cfgOobSnmpAgentCommunity {0}'.format(community),
                         host=host, admin_username=admin_username,
                         admin_password=admin_password)
71593
def apply_config(self, config):
        
        self.haproxy_config_path = config["config_file"]

        global_stanza = Stanza("global")
        global_stanza.add_lines(config.get("global", []))
        global_stanza.add_lines([
            "stats socket %s mode 600 level admin" % config["socket_file"],
            "stats timeout 2m"
        ])

        defaults_stanza = Stanza("defaults")
        defaults_stanza.add_lines(config.get("defaults", []))

        proxy_stanzas = [
            ProxyStanza(
                name, proxy["port"], proxy["upstreams"],
                proxy.get("options", []),
                proxy.get("bind_address")
            )
            for name, proxy in six.iteritems(config.get("proxies", {}))
        ]

        stats_stanza = None
        if "stats" in config:
            stats_stanza = StatsStanza(
                config["stats"]["port"], config["stats"].get("uri", "/")
            )
            for timeout in ("client", "connect", "server"):
                if timeout in config["stats"].get("timeouts", {}):
                    stats_stanza.add_line(
                        "timeout %s %d" % (
                            timeout,
                            config["stats"]["timeouts"][timeout]
                        )
                    )

        self.config_file = HAProxyConfig(
            global_stanza, defaults_stanza,
            proxy_stanzas=proxy_stanzas, stats_stanza=stats_stanza,
            meta_clusters=config.get("meta_clusters", {}),
            bind_address=config.get("bind_address")
        )

        self.control = HAProxyControl(
            config["config_file"], config["socket_file"], config["pid_file"],
        )
1356004
function addCommandOnCmdEditor (config) {

	var cmd_name = null;

	var promise = inquirer.prompt([{
		type: 'input',
		name: 'cmdName',
		message: 'What is name of a command (e.g. setMotorPower) ?',
		validate: function (value) {
			if (value.length == 0) return true;
			if (config.commands[value] != null) return 'This command name has already existed.';
			if (!value.match(/^[A-Za-z0-9_]+$/)) return 'Available characters for argument name: A-Z, a-z, 0-9, underscore.\n\
Or, if you want to cancel, please press the enter key left empty.';
			return true;
		}

	}]).then(function (answer) {

		cmd_name = answer.cmdName || null;
		if (cmd_name == null || cmd_name.length == 0) {
			return null;
		}

		return inquirer.prompt([{
			type: 'input',
			name: 'cmdDesc',
			message: 'What is description of ' + cmd_name + ' command ?'
		}]);


	}).then(function (answer) {

		if (cmd_name == null) return false;

		var commands = config.commands || {};
		commands[cmd_name] = {
			description: answer.cmdDesc || null,
			args: {}
		};

		// Done
		console.log(colors.bold.green('This command has been created: ' + cmd_name));

		// Save to the commands file
		console.log('\nWriting to ' + process.cwd() + '/' + COMMANDS_FILENAME);
		fs.writeFileSync(COMMANDS_FILENAME, JSON.stringify(config.commands));
		console.log('Writing has been completed.\n\n');
		return true;

	});

	return promise;

}
560012
def add(name, **kwargs):
    
    _CONFIG.add_section(name)

    for (key, value) in kwargs.items():
        _CONFIG.set(name, key, value)

    with open(_CONFIG_FILEPATH, 'w') as configfile:
        _CONFIG.write(configfile)

    info('Configuration updated at %s' % _JUT_HOME)
741129
def add_nio(self, nio, port_number):
        

        if port_number in self._nios:
            raise DynamipsError("Port {} isn't free".format(port_number))

        yield from self._hypervisor.send('ethsw add_nio "{name}" {nio}'.format(name=self._name, nio=nio))

        log.info('Ethernet switch "{name}" [{id}]: NIO {nio} bound to port {port}'.format(name=self._name,
                                                                                          id=self._id,
                                                                                          nio=nio,
                                                                                          port=port_number))
        self._nios[port_number] = nio
        for port_settings in self._ports:
            if port_settings["port_number"] == port_number:
                yield from self.set_port_settings(port_number, port_settings)
                break
383768
private void configureServer(ServerBartender server)
  {
    // XXX: mixing server/client
    
    ServerNetwork serverNet = _serverMap.get(server.getId());
    
    if (serverNet == null) {
      serverNet = new ServerNetwork(_system, server);
      
      configServer(serverNet, server);

      serverNet.init();
      
      _serverMap.put(server.getId(), serverNet);
    }
  }