Change cluster attributes
165858
def _put_cluster(self, dic, params=None):
    """"""
    cluster = self._put('', ApiCluster, data=dic, params=params)
    self._update(cluster)
    return self
868673
def restart_cluster(name):
    '''
    

    '''
    ret = {'name': name,
           'changes': {},
           'result': None,
           'comment': ''}

    if __opts__['test']:
        ret['comment'] = 'Restarting cluster'
        return ret

    __salt__['trafficserver.restart_cluster']()

    ret['result'] = True
    ret['comment'] = 'Restarted cluster'
    return ret
1092344
def set_defaults(config, cluster_name):
    
    config['postgresql'].setdefault('name', cluster_name)
    config['postgresql'].setdefault('scope', cluster_name)
    config['postgresql'].setdefault('listen', '127.0.0.1')
    config['postgresql']['authentication'] = {'replication': None}
    config['restapi']['listen'] = ':' in config['restapi']['listen'] and config['restapi']['listen'] or '127.0.0.1:8008'
195695
function setClusterOptions($zoom="null", $gridsize="null", $styles="null"){
    	$this->marker_clusterer_options["maxZoom"]=$zoom;
    	$this->marker_clusterer_options["gridSize"]=$gridsize;
    	$this->marker_clusterer_options["styles"]=$styles;
    }
266177
void setClusterTimeDiff(long diff) {
        if (logger.isFineEnabled()) {
            logger.fine("Setting cluster time diff to " + diff + "ms.");
        }

        if (abs(diff) > abs(maxClusterTimeDiff)) {
            maxClusterTimeDiff = diff;
        }

        this.clusterTimeDiff = diff;
    }
1175464
def send_cluster_time(self, command, session, client):
        """"""
        if self.max_wire_version >= 6 and client:
            client._send_cluster_time(command, session)
104471
public void setDBClusterSnapshotAttributes(java.util.Collection<DBClusterSnapshotAttribute> dBClusterSnapshotAttributes) {
        if (dBClusterSnapshotAttributes == null) {
            this.dBClusterSnapshotAttributes = null;
            return;
        }

        this.dBClusterSnapshotAttributes = new java.util.ArrayList<DBClusterSnapshotAttribute>(dBClusterSnapshotAttributes);
    }
356944
def change_attributes(self, **kwargs):
        '''
        
        '''
        new_track = Track(self.viewconf['type'])
        new_track.position = self.position
        new_track.tileset = self.tileset
        new_track.viewconf = json.loads(json.dumps(self.viewconf))
        new_track.viewconf = {**new_track.viewconf, **kwargs}

        return new_track
889898
def set_from_descendants(self, descendants):
        """"""
        for field in self.fields:

            # This gives a set of metadata values of all the parents
            # of any new cluster.
            candidates = defaultdict(set)
            for old, new in descendants:
                candidates[new].add(self.get(field, old))

            # Loop over all new clusters.
            for new, vals in candidates.items():
                vals = list(vals)
                default = self._fields[field]
                # If all the parents have the same value, assign it to
                # the new cluster if it is not the default.
                if len(vals) == 1 and vals[0] != default:
                    self.set(field, new, vals[0])
1194458
def update(self, cluster_template_id, name=NotUpdated,
               plugin_name=NotUpdated, plugin_version=NotUpdated,
               description=NotUpdated, cluster_configs=NotUpdated,
               node_groups=NotUpdated, anti_affinity=NotUpdated,
               net_id=NotUpdated, default_image_id=NotUpdated,
               use_autoconfig=NotUpdated, shares=NotUpdated,
               is_public=NotUpdated, is_protected=NotUpdated,
               domain_name=NotUpdated):
        """"""

        data = {}
        self._copy_if_updated(data, name=name,
                              plugin_name=plugin_name,
                              plugin_version=plugin_version,
                              description=description,
                              cluster_configs=cluster_configs,
                              node_groups=node_groups,
                              anti_affinity=anti_affinity,
                              neutron_management_network=net_id,
                              default_image_id=default_image_id,
                              use_autoconfig=use_autoconfig,
                              shares=shares,
                              is_public=is_public,
                              is_protected=is_protected,
                              domain_name=domain_name)

        return self._patch('/cluster-templates/%s' % cluster_template_id,
                           data, 'cluster_template')
