Soft Patch Panel
 help / color / mirror / Atom feed
From: ogawa.yasufumi@lab.ntt.co.jp
To: ferruh.yigit@intel.com, spp@dpdk.org, ogawa.yasufumi@lab.ntt.co.jp
Subject: [spp] [PATCH] controller: fix bug of no existing variable
Date: Thu, 31 Jan 2019 12:04:25 +0900	[thread overview]
Message-ID: <1548903865-17333-1-git-send-email-ogawa.yasufumi@lab.ntt.co.jp> (raw)

From: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>

Correct to refer no existing member variable `rest_common_error_codes`
which was moved spp_ctl_cli object.

Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
 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

                 reply	other threads:[~2019-01-31  3:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1548903865-17333-1-git-send-email-ogawa.yasufumi@lab.ntt.co.jp \
    --to=ogawa.yasufumi@lab.ntt.co.jp \
    --cc=ferruh.yigit@intel.com \
    --cc=spp@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).