cluster-collect --list cannot work

Bug #1643454 reported by miaohb
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-senlinclient
Fix Committed
Undecided
miaohb

Bug Description

stack@tecs:/home/tecs$ senlin cluster-collect --path name --list mycluster
WARNING (shell) "senlin cluster-collect" is deprecated and will be removed by Apr 2017, please use "openstack cluster collect" instead.
Unknown exception: Circular reference detected

miaohb (miao-hongbao)
Changed in senlin:
assignee: nobody → miaohb (miao-hongbao)
status: New → In Progress
Revision history for this message
Qiming Teng (tengqim) wrote :

need more details about the circular reference thing ...

Changed in senlin:
status: In Progress → Incomplete
Revision history for this message
miaohb (miao-hongbao) wrote :

Hi,Qiming. Look at these code:

senlinclient/common/utils.py(152)print_list()
    if args.list:
        fields = ['node_id', 'attr_value']
        formatters = {
            'attr_value': utils.json_formatter
        }
        if not args.full_id:
            formatters['node_id'] = lambda x: x.node_id[:8]
        utils.print_list(attrs, fields, formatters=formatters)

senlinclient/common/utils.py(102)_print_list()
130 -> for o in objs:
131 row = []
132 for field in fields:
133 if field in formatters:
134 data = formatters[field](o)

When field = 'attr_value', formatters[field](o) = json_formatter(o)

(Pdb) p o
openstack.cluster.v1.cluster_attr.ClusterAttr(id=d7759238-b608-49bb-9db6-4b6e7ca27b63, value=node1)

(Pdb) p json_formatter(o)
*** ValueError: ValueError('Circular reference detected',)
(Pdb) p jsonutils.dumps(o)
*** ValueError: ValueError('Circular reference detected',)

I think the right parameter for json_formatter should be o.attr_value, but in this line, I don't know how to modify it.

        formatters = {
            'attr_value': utils.json_formatter
        }

Can you give an advice? thanks.

Revision history for this message
miaohb (miao-hongbao) wrote :

The commit has been merged:

Fix error in cluster collect

Formatter of "attr_value" is error, which will cause "ValueError"
when doing print_list. This patch changes its formatter from
"json_formatter" to "lambda x: utils.json_formatter(x.attr_value)"

Change-Id: Ie058b034ab27b8600ebad07429012c3fea671775
Closes-Bug: #1643454

affects: senlin → python-senlinclient
Changed in python-senlinclient:
status: Incomplete → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/python-senlinclient 1.1.0

This issue was fixed in the openstack/python-senlinclient 1.1.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.