From d9430360beb9c7104470a6804feab87adae2817f Mon Sep 17 00:00:00 2001 From: Duc Truong Date: Mon, 27 Jan 2020 23:10:06 +0000 Subject: [PATCH] Flush confirmation messages Confirmation messages for cluster, profile, policy, receiver and node deletions are printed using sys.stdout.write. However sys.stdout.write output is line-buffered [1]. Since the confirmation message does not contain a newline, the message may not appear in the user's terminal. [1] https://docs.python.org/3/library/sys.html#sys.stdout Change-Id: I829811df362bcfd7d074523958d2aa5232da6f09 Closes-Bug: 1861042 --- senlinclient/v1/cluster.py | 1 + senlinclient/v1/node.py | 1 + senlinclient/v1/policy.py | 1 + senlinclient/v1/profile.py | 1 + senlinclient/v1/receiver.py | 1 + 5 files changed, 5 insertions(+) diff --git a/senlinclient/v1/cluster.py b/senlinclient/v1/cluster.py index e1ce6d3a..4b3e9eac 100644 --- a/senlinclient/v1/cluster.py +++ b/senlinclient/v1/cluster.py @@ -345,6 +345,7 @@ class DeleteCluster(command.Command): sys.stdout.write( _("Are you sure you want to delete this cluster(s)" " [y/N]?")) + sys.stdout.flush() prompt_response = sys.stdin.readline().lower() if not prompt_response.startswith('y'): return diff --git a/senlinclient/v1/node.py b/senlinclient/v1/node.py index cef86803..6d1dd782 100644 --- a/senlinclient/v1/node.py +++ b/senlinclient/v1/node.py @@ -331,6 +331,7 @@ class DeleteNode(command.Command): sys.stdout.write( _("Are you sure you want to delete this node(s)" " [y/N]?")) + sys.stdout.flush() prompt_response = sys.stdin.readline().lower() if not prompt_response.startswith('y'): return diff --git a/senlinclient/v1/policy.py b/senlinclient/v1/policy.py index bd2b6020..d8bddc9e 100644 --- a/senlinclient/v1/policy.py +++ b/senlinclient/v1/policy.py @@ -241,6 +241,7 @@ class DeletePolicy(command.Command): sys.stdout.write( _("Are you sure you want to delete this policy(s)" " [y/N]?")) + sys.stdout.flush() prompt_response = sys.stdin.readline().lower() if not prompt_response.startswith('y'): return diff --git a/senlinclient/v1/profile.py b/senlinclient/v1/profile.py index ac116cf7..3ac7b1a1 100644 --- a/senlinclient/v1/profile.py +++ b/senlinclient/v1/profile.py @@ -176,6 +176,7 @@ class DeleteProfile(command.Command): sys.stdout.write( _("Are you sure you want to delete this profile(s)" " [y/N]?")) + sys.stdout.flush() prompt_response = sys.stdin.readline().lower() if not prompt_response.startswith('y'): return diff --git a/senlinclient/v1/receiver.py b/senlinclient/v1/receiver.py index f3eacf04..7bf619aa 100644 --- a/senlinclient/v1/receiver.py +++ b/senlinclient/v1/receiver.py @@ -294,6 +294,7 @@ class DeleteReceiver(command.Command): sys.stdout.write( _("Are you sure you want to delete this receiver(s)" " [y/N]?")) + sys.stdout.flush() prompt_response = sys.stdin.readline().lower() if not prompt_response.startswith('y'): return