Skip to content

Commit

Permalink
Alert the user about the nature of advertised queues (#244)
Browse files Browse the repository at this point in the history
* Alert the user about the nature of advertised queues

* move queue alert message to a helper function

* black formatting fix
  • Loading branch information
plars authored Apr 8, 2024
1 parent 2f3199b commit 0b0e31d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions cli/testflinger_cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def configure_logging():


def _get_image(images):
"""Ask the user to select an image from a list"""
image = ""
flex_url = ""
if images and images[list(images.keys())[0]].startswith("url:"):
Expand Down Expand Up @@ -110,6 +111,14 @@ def _get_ssh_keys():
return key_list


def _print_queue_message():
print(
"ATTENTION: This only shows a curated list of queues with "
"descriptions, not ALL queues. If you can't find the queue you want "
"to use, a job can still be submitted for queues not listed here.\n"
)


class TestflingerCli:
"""Class for handling the Testflinger CLI"""

Expand Down Expand Up @@ -510,6 +519,7 @@ def jobs(self):

def list_queues(self):
"""List the advertised queues on the current Testflinger server"""
_print_queue_message()
try:
queues = self.client.get_queues()
except client.HTTPError as exc:
Expand All @@ -524,6 +534,7 @@ def list_queues(self):

def reserve(self):
"""Install and reserve a system"""
_print_queue_message()
try:
queues = self.client.get_queues()
except OSError:
Expand Down Expand Up @@ -580,6 +591,7 @@ def reserve(self):
self.do_poll(job_id)

def _get_queue(self, queues):
"""Ask the user which queue to use from a list"""
queue = ""
while not queue or queue == "?":
queue = input("\nWhich queue do you want to use? ('?' to list) ")
Expand Down

0 comments on commit 0b0e31d

Please sign in to comment.