787269
private ArrayList<String> getNameInCluster(Cluster cluster) {
    ArrayList<String> itemsInCluster = new ArrayList<String>();

    String nodeName;
    if (cluster.isLeaf()) {
      nodeName = cluster.getName();
      itemsInCluster.add(nodeName);
    }
    else {
      // String[] clusterName = cluster.getName().split("#");
      // nodeName = clusterName[1];
    }

    for (Cluster child : cluster.getChildren()) {
      ArrayList<String> childrenNames = getNameInCluster(child);
      itemsInCluster.addAll(childrenNames);
    }
    return itemsInCluster;
  }
693982
public static void doMetaSetPair(AdminClient adminClient,
                                         List<Integer> nodeIds,
                                         Object clusterValue,
                                         Object storesValue) {
            VectorClock updatedClusterVersion = null;
            VectorClock updatedStoresVersion = null;
            for(Integer nodeId: nodeIds) {
                if(updatedClusterVersion == null && updatedStoresVersion == null) {
                    updatedClusterVersion = (VectorClock) adminClient.metadataMgmtOps.getRemoteMetadata(nodeId,
                                                                                                        MetadataStore.CLUSTER_KEY)
                                                                                     .getVersion();
                    updatedStoresVersion = (VectorClock) adminClient.metadataMgmtOps.getRemoteMetadata(nodeId,
                                                                                                       MetadataStore.STORES_KEY)
                                                                                    .getVersion();
                } else {
                    updatedClusterVersion = updatedClusterVersion.merge((VectorClock) adminClient.metadataMgmtOps.getRemoteMetadata(nodeId,
                                                                                                                                    MetadataStore.CLUSTER_KEY)
                                                                                                                 .getVersion());
                    updatedStoresVersion = updatedStoresVersion.merge((VectorClock) adminClient.metadataMgmtOps.getRemoteMetadata(nodeId,
                                                                                                                                  MetadataStore.STORES_KEY)
                                                                                                               .getVersion());
                }

                // TODO: This will work for now but we should take a step back
                // and
                // think about a uniform clock for the metadata values.
                updatedClusterVersion = updatedClusterVersion.incremented(nodeIds.iterator().next(),
                                                                          System.currentTimeMillis());
                updatedStoresVersion = updatedStoresVersion.incremented(nodeIds.iterator().next(),
                                                                        System.currentTimeMillis());
            }
            adminClient.metadataMgmtOps.updateRemoteMetadataPair(nodeIds,
                                                                 MetadataStore.CLUSTER_KEY,
                                                                 Versioned.value(clusterValue.toString(),
                                                                                 updatedClusterVersion),
                                                                 MetadataStore.STORES_KEY,
                                                                 Versioned.value(storesValue.toString(),
                                                                                 updatedStoresVersion));
        }
1115701
def cluster_version(self):
        """"""
        versionstr = self.client.info()['version']['number']
        return [int(x) for x in versionstr.split('.')]
1216783
private void setAliveDeadMetrics() {
    clusterManager.getMetrics().setAliveNodes(nameToNode.size());
    int totalHosts = hostsReader.getHosts().size();
    if (totalHosts > 0) {
      clusterManager.getMetrics().setDeadNodes(
          totalHosts - nameToNode.size());
    }
  }
999743
public void setClusterSize(String clusterId, String zoneId, int newSize)
      throws InterruptedException {
    setClusterSize(instanceName.toClusterName(clusterId).getClusterName(), newSize);
  }
407343
def set_attributes(d, elm):
    """"""
    for key in d:
        elm.setAttribute(key, d[key])
525088
def _set_attributes(self, **kwargs):
        '''
        '''

        try:
            self.devices = kwargs['devices'][:]
            self.name = kwargs['device_group_name']
            self.type = kwargs['device_group_type']
            self.partition = kwargs['device_group_partition']
        except KeyError as ex:
            raise MissingRequiredDeviceGroupParameter(ex)