From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from bcmv-tmail01.ecl.ntt.co.jp (bcmv-tmail01.ecl.ntt.co.jp [124.146.185.148]) by dpdk.org (Postfix) with ESMTP id 668FC1B3B7 for ; Thu, 31 Jan 2019 04:06:34 +0100 (CET) Received: from bcmv-ns01.ecl.ntt.co.jp (bcmv-ns01.ecl.ntt.co.jp [129.60.83.123]) by bcmv-tmail01.ecl.ntt.co.jp (8.14.4/8.14.4) with ESMTP id x0V36XFd014881; Thu, 31 Jan 2019 12:06:33 +0900 Received: from bcmv-ns01.ecl.ntt.co.jp (localhost [127.0.0.1]) by bcmv-ns01.ecl.ntt.co.jp (Postfix) with ESMTP id CA762138; Thu, 31 Jan 2019 12:06:33 +0900 (JST) Received: from localhost.localdomain (lobster.nslab.ecl.ntt.co.jp [129.60.13.95]) by bcmv-ns01.ecl.ntt.co.jp (Postfix) with ESMTP id AB202C6; Thu, 31 Jan 2019 12:06:33 +0900 (JST) From: ogawa.yasufumi@lab.ntt.co.jp To: ferruh.yigit@intel.com, spp@dpdk.org, ogawa.yasufumi@lab.ntt.co.jp Date: Thu, 31 Jan 2019 12:04:25 +0900 Message-Id: <1548903865-17333-1-git-send-email-ogawa.yasufumi@lab.ntt.co.jp> X-Mailer: git-send-email 2.7.4 X-TM-AS-MML: disable Subject: [spp] [PATCH] controller: fix bug of no existing variable X-BeenThere: spp@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Soft Patch Panel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 31 Jan 2019 03:06:36 -0000 From: Yasufumi Ogawa Correct to refer no existing member variable `rest_common_error_codes` which was moved spp_ctl_cli object. Signed-off-by: Yasufumi Ogawa --- src/controller/commands/pri.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/controller/commands/pri.py b/src/controller/commands/pri.py index 7712ba2..662e41a 100644 --- a/src/controller/commands/pri.py +++ b/src/controller/commands/pri.py @@ -6,6 +6,7 @@ from __future__ import absolute_import from .. import spp_common from ..shell_lib import common + class SppPrimary(object): """Exec SPP primary command. @@ -33,12 +34,15 @@ class SppPrimary(object): print("Invalid pri command: '%s'" % subcmd) return None + # use short name + common_err_codes = self.spp_ctl_cli.rest_common_error_codes + if subcmd == 'status': res = self.spp_ctl_cli.get('primary/status') if res is not None: if res.status_code == 200: self.print_status(res.json()) - elif res.status_code in self.rest_common_error_codes: + elif res.status_code in common_err_codes: # Print default error message pass else: @@ -52,7 +56,7 @@ class SppPrimary(object): if res is not None: if res.status_code == 204: print('Clear port statistics.') - elif res.status_code in self.rest_common_error_codes: + elif res.status_code in common_err_codes: pass else: print('Error: unknown response.') @@ -62,6 +66,7 @@ class SppPrimary(object): def do_exit(self): res = self.spp_ctl_cli.delete('primary') + if res is not None: error_codes = self.spp_ctl_cli.rest_common_error_codes if res.status_code == 204: @@ -199,7 +204,7 @@ class SppPrimary(object): for proc in res.json(): if proc['type'] != 'primary': sec_ids.append(proc['client-id']) - elif res.status_code in self.rest_common_error_codes: + elif res.status_code in self.spp_ctl_cli.rest_common_error_codes: # Print default error message pass else: -- 2.7.4