RTSLibError: Expected type 'unicode' and got 'str'.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi all,

when trying to instantiate the FabricModule class for qla2xxx, I
sometimes get this:

> ... File "/srv/openattic/lio/models.py", line 159, in lio_object 
> fabric = target.FabricModule(self.type) File
> "/usr/lib/python2.7/dist-packages/rtslib/target.py", line 56, in
> __init__ self.spec = self._parse_spec() File
> "/usr/lib/python2.7/dist-packages/rtslib/target.py", line 144, in
> _parse_spec % (defaults_type, spec_type)) RTSLibError: Wrong type
> for option 'kernel_module' in /var/target/fabric/qla2xxx.spec.
> Expected type 'unicode' and got 'str'.

Is this a bug in rtslib, or am I doing something wrong? The following
patch for rtslib/target.py seems to help:

- --- /tmp/target.py      2013-06-27 14:54:43.479909271 +0200
+++ /usr/share/pyshared/rtslib/target.py        2013-06-26
15:01:31.325077815 +0200
@@ -138,6 +138,8 @@
                 # Type mismatch, go through acceptable conversions
                 if spec_type == 'str' and defaults_type == 'list':
                     spec[option] = [spec[option]]
+                elif spec_type == 'str' and defaults_type == 'unicode':
+                    spec[option] = unicode(spec[option], "utf-8")
                 else:
                     raise RTSLibError("Wrong type for option '%s' in
%s. "
                                       % (option, spec_file)

Cheers,
Michael
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Icedove - http://www.enigmail.net/

iQEcBAEBAgAGBQJRzDbgAAoJEEn0ejpI+BVD2n4H/j/M4KhPcMq1NczpUIhmq1lq
dJskZLlpmgN1tjCniHtfDe3g4k2Ii5zs4N0Twbf3tOjd0n+awC3pLO3s0crUpuxP
FjoPhI5yOR5NgUlqD4z6WkS7CnnJNI8lGoQH9R+yrTB7Rg7nAwpupkYeoHlr3NHs
7YLfyzBWL76oIwEF8aE1eMCFNEN/3K7wHtwe4H7E2nOhyEWurtdHVW+JluMIWA2y
jknFkKQ7sQp5hr4UIKDHeuKiKJ9LxIPtepzXVQQjDDUSMtChLTJq0y+PtzlkGeFC
tQ32LUvI6Avp+mzZGNTTK6RhkP+y6Z8g2Fg4lHkBln935g74BYoYXyCyjRxVkBo=
=okrv
-----END PGP SIGNATURE-----
--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux