Can not sort audit templates list with goal
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
watcher |
Fix Released
|
Medium
|
Egor Panfilov |
Bug Description
Description
===========
Failed to list audit templates with the sort key 'goal_name' or 'Goal'.
Steps to reproduce
==================
* openstack optimize audittemplate list --sort-key goal_id
goal_id is an invalid field for sorting, valid values for --sort-key are: ['uuid', 'name', 'UUID', 'goal_name', 'Strategy', 'strategy_name', 'Name', 'Goal']
* openstack optimize audittemplate list --sort-key goal_name
Sort key supplied is invalid: goal_name (HTTP 500)
Expected result
===============
Sort audit templates list successfully
Actual result
=============
Got invalid sort key.
Logs
=============
2017-02-08 20:40:52.752 ERROR wsme.api [req-c3c30704-
Traceback (most recent call last):
File "/usr/lib/
result = f(self, *args, **kwargs)
File "/opt/stack/
filters, marker, limit, sort_key, sort_dir)
File "/opt/stack/
sort_
File "/usr/lib/
result = fn(cls, context, *args, **kwargs)
File "/opt/stack/
eager=eager)
File "/opt/stack/
sort_key, sort_dir, query)
File "/opt/stack/
marker=marker, sort_dir=sort_dir)
File "/usr/lib/
raise exception.
InvalidSortKey: Sort key supplied is invalid: goal_name
Environment
===========
# ENV
devstack
# version
- devstack:
git log
commit bab8516a8503445
Merge: 0ab0e50 10db2b8
Author: Jenkins <email address hidden>
Date: Fri Feb 3 16:24:32 2017 +0000
Merge "Enable VNC console in tempest.conf"
- watcher:
$ git log
commit 26c7726c00ea378
Merge: 4b5dce5 5b2cdb5
Author: Jenkins <email address hidden>
Date: Fri Feb 3 09:33:24 2017 +0000
Merge "Using items() instead of six.iteritems()"
- watchclient
# pip show python-
Name: python-
Version: 1.0.1.dev6
Summary: Python client library for Watcher API
Home-page: http://
Author: OpenStack
Author-email: <email address hidden>
License: UNKNOWN
Location: /opt/stack/
Requires: Babel, cliff, osc-lib, oslo.i18n, oslo.utils, pbr, PrettyTable, keystoneauth1, six, PyYAML
Extended bug fix
================
This bug is also affects some other models, like Strategy. When sorting
made with sort key that is not in model's fields, this key passed to DB
where key couldn't be found in model's table, because it belongs to Goal
or Strategy, for example. As a temporary fix, we could add simple validation
routine for preventing situations when invalid key passed to DB and do
sorting with keys like goal_name and strategy_name on API side without accessing to DB.
Changed in watcher: | |
status: | New → In Progress |
assignee: | nobody → Eric Xie (eric-xie) |
Changed in watcher: | |
assignee: | Eric Xie (eric-xie) → nobody |
status: | In Progress → New |
Changed in watcher: | |
status: | New → Triaged |
milestone: | none → rocky-1 |
Changed in watcher: | |
importance: | Undecided → Medium |
Changed in watcher: | |
assignee: | nobody → Egor Panfilov (erakli) |
description: | updated |
Fix proposed to branch: master /review. openstack. org/552534
Review: https:/