openxenmanager icon indicating copy to clipboard operation
openxenmanager copied to clipboard

Exception in thread with protocol

Open panaceya opened this issue 9 years ago • 4 comments

At start on connect to my XenServer i see this error

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 763, in run
    self.__target(*self.__args, **self.__kwargs)
  File "./src/OXM/oxcSERVER_addserver.py", line 50, in connect_server
    protocol = ["http", "https"][self.ssl]
TypeError: list indices must be integers, not str

Exception in thread Thread-3:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 763, in run
    self.__target(*self.__args, **self.__kwargs)
  File "./src/OXM/oxcSERVER_addserver.py", line 50, in connect_server
    protocol = ["http", "https"][self.ssl]
TypeError: list indices must be integers, not str

panaceya avatar May 15 '15 10:05 panaceya

I'm not able to reproduce this error myself... Can you try the latest sources and see if the eror still exists for you?

TwoWheelDev avatar Jun 10 '15 18:06 TwoWheelDev

I update source and try again:

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 763, in run
    self.__target(*self.__args, **self.__kwargs)
  File "./src/OXM/oxcSERVER_addserver.py", line 50, in connect_server
    protocol = ["http", "https"][self.ssl]
TypeError: list indices must be integers, not str

panaceya avatar Aug 27 '15 11:08 panaceya

Currently i have installed openxenmanager 0.r80+dfsg-4 on my Ubuntu. It work nice. But version from this repository not working, if files in dir $HOME/.config/openxenmanager created from previous (0.r80+dfsg-40.r80+dfsg-4) version.

Distributor ID: Ubuntu
Description:    Ubuntu 15.04 
Release:        15.04                      
Codename:       vivid 
Package: openxenmanager
Priority: extra
Section: universe/admin
Installed-Size: 3049
Maintainer: Ubuntu Developers <[email protected]>
Original-Maintainer: Ritesh Raj Sarraf <[email protected]>
Architecture: all
Version: 0.r80+dfsg-4
Depends: python, python-gtk-vnc, python-gtk2, python-glade2
Filename: pool/universe/o/openxenmanager/openxenmanager_0.r80+dfsg-4_all.deb
Size: 378074
MD5sum: 8db25fa090a9e8e9500fa84cac370a1a
SHA1: 6788bfe90a3aad57151ab403e9b44f5259be8f85
SHA256: d9a07e53356cdc04238e0b1c215f2cfbeb3727f88ff7d4a5c1a20d4457be62c5
Description-en: full-featured graphical management tool for xen using xenapi
 OpenXenManager is a graphical interface to manage XenServer / Xen Cloud
 Platform (XCP) hosts through the network
 .
 OpenXenManager is an open-source multiplatform clone of XenCenter (Citrix)
Description-md5: ccabfdfa43cfd012dd01400f94f7d444
Homepage: http://sourceforge.net/projects/openxenmanager/
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Origin: Ubuntu

The following patch allows two versions of the same system.

diff --git a/src/OXM/window.py b/src/OXM/window.py
index 9ca74a0..fda245d 100644
--- a/src/OXM/window.py
+++ b/src/OXM/window.py
@@ -154,10 +154,10 @@ class oxcWindow(oxcWindowVM, oxcWindowHost, oxcWindowProperties,
         if sys.platform != "win32":
             if not os.path.exists(os.path.join(os.path.expanduser("~"), ".config")):
                 os.mkdir(os.path.join(os.path.expanduser("~"), ".config"))
-            if not os.path.exists(os.path.join(os.path.expanduser("~"), ".config", "openxenmanager")):
-                os.mkdir(os.path.join(os.path.expanduser("~"), ".config", "openxenmanager"))
-            dirconfig = os.path.join(os.path.expanduser("~"), ".config", "openxenmanager")
-            pathconfig = os.path.join(os.path.expanduser("~"), ".config", "openxenmanager", "oxc.conf")
+            if not os.path.exists(os.path.join(os.path.expanduser("~"), ".config", "openxenmanager-devel")):
+                os.mkdir(os.path.join(os.path.expanduser("~"), ".config", "openxenmanager-devel"))
+            dirconfig = os.path.join(os.path.expanduser("~"), ".config", "openxenmanager-devel")
+            pathconfig = os.path.join(os.path.expanduser("~"), ".config", "openxenmanager-devel", "oxc.conf")
         else: 
             if not os.path.exists(os.path.join(os.path.expanduser("~"), "openxenmanager")):
                 os.mkdir(os.path.join(os.path.expanduser("~"), "openxenmanager"))
diff --git a/src/OXM/window_addserver.py b/src/OXM/window_addserver.py
index 7b4a7dd..ee45987 100644
--- a/src/OXM/window_addserver.py
+++ b/src/OXM/window_addserver.py
@@ -180,8 +180,11 @@ class AddServer(object):
             self.builder.get_object("progressconnect").pulse()
             server.connectThread.join(1)
         # TODO: what does this variable do?
-        if self.selected_host is None:
-            self.selected_host = server.host
+        try:
+           if self.selected_host is None:
+                 self.selected_host = server.host
+       except:
+           pass

     def server_connect_success(self, server):
         """
@@ -481,4 +484,4 @@ class AddServer(object):
             self.xc_servers[self.selected_host].fill_alerts(self.listalerts)
             self.update_n_alerts()
         finally:
-            self.server_sync_finish(server)
\ No newline at end of file
+            self.server_sync_finish(server)

panaceya avatar Aug 28 '15 08:08 panaceya

I can report same: had a previous version, and the oxm.conf was present

BUT, i removed the old oxm.conf from ~/.config/openxenmanager source is: github master 1cb5c1cb13358ba584856e99a94f9669d17670ff

Distributor ID:	Ubuntu
Description:	Ubuntu 14.04.5 LTS
Release:	14.04
Codename:	trusty

and the fresh created oxm.conf also produces this error:

~/openxenmanager/github/openxenmanager$ ./openxenmanager
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 763, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/local/lib/python2.7/dist-packages/openxenmanager-0.1b1-py2.7.egg/OXM/oxcSERVER_addserver.py", line 50, in connect_server
    protocol = ["http", "https"][self.ssl]
TypeError: list indices must be integers, not str

Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 763, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/local/lib/python2.7/dist-packages/openxenmanager-0.1b1-py2.7.egg/OXM/window_addserver.py", line 183, in update_connect_status
    if self.selected_host is None:
AttributeError: 'AddServer' object has no attribute 'selected_host'

gnanet avatar Mar 06 '18 09:03 gnanet