Sets the configuration's name. This function is intended to be used from
    states.

    CLI Example:

    .. code-block:: bash

        salt '*' syslog_ng.set_config_file name=/etc/syslog-ng
551298
def set_config_file(name):
    '''
    

    '''
    global __SYSLOG_NG_CONFIG_FILE
    old = __SYSLOG_NG_CONFIG_FILE
    __SYSLOG_NG_CONFIG_FILE = name
    changes = _format_changes(old, name)
    return _format_state_result(name, result=True, changes=changes)
1012284
def __set_name(self, value):
        '''
        
        '''
        if not value or not len(value):
            raise ValueError("Invalid name.")

        self.__name = value
168104
def edit(self, config, state, name, value=None):
        
        config = str(config)  # make a copy so we can alter it
        matches = list(self._GRUB_KERNEL_BOOT_ENTRY.finditer(config))
        # process matches in reverse order, so replacing one match
        # does not alter the start/end positions of other matches
        for match in reversed(matches):
            start = match.end()
            # Linux command line extends up to the newline
            if config[start] == '\n':
                cmdline = ''
            else:
                end = config.find('\n', start)
                cmdline = config[start:end]
            new_cmdline = _assemble_linux_cmdline(cmdline, state, name, value)
            config = config[:start] + new_cmdline + config[end:]
        return config
626721
def set_name(self, name):
        

        if len(name) > 6:
            raise ArgumentError("Name must be at most 6 characters long", name=name)

        if len(name) < 6:
            name += ' '*(6 - len(name))

        self.name = name
145094
def _set_syslog_config_helper(host, username, password, syslog_config, config_value,
                              protocol=None, port=None, reset_service=None, esxi_host=None, credstore=None):
    '''
    
    '''
    cmd = 'system syslog config set --{0} {1}'.format(syslog_config, config_value)
    ret_dict = {}

    valid_resets = ['logdir', 'loghost', 'default-rotate',
                    'default-size', 'default-timeout', 'logdir-unique']
    if syslog_config not in valid_resets:
        ret_dict.update({'success': False,
                         'message': '\'{0}\' is not a valid config variable.'.format(syslog_config)})
        return ret_dict

    response = salt.utils.vmware.esxcli(host, username, password, cmd,
                                        protocol=protocol, port=port,
                                        esxi_host=esxi_host, credstore=credstore)

    # Update the return dictionary for success or error messages.
    if response['retcode'] != 0:
        ret_dict.update({syslog_config: {'success': False,
                                         'message': response['stdout']}})
    else:
        ret_dict.update({syslog_config: {'success': True}})

    # Restart syslog for each host, if desired.
    if reset_service:
        if esxi_host:
            host_name = esxi_host
            esxi_host = [esxi_host]
        else:
            host_name = host
        response = syslog_service_reload(host, username, password,
                                         protocol=protocol, port=port,
                                         esxi_hosts=esxi_host, credstore=credstore).get(host_name)
        ret_dict.update({'syslog_restart': {'success': response['retcode'] == 0}})

    return ret_dict
978882
def persist(name, value, config='/etc/sysctl.conf'):
    '''
    
    '''
    nlines = []
    edited = False
    value = six.text_type(value)

    # create /etc/sysctl.conf if not present
    if not os.path.isfile(config):
        try:
            with salt.utils.files.fopen(config, 'w+'):
                pass
        except (IOError, OSError):
            msg = 'Could not create {0}'
            raise CommandExecutionError(msg.format(config))

    with salt.utils.files.fopen(config, 'r') as ifile:
        for line in ifile:
            line = salt.utils.stringutils.to_unicode(line)
            m = re.match(r'{0}(\??=)'.format(name), line)
            if not m:
                nlines.append(line)
                continue
            else:
                key, rest = line.split('=', 1)
                if rest.startswith('"'):
                    _, rest_v, rest = rest.split('"', 2)
                elif rest.startswith('\''):
                    _, rest_v, rest = rest.split('\'', 2)
                else:
                    rest_v = rest.split()[0]
                    rest = rest[len(rest_v):]
                if rest_v == value:
                    return 'Already set'
                new_line = '{0}{1}{2}{3}'.format(name, m.group(1), value, rest)
                nlines.append(new_line)
                edited = True

    if not edited:
        newline = '{0}={1}'.format(name, value)
        nlines.append("{0}\n".format(newline))

    with salt.utils.files.fopen(config, 'wb') as ofile:
        ofile.writelines(
            salt.utils.data.encode(nlines)
        )

    assign(name, value)

    return 'Updated'
