Manage the computer's name

    name
        The desired computer name
173791
def computer_name(name):
    '''
    
    '''
    # Just in case someone decides to enter a numeric description
    name = six.text_type(name)

    ret = {'name': name,
           'changes': {},
           'result': True,
           'comment': 'Computer name already set to \'{0}\''.format(name)}

    before_name = __salt__['system.get_computer_name']()
    pending_name = __salt__['system.get_pending_computer_name']()

    if before_name == name and pending_name is None:
        return ret
    elif pending_name == name.upper():
        ret['comment'] = ('The current computer name is \'{0}\', but will be '
                          'changed to \'{1}\' on the next reboot'
                          .format(before_name, name))
        return ret

    if __opts__['test']:
        ret['result'] = None
        ret['comment'] = 'Computer name will be changed to \'{0}\''.format(name)
        return ret

    result = __salt__['system.set_computer_name'](name)
    if result is not False:
        after_name = result['Computer Name']['Current']
        after_pending = result['Computer Name'].get('Pending')
        if ((after_pending is not None and after_pending == name) or
                (after_pending is None and after_name == name)):
            ret['comment'] = 'Computer name successfully set to \'{0}\''.format(name)
            if after_pending is not None:
                ret['comment'] += ' (reboot required for change to take effect)'
        ret['changes'] = {'old': before_name, 'new': name}
    else:
        ret['result'] = False
        ret['comment'] = 'Unable to set computer name to \'{0}\''.format(name)
    return ret
669280
def set_device_name(self, newname):
        
        return self.write(request.SetDeviceName(self.seq, *self.prep_str(newname)))
1202179
def resolve_name(name):
    """"""
    logger.debug("resolve_name: %s", name)
    with Database("feeds") as feeds, Database("aliases") as aliases:
        if name in aliases.keys():
            return feeds[aliases[name]]
        elif name in feeds.keys():
            return feeds[name]
        else:
            print("Cannot find feed named: %s" % name)
            return
3313
def name(self, name: str):
        

        self.pathName = os.path.join(self.path, name)
347868
def fix_reference_name(name, blacklist=None):
    """"""
    name = "".join(re.split(r'[^0-9a-zA-Z_]', name))
    while name and not re.match(r'([a-zA-Z]+[0-9a-zA-Z_]*)$', name):
        if not re.match(r'[a-zA-Z]', name[0]):
            name = name[1:]
            continue
    name = str(name)
    if not name:
        name = "data"
    if blacklist is not None and name in blacklist:
        get_new_name = lambda index: name+('%03d' % index)
        index = 0
        while get_new_name(index) in blacklist:
            index += 1
        name = get_new_name(index)
    return name
479785
def set_name(self, new_name):
        

        yield from self._hypervisor.send('ethsw rename "{name}" "{new_name}"'.format(name=self._name, new_name=new_name))
        log.info('Ethernet switch "{name}" [{id}]: renamed to "{new_name}"'.format(name=self._name,
                                                                                   id=self._id,
                                                                                   new_name=new_name))
        self._name = new_name
789569
def nicename(name):
    '''
    '''
    name = to_string(name)
    return capfirst(' '.join(name.replace('-', ' ').replace('_', ' ').split()))
335575
def setName( self, name ):
        
        self._name = projex.text.nativestring(name)
        self.setText(0, ' '.join(projex.text.words(self._name)))
252579
def get_host_name():
    

    if sys.platform == 'win32':
        host = os.getenv('COMPUTERNAME')
    else:
        host = os.uname()[1]


    return host
895025
def _handle_chat_name(self, data):
        """"""

        self.room.user.nick = data
        self.conn.enqueue_data("user", self.room.user)
929078
def name(self, new_name):
        

        if self.startup_config_file:
            content = self.startup_config_content
            content = re.sub(r"^hostname .+$", "hostname " + new_name, content, flags=re.MULTILINE)
            self.startup_config_content = content

        super(IOUVM, IOUVM).name.__set__(self, new_name)
769361
def _unique_name(name, seen):
        """"""
        if name in seen:
            n = seen[name]
            while (name + ".%d" % n) in seen:
                n += 1
            seen[name] = n + 1
            name += ".%d" % n
        seen[name] = 1
        return name
91810
def update_name(self, name):
        """"""
        if name != self.name:
            self.parent.types[name] = self
            del self.parent.types[self.name]
            self.name = name
278033
def computer_desc(name):
    '''
    
    '''
    # Just in case someone decides to enter a numeric description
    name = six.text_type(name)

    ret = {'name': name,
           'changes': {},
           'result': True,
           'comment': 'Computer description already set to \'{0}\''.format(name)}

    before_desc = __salt__['system.get_computer_desc']()

    if before_desc == name:
        return ret

    if __opts__['test']:
        ret['result'] = None
        ret['comment'] = ('Computer description will be changed to \'{0}\''
                          .format(name))
        return ret

    result = __salt__['system.set_computer_desc'](name)
    if result['Computer Description'] == name:
        ret['comment'] = ('Computer description successfully changed to \'{0}\''
                          .format(name))
        ret['changes'] = {'old': before_desc, 'new': name}
    else:
        ret['result'] = False
        ret['comment'] = ('Unable to set computer description to '
                          '\'{0}\''.format(name))
    return ret
622586
def name(self, name):
        
        self._data['name'] = name
        request = self._base_request
        request['name'] = name
        return self._tc_requests.update(request, owner=self.owner)
461404
def make_unique_name(name, existing_names, name_format="{name}_{index}", start=2):
    """"""
    index = start
    new_name = name
    while new_name in existing_names:
        new_name = name_format.format(name=name, index=index)
        index += 1

    return new_name
781724
def __username(self, fname, lname):  # pragma: no cover
        """"""
        self.username = '.'.join([i.lower() for i in [fname, lname]])