Ensure that global network settings are configured properly.

    name
        Custom name to represent this configuration change.

    kwargs
        The global parameters for the system.
503222
def system(name, **kwargs):
    '''
    

    '''
    ret = {
        'name': name,
        'changes': {},
        'result': True,
        'comment': 'Global network settings are up to date.',
    }
    apply_net_settings = False
    kwargs['test'] = __opts__['test']
    # Build global network settings
    try:
        old = __salt__['ip.get_network_settings']()
        new = __salt__['ip.build_network_settings'](**kwargs)
        if __opts__['test']:
            if old == new:
                return ret
            if not old and new:
                ret['result'] = None
                ret['comment'] = 'Global network settings are set to be added.'
                return ret
            elif old != new:
                diff = difflib.unified_diff(old, new, lineterm='')
                ret['result'] = None
                ret['comment'] = 'Global network settings are set to be ' \
                                 'updated:\n{0}'.format('\n'.join(diff))
                return ret
        if not old and new:
            apply_net_settings = True
            ret['changes']['network_settings'] = 'Added global network settings.'
        elif old != new:
            diff = difflib.unified_diff(old, new, lineterm='')
            apply_net_settings = True
            ret['changes']['network_settings'] = '\n'.join(diff)
    except AttributeError as error:
        ret['result'] = False
        ret['comment'] = six.text_type(error)
        return ret
    except KeyError as error:
        ret['result'] = False
        ret['comment'] = six.text_type(error)
        return ret

    # Apply global network settings
    if apply_net_settings:
        try:
            __salt__['ip.apply_network_settings'](**kwargs)
        except AttributeError as error:
            ret['result'] = False
            ret['comment'] = six.text_type(error)
            return ret

    return ret
378379
private void set(String name, String location) {
    if (name != null && name.contains(PATH_SEPARATOR_STR))
      throw new IllegalArgumentException(
                                         "Network location name contains /: "+name);
    this.name = (name==null)?"":name;
    this.location = location;      
  }
850618
def setNetworkName(self, networkName='GRL'):
        
        print '%s call setNetworkName' % self.port
        print networkName
        try:
            cmd = 'networkname %s' % networkName
            datasetCmd = 'dataset networkname %s' % networkName
            self.hasActiveDatasetToCommit = True
            return self.__sendCommand(cmd)[0] == 'Done' and self.__sendCommand(datasetCmd)[0] == 'Done'
        except Exception, e:
            ModuleHelper.WriteIntoDebugLogger("setNetworkName() Error: " + str(e))
490594
def _load_custom(self, settings_name='localsettings.py'):
        '''
        

        '''
        if settings_name[-3:] == '.py':
            settings_name = settings_name[:-3]

        new_settings = {}
        try:
            settings = importlib.import_module(settings_name)
            new_settings = self._convert_to_dict(settings)
        except ImportError:
            log.info("No override settings found")

        for key in new_settings:
            if key in self.my_settings:
                item = new_settings[key]
                if isinstance(item, dict) and \
                        isinstance(self.my_settings[key], dict):
                    for key2 in item:
                        self.my_settings[key][key2] = item[key2]
                else:
                    self.my_settings[key] = item
            else:
                self.my_settings[key] = new_settings[key]
228724
def _check_global_settings():
    
    global settings
    if settings is not None:
        #We must have already loaded this and everything was okay!
        return True
    
    from os import getenv
    result = False
    
    if getenv("PYCI_XML") is None:
        err("The environment variable PYCI_XML for the global configuration "
            "has not been set.")
    else:
        from os import path
        fullpath = path.abspath(path.expanduser(getenv("PYCI_XML")))
        if not path.isfile(fullpath):
            err("The file {} for global configuration does not exist.".format(fullpath))
        else:
            from pyci.config import GlobalSettings
            settings = GlobalSettings()
            result = True

    return result
1251309
private function set_global_variable()
    {
        $var_name = "";
        
        if( null != $this->config->global_variable )
        {
            $var_name = $this->config->global_variable;
        }
        else
        {
            $var_name = $this->page->get_slug().'_options';
        }
        
        $GLOBALS[$var_name] = $this->options->get();
    }
