Beispiel #1
0
 def _ListHostUpdateStates(self):
   """Fetches a list of host update states."""
   infos = [
       api_messages.FilterHintMessage(value=state.name)
       for state in api_messages.HostUpdateState
   ]
   return api_messages.FilterHintCollection(filter_hints=infos)
Beispiel #2
0
 def _ListLabs(self):
   """Fetches a list of labs."""
   entities = datastore_entities.LabInfo.query().fetch(keys_only=True)
   infos = [
       api_messages.FilterHintMessage(value=str(item.id()))
       for item in entities
   ]
   return api_messages.FilterHintCollection(filter_hints=infos)
Beispiel #3
0
 def _ListHosts(self):
   """Fetches a list of hostnames."""
   entities = datastore_entities.HostInfo.query().filter(
       datastore_entities.HostInfo.hidden == False).fetch(keys_only=True)      infos = [
       api_messages.FilterHintMessage(value=str(item.id()))
       for item in entities
   ]
   return api_messages.FilterHintCollection(filter_hints=infos)
Beispiel #4
0
 def _ListHostGroup(self):
   """Fetches a list of host group."""
   entities = datastore_entities.HostInfo.query(
       projection=[datastore_entities.HostInfo.host_group],
       distinct=True).filter(
           datastore_entities.HostInfo.hidden == False).fetch(                  projection=[datastore_entities.HostInfo.host_group])
   infos = [
       api_messages.FilterHintMessage(value=item.host_group)
       for item in entities
   ]
   return api_messages.FilterHintCollection(filter_hints=infos)
Beispiel #5
0
 def _ListTestHarnessVersion(self):
   """Fetches a list of test harness version."""
   entities = datastore_entities.HostInfo.query(
       projection=[datastore_entities.HostInfo.test_harness_version],
       distinct=True).filter(
           datastore_entities.HostInfo.hidden == False).fetch(                  projection=[datastore_entities.HostInfo.test_harness_version])
   infos = [
       api_messages.FilterHintMessage(value=item.test_harness_version)
       for item in entities
   ]
   return api_messages.FilterHintCollection(filter_hints=infos)
Beispiel #6
0
 def _ListPools(self):
   """Fetches a list of pool."""
   entities = datastore_entities.HostInfo.query(
       projection=[datastore_entities.HostInfo.pools], distinct=True).filter(
           datastore_entities.HostInfo.hidden == False).fetch(                  projection=[datastore_entities.HostInfo.pools])
   mergedlist = []
   for item in entities:
     mergedlist += item.pools
   mergedlist = list(set(mergedlist))
   mergedlist.sort()
   infos = [
       api_messages.FilterHintMessage(value=item) for item in mergedlist
   ]
   return api_messages.FilterHintCollection(filter_hints=infos)
Beispiel #7
0
 def _ListRunTargets(self):
   """Fetches a list of run targets."""
   entities = device_manager.GetRunTargetsFromNDB()
   infos = [api_messages.FilterHintMessage(value=item) for item in entities]
   return api_messages.FilterHintCollection(filter_hints=infos)
Beispiel #8
0
 def _ListDeviceStates(self):
   """Fetches a list of device state."""
   entities = list(common.DEVICE_ALL_STATES)
   infos = [api_messages.FilterHintMessage(value=state) for state in entities]
   return api_messages.FilterHintCollection(filter_hints=infos)