python: Fix invalid varable/function references.
authorRussell Bryant <russell@ovn.org>
Fri, 11 Dec 2015 21:16:10 +0000 (16:16 -0500)
committerRussell Bryant <russell@ovn.org>
Tue, 5 Jan 2016 23:13:47 +0000 (18:13 -0500)
This code referred to "rows" where it meant to refer to "fetched_rows".
The patch resolves flake8 error:

  F821 undefined name 'rows'

python/build/nroff.py used a function fatal() that was not defined,
which raised the same type of error.

Signed-off-by: Russell Bryant <russell@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
Makefile.am
python/build/nroff.py
python/ovs/db/idl.py

index 50999e5..d224a39 100644 (file)
@@ -343,7 +343,7 @@ endif
 if HAVE_FLAKE8
 ALL_LOCAL += flake8-check
 flake8-check: $(FLAKE8_PYFILES)
-       $(AM_V_GEN) if flake8 $^ --ignore=E111,E112,E113,E123,E126,E127,E128,E129,E131,E201,E203,E222,E225,E226,E231,E241,E251,E261,E262,E265,E271,E302,E303,E501,E502,E703,E711,E713,E721,F811,F821,W601 ${FLAKE8_FLAGS}; then touch $@; else exit 1; fi
+       $(AM_V_GEN) if flake8 $^ --ignore=E111,E112,E113,E123,E126,E127,E128,E129,E131,E201,E203,E222,E225,E226,E231,E241,E251,E261,E262,E265,E271,E302,E303,E501,E502,E703,E711,E713,E721,W601 ${FLAKE8_FLAGS}; then touch $@; else exit 1; fi
 endif
 
 include $(srcdir)/manpages.mk
index 75461eb..674fdfe 100644 (file)
@@ -13,6 +13,7 @@
 # limitations under the License.
 
 import re
+import sys
 
 from ovs.db import error
 
@@ -108,6 +109,12 @@ def pre_to_nroff(nodes, para, font):
     s += '\n.fi\n'
     return s
 
+
+def fatal(msg):
+    sys.stderr.write('%s\n' % msg)
+    sys.exit(1)
+
+
 def diagram_header_to_nroff(header_node):
     header_fields = []
     i = 0
index c8990c7..f9fd928 100644 (file)
@@ -1221,7 +1221,7 @@ class Transaction(object):
             if len(fetched_rows) != 1:
                 # XXX rate-limit
                 vlog.warn('"select" reply "rows" has %d elements '
-                          'instead of 1' % len(rows))
+                          'instead of 1' % len(fetched_rows))
                 continue
             fetched_row = fetched_rows[0]
             if not Transaction.__check_json_type(fetched_row, (dict,),