335575
def setName( self, name ):
        
        self._name = projex.text.nativestring(name)
        self.setText(0, ' '.join(projex.text.words(self._name)))
759008
def load(self, filename=None):
        
        if not filename:
            filename = self.default_config_file

        files = self._cfgs_to_read()
        # insert last, so it will override all values,
        # which have already been set in previous files.
        files.insert(-1, filename)

        try:
            config = self.__read_cfg(files)
        except ReadConfigException as e:
            print(Config._format_msg('config.load("{file}") failed with {error}'.format(file=filename, error=e)))
        else:
            self._conf_values = config

        # notice user?
        if self.show_config_notification and not self.cfg_dir:
            print(Config._format_msg("no configuration directory set or usable."
                                      " Falling back to defaults."))
278089
def set_name(self, name):
        
        path = self._filename.split("/")
        parts = path[-1].split(".")
        if len(parts) == 1:
            path[-1] = name
        else:
            path[-1] = name + "." + parts[-1]
        return File("/".join(path))
1173440
function setOptName(opt, optKey) {
    var key$ = optKey + '$';
    opts[key$] = opts[key$] || {};
    var name = opt.name || fspath.basename(opt.path);
    while (opts[key$][name]) {
      name = '_' + name;
    }
    opts[key$][name] = opt;
    opt.name = name;
  }
922489
def config_dir_setup(filename):
    
    path = os.path.dirname(filename)
    if not os.path.isdir(path):
        Shell.mkdir(path)
1226031
protected function setFilename() {
    if (is_object($this->file)) {
      if (!isset($this->file->{$this->filename_field})) {
        return FALSE;
      }

      $this->file_name = $this->file->{$this->filename_field};
      return TRUE;
    }

    if (is_array($this->file)) {
      $this->file_name = $field[$this->filename_field];
      return TRUE;
    }

    if (is_string($this->file)) {
      $this->file_name = $this->file;
      return TRUE;
    }

    return FALSE;
  }
1097207
def _set_default_resource_names(self):
        
        self.ip_config_name = ''.join([
            self.running_instance_id, '-ip-config'
        ])
        self.nic_name = ''.join([self.running_instance_id, '-nic'])
        self.public_ip_name = ''.join([self.running_instance_id, '-public-ip'])
711456
def active_conf_set_name(self):
        ''''''
        with self._mutex:
            if not self.conf_sets:
                return ''
            if not self._active_conf_set:
                return ''
            return self._active_conf_set
404126
def persist(name, value, config='/etc/sysctl.conf'):
    '''
    
    '''
    nlines = []
    edited = False
    value = six.text_type(value)

    with salt.utils.files.fopen(config, 'r') as ifile:
        for line in ifile:
            line = salt.utils.stringutils.to_unicode(line).rstrip('\n')
            if not line.startswith('{0}='.format(name)):
                nlines.append(line)
                continue
            else:
                key, rest = line.split('=', 1)
                if rest.startswith('"'):
                    _, rest_v, rest = rest.split('"', 2)
                elif rest.startswith('\''):
                    _, rest_v, rest = rest.split('\'', 2)
                else:
                    rest_v = rest.split()[0]
                    rest = rest[len(rest_v):]
                if rest_v == value:
                    return 'Already set'
                new_line = _formatfor(key, value, config, rest)
                nlines.append(new_line)
                edited = True
    if not edited:
        nlines.append("{0}\n".format(_formatfor(name, value, config)))
    with salt.utils.files.fopen(config, 'w+') as ofile:
        nlines = [salt.utils.stringutils.to_str(_l) + '\n' for _l in nlines]
        ofile.writelines(nlines)
    if config != '/boot/loader.conf':
        assign(name, value)
    return 'Updated'
1027512
def save_config(self, config_file_name):
        

        with open(config_file_name, 'w+') as f:
            f.write('P_RESET\n')
            for line in self.send_command_return_multilines('p_fullconfig', '?'):
                f.write(line.split(' ', 1)[1].lstrip())
1101868
public void setName(String name) {

        String oufqn = getOufqn();
        if (oufqn != null) {
            if (!oufqn.endsWith("/")) {
                oufqn += "/";
            }
        } else {
            oufqn = "/";
        }
        m_project.setName(oufqn + name);

    }