private


 Allow the user to verify the list of servers that an
 operation will be run against.
555686
def verify(message, items, confirm=true)
      puts message
      puts "=================================================="

      i = 0
      items.sort.each do |item|
        i += 1
        puts "%03d.#{item}" % i
      end

      puts "=================================================="

      if confirm
        puts "Press enter to confirm or ^C to exit"
        gets
      end
    end
1304107
def find_server(client, address_str)
      client.cluster.servers_list.detect{ |s| s.address.to_s == address_str }
    end
1013485
private boolean inHostsList(TaskTrackerStatus status) {
    Set<String> hostsList = hostsReader.getHosts();
    return (hostsList.isEmpty() || hostsList.contains(status.getHost()));
  }
470712
def run
      GreenAndSecure::check_block_setup
      puts "The available chef servers are:"
      servers.each do |server|
        if server == current_server then
          puts "\t* #{server} [ Currently Selected ]"
        else
          puts "\t* #{server}"
        end
      end
    end
1334830
def members(self):
        """"""
        result = list()
        for member in self.run_command(command="replSetGetStatus", is_eval=False)['members']:
            result.append({
                "_id": member['_id'],
                "host": member["name"],
                "server_id": self._servers.host_to_server_id(member["name"]),
                "state": member['state']
            })
        return result
328472
def detect_os
      @server_os = Array.new
      @servers.each do |server|
        if object_behavior(server, :spot_check_command?, "lsb_release -is | grep Ubuntu")
          puts "setting server to ubuntu"
          server.os = "ubuntu"
          server.apache_str = "apache2"
          server.apache_check = "apache2ctl status"
          server.haproxy_check = "service haproxy status"
        else
          puts "setting server to centos"
          server.os = "centos"
          server.apache_str = "httpd"
          server.apache_check = "service httpd status"
          server.haproxy_check = "service haproxy check"
        end
      end
    end
1116020
def wait_for_servers(session, servers):
    
    nclient = nova.Client(NOVA_VERSION, session=session,
                          region_name=os.environ['OS_REGION_NAME'])
    while True:
        deployed = []
        undeployed = []
        for server in servers:
            c = nclient.servers.get(server.id)
            if c.addresses != {} and c.status == 'ACTIVE':
                deployed.append(server)
            if c.status == 'ERROR':
                undeployed.append(server)
        logger.info("[nova]: Polling the Deployment")
        logger.info("[nova]: %s deployed servers" % len(deployed))
        logger.info("[nova]: %s undeployed servers" % len(undeployed))
        if len(deployed) + len(undeployed) >= len(servers):
            break
        time.sleep(3)
    return deployed, undeployed
846170
def app_servers
      ret = @servers.select { |s| s.nickname =~ /App Server/ }
      raise "No app servers in deployment" unless ret.length > 0
      ret
    end
942376
private function _verifyRs()
    {
        if ($this->_rs == null)
        {
			$this->_phreezer->IncludeModel($this->_objectclass);
			$this->_rs = $this->_phreezer->DataAdapter->Select($this->_sql);
        }
    }
1236497
public ServerList filterOutObservers()
    {
        Iterable<ServerSpec> filtered = Iterables.filter
        (
            specs,
            new Predicate<ServerSpec>()
            {
                @Override
                public boolean apply(ServerSpec spec)
                {
                    return spec.getServerType() != ServerType.OBSERVER;
                }
            }
        );
        return new ServerList(Lists.newArrayList(filtered));
    }
1168934
private void validateServerVariables(ValidationHelper helper, Context context, Set<String> variables, Server t) {
        ServerVariables serverVariables = t.getVariables();

        for (String variable : variables) {
            if (serverVariables == null || !serverVariables.containsKey(variable)) {
                final String message = Tr.formatMessage(tc, "serverVariableNotDefined", variable);
                helper.addValidationEvent(new ValidationEvent(ValidationEvent.Severity.ERROR, context.getLocation("variables"), message));
            }
        }
    }
365625
private List<ServerAddress> convertToServerAddresses(Set<String> addresses)  {
        return addresses.stream()
                        .map(this::stringToServerAddress)
                        .filter(Objects::nonNull)
                        .collect(Collectors.toList());
    }
1324595
def service_list(auth=None, **kwargs):
    '''
    
    '''
    cloud = get_operator_cloud(auth)
    kwargs = _clean_kwargs(**kwargs)
    return cloud.list_services(**kwargs)
1186725
def verify(operations, loud=False):
    
    everything_ok, roll_call = check(operations, loud=loud)
    if not everything_ok:
        raise CheckFailedException(roll_call)
    return roll_call
349528
private List<ServerConnection> updateServerList() {
        final Map<Endpoint, ServerConnection> allServersByEndpoint = allServers
                .stream()
                .collect(toImmutableMap(ServerConnection::endpoint,
                                        Function.identity(),
                                        (l, r) -> l));
        return allServers = delegate
                .endpoints()
                .stream()
                .map(endpoint -> {
                    ServerConnection connection = allServersByEndpoint.get(endpoint);
                    if (connection != null) {
                        return connection;
                    }
                    return new ServerConnection(endpoint, createEndpointHealthChecker(endpoint));
                })
                .collect(toImmutableList());
    }
11919
def verify_server_core(timeout=120, start_delay=90):
    ''' 
    '''
    timestamp = time.time()
    last_check = time.time() + start_delay - 10
    last_delay_notification = time.time() - 10
    server_down = True
    return_val = False
    timeout += 1
    # loop until the server is up or the timeout is reached
    while((time.time()-timestamp) < timeout) and server_down:
        # if delaying, the start of the check, print waiting to start
        if start_delay > 0 and time.time() - timestamp < start_delay \
                and (time.time()-last_delay_notification) > 5:
            print("Delaying server status check until %ss. Current time: %ss" \
                    % (start_delay, int(time.time() - timestamp)))
            last_delay_notification = time.time()
        # send a request check every 10s until the server is up
        while ((time.time()-last_check) > 10) and server_down:
            print("Checking status of servers at %ss" % \
                    int((time.time()-timestamp)))
            last_check = time.time()
            try:
                repo = requests.get(CFG.REPOSITORY_URL)
                repo_code = repo.status_code
                print ("\t", CFG.REPOSITORY_URL, " - ", repo_code)
            except:
                repo_code = 400
                print ("\t", CFG.REPOSITORY_URL, " - DOWN")
            try:
                triple = requests.get(CFG.DATA_TRIPLESTORE.url)
                triple_code = triple.status_code
                print ("\t", CFG.DATA_TRIPLESTORE.url, " - ", triple_code)
            except:
                triple_code = 400
                print ("\t", CFG.DATA_TRIPLESTORE.url, " - down")
            if repo_code == 200 and triple_code == 200:
                server_down = False
                return_val = True
                print("**** Servers up at %ss" % \
                    int((time.time()-timestamp)))
                break
    return return_val
604063
def local_bind_ports(self):
        
        self._check_is_started()
        return [_server.local_port for _server in self._server_list if
                _server.local_port is not None]