Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notification in run: Preparing for automation, please hold on #948

Merged
merged 4 commits into from
Feb 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/changelog-fragments.d/948.feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added state notification when running a playbook during initialization. -- by {user}`cidrblock`
13 changes: 13 additions & 0 deletions src/ansible_navigator/actions/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
from ..ui_framework import Interaction
from ..ui_framework import dict_to_form
from ..ui_framework import form_to_dict
from ..ui_framework import nonblocking_notification
from ..ui_framework import warning_notification
from ..utils import abs_user_path
from ..utils import human_time
Expand Down Expand Up @@ -204,6 +205,8 @@ def __init__(self, args: ApplicationConfiguration):
self.runner: CommandAsync
self._runner_finished: bool
self._auto_scroll = False
#: Flag when the first message is received from runner
self._first_message_received: bool = False

self._plays = Step(
name="plays",
Expand Down Expand Up @@ -279,6 +282,14 @@ def run(self, interaction: Interaction, app: AppPublic) -> Union[Interaction, No

self.steps.append(self._plays)

# Show a notification until the first the first message from the queue is processed
if self._subaction_type == "run":
messages = ["Preparing for automation, please wait..."]
notification = nonblocking_notification(messages=messages)
interaction.ui.show(notification)
while not self._first_message_received:
self.update()

while True:
self.update()

Expand Down Expand Up @@ -603,6 +614,8 @@ def _dequeue(self) -> None:
"""Drain the runner queue"""
drain_count = 0
while not self._queue.empty():
if not self._first_message_received:
self._first_message_received = True
message = self._queue.get()
self._handle_message(message)
drain_count += 1
Expand Down