Fix repeat ID problem in library policy display
In library policy dashboard, sometimes the same rule is
repeated multiple times, overwriting some subsequent rules.
For example, in Policy Details: TagBasedNetworkSecurityZone,
the first two rules displays as
security_zone_tags('demo_zone'),
security_zone_tags('demo_zone')
rather than the correct
security_zone_tags('demo_zone'),
security_zone_tags('production_zone').
This patch fixes the issue by making sure a distinct ID is
assigned to each rule for django.
Change-Id: I20d758ec4dffeaecf60f6c60c401bb08e359def5
Closes-Bug: 1784770
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
# under the License.
|
||||
|
||||
import logging
|
||||
import uuid
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from horizon import messages
|
||||
@@ -56,7 +57,7 @@ class DetailView(tables.DataTableView):
|
||||
name = (head.split('(')[0]).replace('_', ' ').title()
|
||||
name = name.split('[')[0]
|
||||
r.set_value('name', name)
|
||||
r.set_id_if_empty(name)
|
||||
r.set_id_if_empty(uuid.uuid4())
|
||||
return rules
|
||||
except Exception as e:
|
||||
msg = _('Unable to list rules of library policy: %s') % str(e)
|
||||
|
||||
Reference in New Issue
Block a user