Change the group of a host given the name of the host.
		@type name: str
		@type group: str
421428
def change_group(self, name, group):
		
		m1 = OmapiMessage.open(b"host")
		m1.update_object(dict(name=name))
		r1 = self.query_server(m1)
		if r1.opcode != OMAPI_OP_UPDATE:
			raise OmapiError("opening host %s failed" % name)
		m2 = OmapiMessage.update(r1.handle)
		m2.update_object(dict(group=group))
		r2 = self.query_server(m2)
		if r2.opcode != OMAPI_OP_UPDATE:
			raise OmapiError("changing group of host %s to %s failed" % (name, group))
231743
def add(self, host, **kwargs):
        
        if host in self.hosts_:
            raise ValueError("Host %s: exists (use update)." % host)
        self.hosts_.add(host)
        self.lines_.append(ConfigLine(line="", host=None))
        self.lines_.append(ConfigLine(line="Host %s" % host, host=host, key="Host", value=host))
        for k, v in kwargs.items():
            if type(v) not in [list, tuple]:
                v = [v]
            mapped_k = _remap_key(k)
            for value in v:
                self.lines_.append(ConfigLine(line="  %s %s" % (mapped_k, str(value)), host=host, key=mapped_k, value=value))
        self.lines_.append(ConfigLine(line="", host=None))
68719
def do_bulk_config_update(hostnames):
  
  api = ApiResource(CM_HOST, username=CM_USER, password=CM_PASSWD)
  hosts = collect_hosts(api, hostnames)

  # Set config
  for h in hosts:
    configure_roles_on_host(api, h)
643782
def add_host(self, name: str, **kwargs) -> None:
        
        host = {
            name: deserializer.inventory.InventoryElement.deserialize_host(
                name=name, defaults=self.defaults, **kwargs
            )
        }
        self.hosts.update(host)
1048023
def push(self, my_dict, key, element):
        '''  '''
        group_info = my_dict.setdefault(key, [])
        if isinstance(group_info, dict):
            host_list = group_info.setdefault('hosts', [])
            host_list.append(element)
        else:
            group_info.append(element)
1332977
def _expand_host(self, host):
        
        if isinstance(host, basestring):
            return (host, self.default_port)
        return tuple(host)
634145
def rename(self, **kwargs):
        ''''''
        for old, new in kwargs.iteritems():
            if old in self.groups:
                self.groups[new] = self.groups[old]
                del self.groups[old]
1012960
def hostname=(new_hostname)
      if new_hostname &&
          (new_hostname.respond_to?(:ipv4?) || new_hostname.respond_to?(:ipv6?))
        new_hostname = new_hostname.to_s
      elsif new_hostname && !new_hostname.respond_to?(:to_str)
        raise TypeError, "Can't convert #{new_hostname.class} into String."
      end
      v = new_hostname ? new_hostname.to_str : nil
      v = "[#{v}]" if /\A\[.*\]\z/ !~ v && /:/ =~ v
      self.host = v
    end
1106307
def set_hostname!(new_hostname)
      raise ArgumentError, "The new hostname cannot be nil" unless new_hostname
      raise ArgumentError, "The new hostname cannot be empty" if new_hostname.empty?

      edit_template = {
        "hostname" => new_hostname
      }

      self.service.editObject(edit_template)
      self.refresh_details()
    end
38735
public void changeGroup(String group, String file)
        throws IOException, ServerException {
        String arguments = group + " " + file;
        Command cmd = new Command("SITE CHGRP", arguments);
        try {
            controlChannel.execute(cmd);
        } catch (UnexpectedReplyCodeException urce) {
            throw ServerException.embedUnexpectedReplyCodeException(urce);
        } catch (FTPReplyParseException rpe) {
            throw ServerException.embedFTPReplyParseException(rpe);
        }
    }
1341502
def get_members_of_group(self, gname):
        
        hostgroup = self.find_by_name(gname)
        if hostgroup:
            return hostgroup.get_hosts()
        return []
1263816
def children_of_group(self, group: Union[str, Group]) -> Set[Host]:
        
        hosts: List[Host] = set()
        for host in self.hosts.values():
            if host.has_parent_group(group):
                hosts.add(host)
        return hosts
548330
def _mirror_groups(self):
        
        target_group_names = frozenset(self._get_groups().get_group_names())
        current_group_names = frozenset(
            self._user.groups.values_list("name", flat=True).iterator()
        )

        # These were normalized to sets above.
        MIRROR_GROUPS_EXCEPT = self.settings.MIRROR_GROUPS_EXCEPT
        MIRROR_GROUPS = self.settings.MIRROR_GROUPS

        # If the settings are white- or black-listing groups, we'll update
        # target_group_names such that we won't modify the membership of groups
        # beyond our purview.
        if isinstance(MIRROR_GROUPS_EXCEPT, (set, frozenset)):
            target_group_names = (target_group_names - MIRROR_GROUPS_EXCEPT) | (
                current_group_names & MIRROR_GROUPS_EXCEPT
            )
        elif isinstance(MIRROR_GROUPS, (set, frozenset)):
            target_group_names = (target_group_names & MIRROR_GROUPS) | (
                current_group_names - MIRROR_GROUPS
            )

        if target_group_names != current_group_names:
            existing_groups = list(
                Group.objects.filter(name__in=target_group_names).iterator()
            )
            existing_group_names = frozenset(group.name for group in existing_groups)

            new_groups = [
                Group.objects.get_or_create(name=name)[0]
                for name in target_group_names
                if name not in existing_group_names
            ]

            self._user.groups.set(existing_groups + new_groups)
802665
def filter_host_by_name(name):
    

    def inner_filter(items):
        """Inner filter for host. Accept if host_name == name"""
        host = items["host"]
        if host is None:
            return False
        return host.host_name == name

    return inner_filter
258080
def change_channel_group(self, group):
        """"""
        assert self._probe is not None
        self._channels = _probe_channels(self._probe, group)
        self._positions = _probe_positions(self._probe, group)
110359
def merge(self, hosts):
        
        for extinfo in self:
            host_name = extinfo.get_name()
            host = hosts.find_by_name(host_name)
            if host is not None:
                # Fusion
                self.merge_extinfo(host, extinfo)
483343
def delete_old_host(self, hostname):
        
        host = Host(self.session, name=hostname)
        return host.delete()