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 86D54A00E6 for ; Wed, 7 Aug 2019 15:05:13 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id AC5662BD8; Wed, 7 Aug 2019 15:05:12 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id CC04229CB; Wed, 7 Aug 2019 15:05:10 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Aug 2019 06:05:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,357,1559545200"; d="scan'208";a="373762081" Received: from silpixa00393949.ir.intel.com (HELO silpixa00393949.ger.corp.intel.com) ([10.237.222.145]) by fmsmga005.fm.intel.com with ESMTP; 07 Aug 2019 06:05:08 -0700 From: Andrius Sirvys To: Kevin Laatz Cc: dev@dpdk.org, stable@dpdk.org, Andrius Sirvys Date: Wed, 7 Aug 2019 14:04:58 +0100 Message-Id: <20190807130458.16754-1-andrius.sirvys@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH v2] 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 --- v2: Removed unnecessary comments --- usertools/dpdk-telemetry-client.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/usertools/dpdk-telemetry-client.py b/usertools/dpdk-telemetry-client.py index 4b0502ff9..b5b5cdcfe 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,7 @@ 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(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 +99,7 @@ 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(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