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 47121A00E6 for ; Wed, 7 Aug 2019 13:16:46 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 17FA82BFA; Wed, 7 Aug 2019 13:16:46 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 64D692BFA; Wed, 7 Aug 2019 13:16:44 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Aug 2019 04:16:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,357,1559545200"; d="scan'208";a="374372302" Received: from irsmsx110.ger.corp.intel.com ([163.33.3.25]) by fmsmga006.fm.intel.com with ESMTP; 07 Aug 2019 04:16:42 -0700 Received: from irsmsx104.ger.corp.intel.com ([169.254.5.40]) by irsmsx110.ger.corp.intel.com ([169.254.15.82]) with mapi id 14.03.0439.000; Wed, 7 Aug 2019 12:16:35 +0100 From: "Lipiec, Herakliusz" To: "Sirvys, Andrius" , "Laatz, Kevin" CC: "dev@dpdk.org" , "stable@dpdk.org" , "Sirvys, Andrius" Thread-Topic: [dpdk-dev] [PATCH] usertools: dpdk-telemetry-client.py run into looping status Thread-Index: AQHVTQ+jK+TuR9ik8EGkA8ki+ljYrabviJgw Date: Wed, 7 Aug 2019 11:16:35 +0000 Message-ID: References: <20190807110202.15712-1-andrius.sirvys@intel.com> In-Reply-To: <20190807110202.15712-1-andrius.sirvys@intel.com> Accept-Language: en-IE, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYWE2YzNkNWYtZWJlYi00NjAzLThlYmYtNzMxYjQzZmRhZjNlIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoid1hlNE1LY1ZCXC96bUg1SHBcLzc4V0hxUGNPTlNcL1I2cE1DMStKS2Qzb2VWSFMwZlV3b3ZaQUZKMjJrMnpFXC8zVlMifQ== x-originating-ip: [163.33.239.181] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH] usertools: dpdk-telemetry-client.py run into looping status X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Andrius Sirvys >=20 > The ast.literal_eval() was used incorrectly and wouldn't properly retriev= e the > user option. Was causing the options to keep being listed in a loop. Remo= ved > and replaced with raw_input() being cast to an int. > Works as expected now. >=20 > Fixes: 53f293c9a783 ("usertools: replace unsafe input function") > Cc: andrius.sirvys@intel.com >=20 > Signed-off-by: Andrius Sirvys > --- > usertools/dpdk-telemetry-client.py | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) >=20 > diff --git a/usertools/dpdk-telemetry-client.py b/usertools/dpdk-telemetr= y- > client.py > index 4b0502ff9..3b53b6949 100755 > --- a/usertools/dpdk-telemetry-client.py > +++ b/usertools/dpdk-telemetry-client.py > @@ -16,9 +16,9 @@ > DEFAULT_FP =3D "/var/run/dpdk/default_client" >=20 > try: > - raw_input # Python 2 > + raw_input # Python 2 > except NameError: > - raw_input =3D input # Python 3 > + raw_input =3D input # Python 3 >=20 > class Socket: >=20 > @@ -78,7 +78,8 @@ def requestMetrics(self): # Requests metrics for given > client >=20 > def repeatedlyRequestMetrics(self, sleep_time): # Recursively reques= ts > metrics for given client > print("\nPlease enter the number of times you'd like to continuo= usly > request Metrics:") > - n_requests =3D int(ast.literal_eval(raw_input("\n:"))) > + #n_requests =3D int(ast.literal_eval(raw_input("\n:"))) If youre changing a line, you probably want to remove the old one, not comm= ent it out. > + n_requests =3D int(raw_input("\n:")) > print("\033[F") #Removes the user input from screen, cleans it u= p > 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") >=20 > try: > - self.choice =3D int(ast.literal_eval(raw_input("\n:"))) > + #self.choice =3D int(ast.literal_eval(raw_input("\n:"))) Same as above. > + self.choice =3D int(raw_input("\n:")) > print("\033[F") #Removes the user input for screen, clea= ns it up > print("\033[K") > if self.choice =3D=3D 1: > -- > 2.17.1 Regards, Herakliusz=20