[node-patches] Change in ovirt-node[master]: Stop doing circular imports in process.check_output

rbarry at redhat.com rbarry at redhat.com
Thu Jun 27 20:42:48 UTC 2013


Ryan Barry has uploaded a new change for review.

Change subject: Stop doing circular imports in process.check_output
......................................................................

Stop doing circular imports in process.check_output

ovirt.node.utils.system requires ovirt.node.utils.process.
Circular imports make process unusable from a python shell. Delay
importing system until we actually need it.

Change-Id: Ic779d49b0c1e46f416a5c62fc707a10bb5fb9baf
Signed-off-by: Ryan Barry <rbarry at redhat.com>
---
A src/ovirt-crash.log
M src/ovirt/node/utils/process.py
2 files changed, 90 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/11/16211/1

diff --git a/src/ovirt-crash.log b/src/ovirt-crash.log
new file mode 100644
index 0000000..3fb7aa9
--- /dev/null
+++ b/src/ovirt-crash.log
@@ -0,0 +1,89 @@
+7[?47h[?1000h[?1002h)0[?25l oVirt None-None┌───────────────────────────────────────┐                                                                                                                                             │Status                                 │       System Information                                                                                                                    │Network                                │                                                                                                                                             │[0;30;4!
 7mSecurity                               │     Status:       No virtualization hardware was detected on this system                                                                    │Keyboard                               │                                                                                                                                             │SNMP                                   │     Networking:   Connected                                           eth0                                                                  │CIM                                    │                                                                       IPv4: 192.168.0.165                     !
                               │Logging                                │                                                                       IPv6: fe80::21a:4aff:fea8:74                                          │Kdump                                  │                                                                                                                                             │Remote Storage                         │     Logs:         Local Only                                                                                                                │Monitoring                             │                                                                                                                        !
                      │Diagnostics                            │     Running VMs:  0                                                                                                                         │Performance                            │                                                                                                                                             │Puppet                                 │     Press F8 for support menu                                                                                                               │Plugins                                │                                                                    !
                                                                          │                                       │     < View Host Key >                                                 < View CPU Details >                                                  │                                       │     < Lock >                         < Log Off >                      < Restart >                      < Power Off >                        │                                       │                                                                                                                                             │                                       │     [0;!
 39;47m                                                                                                                                        │                                       │                                                                                                                                             │                                       │                                                                                                                                             │                                       │                                                                                                                                             │                               !
         │                                                                                                                                             │                                       │                                                                                                                                             │                                       │                                                                                                                                             │                                       │                                                                                                                                             │                                       │!
                                                                                                                                              │                                       │                                                                                                                                             │                                       │                                                                                                                                             │                                       │                                                                                                                                             │                      !
                  │                                                                                                                                             │                                       │                                                                                                                                             │                                       │                                                                                                                                             │                                       │                                                                                                                                             │                                       │!
 [0;39;47m                                                                                                                                             │                                       │                                                                                                                                             │                                       │                                                                                                                                             │                                       │                                                                                                                                             │             !
                           │                                                                                                                                             │                                       │                                                                                                                                             │                                       │                                                                                                                                             │                                       │                                                                                                                                             │                                       [0;3!
 0;47m│                                                                                                                                             └───────────────────────────────────────┘                                                                                                                                             Press esc to quit.[?1002l[?1000l[?25h[?47l8
+[?25hTraceback (most recent call last):
+  File "/usr/lib64/python2.6/runpy.py", line 122, in _run_module_as_main
+    "__main__", fname, loader, pkg_name)
+  File "/usr/lib64/python2.6/runpy.py", line 34, in _run_code
+    exec code in run_globals
+  File "/home/ryan/ovirt-node/src/ovirt/node/setup/__main__.py", line 31, in <module>
+    app.run()
+  File "ovirt/node/app.py", line 303, in run
+    self.ui.run()
+  File "ovirt/node/ui/urwid_builder.py", line 473, in run
+    self.__loop.run()
+  File "/usr/lib/python2.6/site-packages/urwid-1.1.1-py2.6-linux-x86_64.egg/urwid/main_loop.py", line 272, in run
+    self.screen.run_wrapper(self._run)
+  File "/usr/lib/python2.6/site-packages/urwid-1.1.1-py2.6-linux-x86_64.egg/urwid/raw_display.py", line 242, in run_wrapper
+    return fn()
+  File "/usr/lib/python2.6/site-packages/urwid-1.1.1-py2.6-linux-x86_64.egg/urwid/main_loop.py", line 337, in _run
+    self.event_loop.run()
+  File "/usr/lib/python2.6/site-packages/urwid-1.1.1-py2.6-linux-x86_64.egg/urwid/main_loop.py", line 708, in run
+    self._loop()
+  File "/usr/lib/python2.6/site-packages/urwid-1.1.1-py2.6-linux-x86_64.egg/urwid/main_loop.py", line 778, in _loop
+    self._entering_idle()
+  File "/usr/lib/python2.6/site-packages/urwid-1.1.1-py2.6-linux-x86_64.egg/urwid/main_loop.py", line 697, in _entering_idle
+    callback()
+  File "/usr/lib/python2.6/site-packages/urwid-1.1.1-py2.6-linux-x86_64.egg/urwid/main_loop.py", line 549, in entering_idle
+    self.draw_screen()
+  File "/usr/lib/python2.6/site-packages/urwid-1.1.1-py2.6-linux-x86_64.egg/urwid/main_loop.py", line 563, in draw_screen
+    canvas = self._topmost_widget.render(self.screen_size, focus=True)
+  File "/usr/lib/python2.6/site-packages/urwid-1.1.1-py2.6-linux-x86_64.egg/urwid/widget.py", line 141, in cached_render
+    canv = fn(self, size, focus=focus)
+  File "/usr/lib/python2.6/site-packages/urwid-1.1.1-py2.6-linux-x86_64.egg/urwid/decoration.py", line 225, in render
+    canv = self._original_widget.render(size, focus=focus)
+  File "/usr/lib/python2.6/site-packages/urwid-1.1.1-py2.6-linux-x86_64.egg/urwid/widget.py", line 141, in cached_render
+    canv = fn(self, size, focus=focus)
+  File "/usr/lib/python2.6/site-packages/urwid-1.1.1-py2.6-linux-x86_64.egg/urwid/container.py", line 1058, in render
+    focus and self.focus_part == 'body')
+  File "/usr/lib/python2.6/site-packages/urwid-1.1.1-py2.6-linux-x86_64.egg/urwid/widget.py", line 141, in cached_render
+    canv = fn(self, size, focus=focus)
+  File "/usr/lib/python2.6/site-packages/urwid-1.1.1-py2.6-linux-x86_64.egg/urwid/container.py", line 1499, in render
+    canv = w.render((maxcol, rows), focus=focus and item_focus)
+  File "/usr/lib/python2.6/site-packages/urwid-1.1.1-py2.6-linux-x86_64.egg/urwid/widget.py", line 141, in cached_render
+    canv = fn(self, size, focus=focus)
+  File "/usr/lib/python2.6/site-packages/urwid-1.1.1-py2.6-linux-x86_64.egg/urwid/container.py", line 2055, in render
+    focus = focus and self.focus_position == i)
+  File "/usr/lib/python2.6/site-packages/urwid-1.1.1-py2.6-linux-x86_64.egg/urwid/widget.py", line 141, in cached_render
+    canv = fn(self, size, focus=focus)
+  File "/usr/lib/python2.6/site-packages/urwid-1.1.1-py2.6-linux-x86_64.egg/urwid/container.py", line 1058, in render
+    focus and self.focus_part == 'body')
+  File "/usr/lib/python2.6/site-packages/urwid-1.1.1-py2.6-linux-x86_64.egg/urwid/widget.py", line 141, in cached_render
+    canv = fn(self, size, focus=focus)
+  File "/usr/lib/python2.6/site-packages/urwid-1.1.1-py2.6-linux-x86_64.egg/urwid/decoration.py", line 564, in render
+    canv = self._original_widget.render((maxcol,)+size[1:], focus)
+  File "/usr/lib/python2.6/site-packages/urwid-1.1.1-py2.6-linux-x86_64.egg/urwid/widget.py", line 141, in cached_render
+    canv = fn(self, size, focus=focus)
+  File "/usr/lib/python2.6/site-packages/urwid-1.1.1-py2.6-linux-x86_64.egg/urwid/container.py", line 1499, in render
+    canv = w.render((maxcol, rows), focus=focus and item_focus)
+  File "/usr/lib/python2.6/site-packages/urwid-1.1.1-py2.6-linux-x86_64.egg/urwid/widget.py", line 141, in cached_render
+    canv = fn(self, size, focus=focus)
+  File "/usr/lib/python2.6/site-packages/urwid-1.1.1-py2.6-linux-x86_64.egg/urwid/widget.py", line 1751, in render
+    canv = get_delegate(self).render(size, focus=focus)
+  File "/usr/lib/python2.6/site-packages/urwid-1.1.1-py2.6-linux-x86_64.egg/urwid/widget.py", line 141, in cached_render
+    canv = fn(self, size, focus=focus)
+  File "/usr/lib/python2.6/site-packages/urwid-1.1.1-py2.6-linux-x86_64.egg/urwid/container.py", line 1499, in render
+    canv = w.render((maxcol, rows), focus=focus and item_focus)
+  File "/usr/lib/python2.6/site-packages/urwid-1.1.1-py2.6-linux-x86_64.egg/urwid/widget.py", line 141, in cached_render
+    canv = fn(self, size, focus=focus)
+  File "/usr/lib/python2.6/site-packages/urwid-1.1.1-py2.6-linux-x86_64.egg/urwid/decoration.py", line 564, in render
+    canv = self._original_widget.render((maxcol,)+size[1:], focus)
+  File "/usr/lib/python2.6/site-packages/urwid-1.1.1-py2.6-linux-x86_64.egg/urwid/widget.py", line 141, in cached_render
+    canv = fn(self, size, focus=focus)
+  File "/usr/lib/python2.6/site-packages/urwid-1.1.1-py2.6-linux-x86_64.egg/urwid/container.py", line 1058, in render
+    focus and self.focus_part == 'body')
+  File "/usr/lib/python2.6/site-packages/urwid-1.1.1-py2.6-linux-x86_64.egg/urwid/widget.py", line 141, in cached_render
+    canv = fn(self, size, focus=focus)
+  File "/usr/lib/python2.6/site-packages/urwid-1.1.1-py2.6-linux-x86_64.egg/urwid/decoration.py", line 225, in render
+    canv = self._original_widget.render(size, focus=focus)
+  File "/usr/lib/python2.6/site-packages/urwid-1.1.1-py2.6-linux-x86_64.egg/urwid/widget.py", line 141, in cached_render
+    canv = fn(self, size, focus=focus)
+  File "/usr/lib/python2.6/site-packages/urwid-1.1.1-py2.6-linux-x86_64.egg/urwid/container.py", line 1493, in render
+    canv = w.render((maxcol,), focus=focus and item_focus)
+  File "/usr/lib/python2.6/site-packages/urwid-1.1.1-py2.6-linux-x86_64.egg/urwid/widget.py", line 141, in cached_render
+    canv = fn(self, size, focus=focus)
+  File "/usr/lib/python2.6/site-packages/urwid-1.1.1-py2.6-linux-x86_64.egg/urwid/container.py", line 1493, in render
+    canv = w.render((maxcol,), focus=focus and item_focus)
+  File "/usr/lib/python2.6/site-packages/urwid-1.1.1-py2.6-linux-x86_64.egg/urwid/widget.py", line 141, in cached_render
+    canv = fn(self, size, focus=focus)
+  File "/usr/lib/python2.6/site-packages/urwid-1.1.1-py2.6-linux-x86_64.egg/urwid/widget.py", line 788, in render
+    maxcol, maxrow = size
+ValueError: need more than 1 value to unpack
diff --git a/src/ovirt/node/utils/process.py b/src/ovirt/node/utils/process.py
index 2f0cb17..27e96da 100644
--- a/src/ovirt/node/utils/process.py
+++ b/src/ovirt/node/utils/process.py
@@ -19,7 +19,6 @@
 # MA  02110-1301, USA.  A copy of the GNU General Public License is
 # also available at http://www.gnu.org/copyleft/gpl.html.
 from subprocess import STDOUT, PIPE
-import ovirt.node.utils
 import logging
 import subprocess
 import sys
@@ -72,6 +71,7 @@
 def check_output(*args, **kwargs):
     """subprocess.check_output wrapper to not leak file descriptors
     """
+    import ovirt.node.utils.system
     kwargs = __update_kwargs(kwargs)
     LOGGER.debug("Checking output with: %s %s" % (args, kwargs))
     if ovirt.node.utils.system.is_python_2_6():


-- 
To view, visit http://gerrit.ovirt.org/16211
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic779d49b0c1e46f416a5c62fc707a10bb5fb9baf
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Ryan Barry <rbarry at redhat.com>



More information about the node-patches mailing list