Discussion:
[Linux-ha-dev] crmsh issues FutureWarning of python
Takatoshi MATSUO
2013-06-21 07:41:39 UTC
Permalink
Hi Dejan

I use latest crmsh(ff28b19bdb1d) and it issues FutureWarning of python
when using comment(#).

config.crm file
--------------------
# Comment
property \
no-quorum-policy="ignore" \
stonith-enabled="false" \
startup-fencing="false" \
stonith-timeout="20s"
--------------------

-------
# crm configure load update config.crm
/usr/lib64/python2.7/site-packages/crmsh/cibconfig.py:917:
FutureWarning: The behavior of this method will change in future
versions. Use specific 'len(elem)' or 'elem is not None' test instead.
if comments and node:
-------

I use python 2.7.3 on Fedora 18.
Python 2.6.6 issues same warning on RHEL6.

Thanks,
Takatoshi MATSUO
Dejan Muhamedagic
2013-06-21 08:20:18 UTC
Permalink
Hi Takatoshi-san,
Post by Takatoshi MATSUO
Hi Dejan
I use latest crmsh(ff28b19bdb1d) and it issues FutureWarning of python
when using comment(#).
config.crm file
--------------------
# Comment
property \
no-quorum-policy="ignore" \
stonith-enabled="false" \
startup-fencing="false" \
stonith-timeout="20s"
--------------------
-------
# crm configure load update config.crm
FutureWarning: The behavior of this method will change in future
versions. Use specific 'len(elem)' or 'elem is not None' test instead.
Fixed now. And some more. Hope there won't be any more in Future.

Cheers,

Dejan
Post by Takatoshi MATSUO
-------
I use python 2.7.3 on Fedora 18.
Python 2.6.6 issues same warning on RHEL6.
Thanks,
Takatoshi MATSUO
_______________________________________________________
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
Takatoshi MATSUO
2013-06-21 08:34:59 UTC
Permalink
Hi Dejan

Thank you for your quick response.
I can inhibit warnings.

Regards,
Takatoshi MATSUO
Post by Dejan Muhamedagic
Hi Takatoshi-san,
Post by Takatoshi MATSUO
Hi Dejan
I use latest crmsh(ff28b19bdb1d) and it issues FutureWarning of python
when using comment(#).
config.crm file
--------------------
# Comment
property \
no-quorum-policy="ignore" \
stonith-enabled="false" \
startup-fencing="false" \
stonith-timeout="20s"
--------------------
-------
# crm configure load update config.crm
FutureWarning: The behavior of this method will change in future
versions. Use specific 'len(elem)' or 'elem is not None' test instead.
Fixed now. And some more. Hope there won't be any more in Future.
Cheers,
Dejan
Post by Takatoshi MATSUO
-------
I use python 2.7.3 on Fedora 18.
Python 2.6.6 issues same warning on RHEL6.
Thanks,
Takatoshi MATSUO
_______________________________________________________
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
_______________________________________________________
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
Takatoshi MATSUO
2013-06-26 02:48:00 UTC
Permalink
Hi Dejan

I received another FutureWarning of python.

/usr/lib64/python2.6/site-packages/crmsh/completion.py:88:
FutureWarning: The behavior of this
method will change in future versions. Use specific 'len(elem)' or
'elem is not None' test instead.
if not doc

Regards,
Takatoshi MATSUO
Post by Takatoshi MATSUO
Hi Dejan
Thank you for your quick response.
I can inhibit warnings.
Regards,
Takatoshi MATSUO
Post by Dejan Muhamedagic
Hi Takatoshi-san,
Post by Takatoshi MATSUO
Hi Dejan
I use latest crmsh(ff28b19bdb1d) and it issues FutureWarning of python
when using comment(#).
config.crm file
--------------------
# Comment
property \
no-quorum-policy="ignore" \
stonith-enabled="false" \
startup-fencing="false" \
stonith-timeout="20s"
--------------------
-------
# crm configure load update config.crm
FutureWarning: The behavior of this method will change in future
versions. Use specific 'len(elem)' or 'elem is not None' test instead.
Fixed now. And some more. Hope there won't be any more in Future.
Cheers,
Dejan
Post by Takatoshi MATSUO
-------
I use python 2.7.3 on Fedora 18.
Python 2.6.6 issues same warning on RHEL6.
Thanks,
Takatoshi MATSUO
_______________________________________________________
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
_______________________________________________________
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
Dejan Muhamedagic
2013-06-26 07:42:33 UTC
Permalink
Hi Takatoshi-san,
Post by Takatoshi MATSUO
Hi Dejan
I received another FutureWarning of python.
FutureWarning: The behavior of this
method will change in future versions. Use specific 'len(elem)' or
'elem is not None' test instead.
if not doc
Fixed now. Thanks!

Dejan
Post by Takatoshi MATSUO
Regards,
Takatoshi MATSUO
Post by Takatoshi MATSUO
Hi Dejan
Thank you for your quick response.
I can inhibit warnings.
Regards,
Takatoshi MATSUO
Post by Dejan Muhamedagic
Hi Takatoshi-san,
Post by Takatoshi MATSUO
Hi Dejan
I use latest crmsh(ff28b19bdb1d) and it issues FutureWarning of python
when using comment(#).
config.crm file
--------------------
# Comment
property \
no-quorum-policy="ignore" \
stonith-enabled="false" \
startup-fencing="false" \
stonith-timeout="20s"
--------------------
-------
# crm configure load update config.crm
FutureWarning: The behavior of this method will change in future
versions. Use specific 'len(elem)' or 'elem is not None' test instead.
Fixed now. And some more. Hope there won't be any more in Future.
Cheers,
Dejan
Post by Takatoshi MATSUO
-------
I use python 2.7.3 on Fedora 18.
Python 2.6.6 issues same warning on RHEL6.
Thanks,
Takatoshi MATSUO
_______________________________________________________
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
_______________________________________________________
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
_______________________________________________________
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
Takatoshi MATSUO
2013-06-27 05:43:15 UTC
Permalink
Hi Dejan

Thanks.
But previous commit c8e7cb61 or 7c9df6e81 (Jun 21) cause this error
when using comment between configuration.

config.crm
------------------------
property \
no-quorum-policy="ignore" \
stonith-enabled="false" \
startup-fencing="false" \
stonith-timeout="20s"

# comment
primitive dummy ocf:heartbeat:Dummy
--------------

# crm configure load update config.crm
Traceback (most recent call last):
File "/usr/sbin/crm", line 44, in <module>
main.run()
File "/usr/lib64/python2.6/site-packages/crmsh/main.py", line 414, in run
do_work()
File "/usr/lib64/python2.6/site-packages/crmsh/main.py", line 323, in do_work
if parse_line(levels, shlex.split(' '.join(l))):
File "/usr/lib64/python2.6/site-packages/crmsh/main.py", line 149,
in parse_line
rv = d() # execute the command
File "/usr/lib64/python2.6/site-packages/crmsh/main.py", line 148, in <lambda>
d = lambda: cmd[0](*args)
File "/usr/lib64/python2.6/site-packages/crmsh/ui.py", line 1694, in load
return set_obj.import_file(method, url)
File "/usr/lib64/python2.6/site-packages/crmsh/cibconfig.py", line
268, in import_file
return self.save(s, method == "update")
File "/usr/lib64/python2.6/site-packages/crmsh/cibconfig.py", line
455, in save
if self.process(cli_list, update) == False:
File "/usr/lib64/python2.6/site-packages/crmsh/cibconfig.py", line
409, in process
obj = cib_factory.create_from_cli(cli_list)
File "/usr/lib64/python2.6/site-packages/crmsh/cibconfig.py", line
2615, in create_from_cli
node = obj.cli2node(cli_list)
File "/usr/lib64/python2.6/site-packages/crmsh/cibconfig.py", line
918, in cli2node
stuff_comments(node, comments)
File "/usr/lib64/python2.6/site-packages/crmsh/xmlutil.py", line
506, in stuff_comments
add_comment(node, s)
File "/usr/lib64/python2.6/site-packages/crmsh/xmlutil.py", line
503, in add_comment
e.insert(firstelem, comm_elem)
File "lxml.etree.pyx", line 723, in lxml.etree._Element.insert
(src/lxml/lxml.etree.c:32132)
TypeError: 'NoneType' object cannot be interpreted as an index



Commit ff28b19b doesn't issue this error.

Regards,
Takatoshi MATSUO
Post by Dejan Muhamedagic
Hi Takatoshi-san,
Post by Takatoshi MATSUO
Hi Dejan
I received another FutureWarning of python.
FutureWarning: The behavior of this
method will change in future versions. Use specific 'len(elem)' or
'elem is not None' test instead.
if not doc
Fixed now. Thanks!
Dejan
Post by Takatoshi MATSUO
Regards,
Takatoshi MATSUO
Post by Takatoshi MATSUO
Hi Dejan
Thank you for your quick response.
I can inhibit warnings.
Regards,
Takatoshi MATSUO
Post by Dejan Muhamedagic
Hi Takatoshi-san,
Post by Takatoshi MATSUO
Hi Dejan
I use latest crmsh(ff28b19bdb1d) and it issues FutureWarning of python
when using comment(#).
config.crm file
--------------------
# Comment
property \
no-quorum-policy="ignore" \
stonith-enabled="false" \
startup-fencing="false" \
stonith-timeout="20s"
--------------------
-------
# crm configure load update config.crm
FutureWarning: The behavior of this method will change in future
versions. Use specific 'len(elem)' or 'elem is not None' test instead.
Fixed now. And some more. Hope there won't be any more in Future.
Cheers,
Dejan
Post by Takatoshi MATSUO
-------
I use python 2.7.3 on Fedora 18.
Python 2.6.6 issues same warning on RHEL6.
Thanks,
Takatoshi MATSUO
_______________________________________________________
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
_______________________________________________________
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
_______________________________________________________
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
_______________________________________________________
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
Dejan Muhamedagic
2013-06-27 09:00:17 UTC
Permalink
Hi Takatoshi-san,
Post by Takatoshi MATSUO
Hi Dejan
Thanks.
But previous commit c8e7cb61 or 7c9df6e81 (Jun 21) cause this error
when using comment between configuration.
Oops. Good catch. Fixed now. Thanks for reporting!

Cheers,

Dejan
Post by Takatoshi MATSUO
config.crm
------------------------
property \
no-quorum-policy="ignore" \
stonith-enabled="false" \
startup-fencing="false" \
stonith-timeout="20s"
# comment
primitive dummy ocf:heartbeat:Dummy
--------------
# crm configure load update config.crm
File "/usr/sbin/crm", line 44, in <module>
main.run()
File "/usr/lib64/python2.6/site-packages/crmsh/main.py", line 414, in run
do_work()
File "/usr/lib64/python2.6/site-packages/crmsh/main.py", line 323, in do_work
File "/usr/lib64/python2.6/site-packages/crmsh/main.py", line 149,
in parse_line
rv = d() # execute the command
File "/usr/lib64/python2.6/site-packages/crmsh/main.py", line 148, in <lambda>
d = lambda: cmd[0](*args)
File "/usr/lib64/python2.6/site-packages/crmsh/ui.py", line 1694, in load
return set_obj.import_file(method, url)
File "/usr/lib64/python2.6/site-packages/crmsh/cibconfig.py", line
268, in import_file
return self.save(s, method == "update")
File "/usr/lib64/python2.6/site-packages/crmsh/cibconfig.py", line
455, in save
File "/usr/lib64/python2.6/site-packages/crmsh/cibconfig.py", line
409, in process
obj = cib_factory.create_from_cli(cli_list)
File "/usr/lib64/python2.6/site-packages/crmsh/cibconfig.py", line
2615, in create_from_cli
node = obj.cli2node(cli_list)
File "/usr/lib64/python2.6/site-packages/crmsh/cibconfig.py", line
918, in cli2node
stuff_comments(node, comments)
File "/usr/lib64/python2.6/site-packages/crmsh/xmlutil.py", line
506, in stuff_comments
add_comment(node, s)
File "/usr/lib64/python2.6/site-packages/crmsh/xmlutil.py", line
503, in add_comment
e.insert(firstelem, comm_elem)
File "lxml.etree.pyx", line 723, in lxml.etree._Element.insert
(src/lxml/lxml.etree.c:32132)
TypeError: 'NoneType' object cannot be interpreted as an index
Commit ff28b19b doesn't issue this error.
Regards,
Takatoshi MATSUO
Post by Dejan Muhamedagic
Hi Takatoshi-san,
Post by Takatoshi MATSUO
Hi Dejan
I received another FutureWarning of python.
FutureWarning: The behavior of this
method will change in future versions. Use specific 'len(elem)' or
'elem is not None' test instead.
if not doc
Fixed now. Thanks!
Dejan
Post by Takatoshi MATSUO
Regards,
Takatoshi MATSUO
Post by Takatoshi MATSUO
Hi Dejan
Thank you for your quick response.
I can inhibit warnings.
Regards,
Takatoshi MATSUO
Post by Dejan Muhamedagic
Hi Takatoshi-san,
Post by Takatoshi MATSUO
Hi Dejan
I use latest crmsh(ff28b19bdb1d) and it issues FutureWarning of python
when using comment(#).
config.crm file
--------------------
# Comment
property \
no-quorum-policy="ignore" \
stonith-enabled="false" \
startup-fencing="false" \
stonith-timeout="20s"
--------------------
-------
# crm configure load update config.crm
FutureWarning: The behavior of this method will change in future
versions. Use specific 'len(elem)' or 'elem is not None' test instead.
Fixed now. And some more. Hope there won't be any more in Future.
Cheers,
Dejan
Post by Takatoshi MATSUO
-------
I use python 2.7.3 on Fedora 18.
Python 2.6.6 issues same warning on RHEL6.
Thanks,
Takatoshi MATSUO
_______________________________________________________
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
_______________________________________________________
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
_______________________________________________________
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
_______________________________________________________
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
_______________________________________________________
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
Takatoshi MATSUO
2013-06-28 01:49:47 UTC
Permalink
Hi Dejan

Thanks.
I can confirm the bug is fixed.


Regards,
Takatoshi MATSUO
Post by Dejan Muhamedagic
Hi Takatoshi-san,
Post by Takatoshi MATSUO
Hi Dejan
Thanks.
But previous commit c8e7cb61 or 7c9df6e81 (Jun 21) cause this error
when using comment between configuration.
Oops. Good catch. Fixed now. Thanks for reporting!
Cheers,
Dejan
Post by Takatoshi MATSUO
config.crm
------------------------
property \
no-quorum-policy="ignore" \
stonith-enabled="false" \
startup-fencing="false" \
stonith-timeout="20s"
# comment
primitive dummy ocf:heartbeat:Dummy
--------------
# crm configure load update config.crm
File "/usr/sbin/crm", line 44, in <module>
main.run()
File "/usr/lib64/python2.6/site-packages/crmsh/main.py", line 414, in run
do_work()
File "/usr/lib64/python2.6/site-packages/crmsh/main.py", line 323, in do_work
File "/usr/lib64/python2.6/site-packages/crmsh/main.py", line 149,
in parse_line
rv = d() # execute the command
File "/usr/lib64/python2.6/site-packages/crmsh/main.py", line 148, in <lambda>
d = lambda: cmd[0](*args)
File "/usr/lib64/python2.6/site-packages/crmsh/ui.py", line 1694, in load
return set_obj.import_file(method, url)
File "/usr/lib64/python2.6/site-packages/crmsh/cibconfig.py", line
268, in import_file
return self.save(s, method == "update")
File "/usr/lib64/python2.6/site-packages/crmsh/cibconfig.py", line
455, in save
File "/usr/lib64/python2.6/site-packages/crmsh/cibconfig.py", line
409, in process
obj = cib_factory.create_from_cli(cli_list)
File "/usr/lib64/python2.6/site-packages/crmsh/cibconfig.py", line
2615, in create_from_cli
node = obj.cli2node(cli_list)
File "/usr/lib64/python2.6/site-packages/crmsh/cibconfig.py", line
918, in cli2node
stuff_comments(node, comments)
File "/usr/lib64/python2.6/site-packages/crmsh/xmlutil.py", line
506, in stuff_comments
add_comment(node, s)
File "/usr/lib64/python2.6/site-packages/crmsh/xmlutil.py", line
503, in add_comment
e.insert(firstelem, comm_elem)
File "lxml.etree.pyx", line 723, in lxml.etree._Element.insert
(src/lxml/lxml.etree.c:32132)
TypeError: 'NoneType' object cannot be interpreted as an index
Commit ff28b19b doesn't issue this error.
Regards,
Takatoshi MATSUO
Post by Dejan Muhamedagic
Hi Takatoshi-san,
Post by Takatoshi MATSUO
Hi Dejan
I received another FutureWarning of python.
FutureWarning: The behavior of this
method will change in future versions. Use specific 'len(elem)' or
'elem is not None' test instead.
if not doc
Fixed now. Thanks!
Dejan
Post by Takatoshi MATSUO
Regards,
Takatoshi MATSUO
Post by Takatoshi MATSUO
Hi Dejan
Thank you for your quick response.
I can inhibit warnings.
Regards,
Takatoshi MATSUO
Post by Dejan Muhamedagic
Hi Takatoshi-san,
Post by Takatoshi MATSUO
Hi Dejan
I use latest crmsh(ff28b19bdb1d) and it issues FutureWarning of python
when using comment(#).
config.crm file
--------------------
# Comment
property \
no-quorum-policy="ignore" \
stonith-enabled="false" \
startup-fencing="false" \
stonith-timeout="20s"
--------------------
-------
# crm configure load update config.crm
FutureWarning: The behavior of this method will change in future
versions. Use specific 'len(elem)' or 'elem is not None' test instead.
Fixed now. And some more. Hope there won't be any more in Future.
Cheers,
Dejan
Post by Takatoshi MATSUO
-------
I use python 2.7.3 on Fedora 18.
Python 2.6.6 issues same warning on RHEL6.
Thanks,
Takatoshi MATSUO
_______________________________________________________
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
_______________________________________________________
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
_______________________________________________________
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
_______________________________________________________
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
_______________________________________________________
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
_______________________________________________________
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/
Loading...