1191740
def put_settings(self, using=None, **kwargs):
        
        return self._get_connection(using).indices.put_settings(index=self._name, **kwargs)
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)
388856
def activate_conf_set(self, set_name):
        '''

        '''
        with self._mutex:
            if not set_name in self.conf_sets:
                raise exceptions.NoSuchConfSetError(set_name)
            self._conf.activate_configuration_set(set_name)
39982
def setup(self, **kwargs):
        

        for key in kwargs:
            if key not in self.config.keys():
                raise error.GrabMisuseError('Unknown option: %s' % key)

        if 'url' in kwargs:
            if self.config.get('url'):
                kwargs['url'] = self.make_url_absolute(kwargs['url'])
        self.config.update(kwargs)
609333
def config(self, settings):
        
        self.debug("()")
        # TODO synchronize access to vars
        try:
            self._device_id = settings['device_id']

            self._packet_timeout = settings.get(
                'packet_wait_timeout',
                self._packet_timeout
            )
            self._server_ip = settings.get('server_ip', self._server_ip)
            self._server_port = settings.get('server_port', self._server_port)
        except KeyError:
            raise SensorUpdateException("Key not in settings")

        if callable(self.on_config):
            try:
                self.on_config(settings)
            except:
                self.exception("Failed to update remote config")
                raise SensorUpdateException("Remote config failed")
1132539
def get_setting(*args, **kwargs):
    """"""
    for name in args:
        if hasattr(settings, name):
            return getattr(settings, name)
    if kwargs.get('raise_error', False):
        setting_url = url % args[0].lower().replace('_', '-')
        raise ImproperlyConfigured('Please make sure you specified at '
            'least one of these settings: %s \r\nDocumentation: %s'
            % (args, setting_url))
    return kwargs.get('default_value', None)
479157
private static String[] adjustConf(String[] argv, Configuration conf) {
    String[] serviceId = new String[] { "" };
    String[] filteredArgv = DFSUtil.getServiceName(argv, serviceId);
    
    if (!serviceId[0].equals("")) {
      NameNode.checkServiceName(conf, serviceId[0]);
      DFSUtil.setGenericConf(conf, serviceId[0],
          NameNode.NAMESERVICE_SPECIFIC_KEYS);
      NameNode.setupDefaultURI(conf);
    }
    
    // make it avatar aware (manual option)
    if (optionExist(argv, "-one")) {
      updateConfKeys(conf, "1", serviceId[0]);
    } else {
      updateConfKeys(conf, "0", serviceId[0]);
    }
    return filteredArgv;
  }
684743
public void setGlobalSetting(String name, String value) {
        String oldValue;

        // Avoid redundant setting
        if (globalSettings.containsKey(name)) {
            oldValue = globalSettings.get(name);
            if (value.compareTo(oldValue) == 0)
                return;
        }
        globalSettings.put(name, value);
        setDirty(true);
    }
228183
protected function setDefaultParameters()
    {
        if (!$this->connection) {
            return;
        }
        $this->parameters['_domainname_'] = $this->connection->getConfig()->getDomainName();
        $rootDse = $this->connection->getRootDse();

        // Would this ever not be true? I'm unable to find any RFCs specifically regarding Root DSE structure.
        if ($rootDse->has('defaultNamingContext')) {
            $this->parameters['_defaultnamingcontext_'] = $rootDse->get('defaultNamingContext');
        }
        if ($rootDse->has('configurationNamingContext')) {
            $this->parameters['_configurationnamingcontext_'] = $rootDse->get('configurationNamingContext');
        }
    }
1011570
def add_global(self, globalvalue):
        
        assert globalvalue.name not in self.globals
        self.globals[globalvalue.name] = globalvalue
1105439
function(config) {
			if (initialized) {
				error(new Error('Cannot set global configuration after application initialization'));
				return;
			}

			for (var prop in config) {
				if (config.hasOwnProperty(prop)) {
					globalConfig[prop] = config[prop];
				}
			}
		}