From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id E304BA00E6 for ; Wed, 7 Aug 2019 13:02:18 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id ABCB02BD8; Wed, 7 Aug 2019 13:02:17 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id BBE052BD3; Wed, 7 Aug 2019 13:02:15 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Aug 2019 04:02:14 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,357,1559545200"; d="scan'208";a="168599140" Received: from silpixa00393949.ir.intel.com (HELO silpixa00393949.ger.corp.intel.com) ([10.237.222.145]) by orsmga008.jf.intel.com with ESMTP; 07 Aug 2019 04:02:12 -0700 From: Andrius Sirvys To: Kevin Laatz Cc: dev@dpdk.org, stable@dpdk.org, Andrius Sirvys Date: Wed, 7 Aug 2019 12:02:02 +0100 Message-Id: <20190807110202.15712-1-andrius.sirvys@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH] usertools: dpdk-telemetry-client.py run into looping status X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The ast.literal_eval() was used incorrectly and wouldn't properly retrieve the user option. Was causing the options to keep being listed in a loop. Removed and replaced with raw_input() being cast to an int. Works as expected now. Fixes: 53f293c9a783 ("usertools: replace unsafe input function") Cc: andrius.sirvys@intel.com Signed-off-by: Andrius Sirvys --- usertools/dpdk-telemetry-client.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/usertools/dpdk-telemetry-client.py b/usertools/dpdk-telemetry-client.py index 4b0502ff9..3b53b6949 100755 --- a/usertools/dpdk-telemetry-client.py +++ b/usertools/dpdk-telemetry-client.py @@ -16,9 +16,9 @@ DEFAULT_FP = "/var/run/dpdk/default_client" try: - raw_input # Python 2 + raw_input # Python 2 except NameError: - raw_input = input # Python 3 + raw_input = input # Python 3 class Socket: @@ -78,7 +78,8 @@ def requestMetrics(self): # Requests metrics for given client def repeatedlyRequestMetrics(self, sleep_time): # Recursively requests metrics for given client print("\nPlease enter the number of times you'd like to continuously request Metrics:") - n_requests = int(ast.literal_eval(raw_input("\n:"))) + #n_requests = int(ast.literal_eval(raw_input("\n:"))) + n_requests = int(raw_input("\n:")) print("\033[F") #Removes the user input from screen, cleans it up print("\033[K") for i in range(n_requests): @@ -99,7 +100,8 @@ def interactiveMenu(self, sleep_time): # Creates Interactive menu within the scr print("[4] Unregister client") try: - self.choice = int(ast.literal_eval(raw_input("\n:"))) + #self.choice = int(ast.literal_eval(raw_input("\n:"))) + self.choice = int(raw_input("\n:")) print("\033[F") #Removes the user input for screen, cleans it up print("\033[K") if self.choice == 1: -- 2.17.1