nova/neutron format integration is failed

Bug #1655581 reported by Masaya Aoyama
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Designate
Fix Released
Undecided
Masaya Aoyama

Bug Description

In the configuration file, we can use format parameter with designate-sink.
But "project" parameter can not use now.
   ex) #formatv4 = '%(hostname)s.%(project)s.%(domain)s'

https://github.com/openstack/designate/blob/master/designate/notification_handler/nova.py#L68

In the source file, use "getattr", but it doesn't work (context is dict object).
And "tenant" key is undefined from notification data.

For example...
-------------------------
{
    "auth_token": "45f7a05107d043e6ab31b968c7272abe",
    "domain": "None",
    "instance_lock_checked": "False",
    "is_admin": "True",
    "is_admin_project": "True",
    "project_domain": "None",
    "project_id": "ee3dce5c65df4e2ea6661e5f88a1e268",
    "project_name": "demo",
    "quota_class": "None",
    "read_deleted": "no",
    "read_only": "False",
    "remote_address": "172.17.125.160",
    "request_id": "req-f5d86fa3-ff33-46b7-b10b-af576520ee11",
    "resource_uuid": "None",
    "roles": [
        "admin"
    ],
    "service_catalog": [
        {
            "endpoints": [
                {
                    "adminURL": "http://172.17.125.160:8776/v1/ee3dce5c65df4e2ea6661e5f88a1e268",
                    "internalURL": "http://172.17.125.160:8776/v1/ee3dce5c65df4e2ea6661e5f88a1e268",
                    "publicURL": "http://172.17.125.160:8776/v1/ee3dce5c65df4e2ea6661e5f88a1e268",
                    "region": "RegionOne"
                }
            ],
            "name": "cinder",
            "type": "volume"
        },
        {
            "endpoints": [
                {
                    "adminURL": "http://172.17.125.160:8776/v2/ee3dce5c65df4e2ea6661e5f88a1e268",
                    "internalURL": "http://172.17.125.160:8776/v2/ee3dce5c65df4e2ea6661e5f88a1e268",
                    "publicURL": "http://172.17.125.160:8776/v2/ee3dce5c65df4e2ea6661e5f88a1e268",
                    "region": "RegionOne"
                }
            ],
            "name": "cinderv2",
            "type": "volumev2"
        }
    ],
    "show_deleted": "False",
    "tenant": "ee3dce5c65df4e2ea6661e5f88a1e268",
    "timestamp": "2017-01-11T09:38:17.431153",
    "user": "0b43a53f3d2e48fc9e9ae0e0ac9ec751",
    "user_domain": "None",
    "user_id": "0b43a53f3d2e48fc9e9ae0e0ac9ec751",
    "user_identity": "0b43a53f3d2e48fc9e9ae0e0ac9ec751 ee3dce5c65df4e2ea6661e5f88a1e268 - - -",
    "user_name": "admin"
}
-------------------------

So, I try to change

from
  payload['project'] = getattr(context, 'tenant', None)
to
  payload['project'] = context.get("project_name", None)

And neutron format integration has same issue.
https://github.com/openstack/designate/blob/master/designate/notification_handler/neutron.py#L73-L74

I can fix it.

Changed in designate:
assignee: nobody → Masaya Aoyama (masaya-aoyama)
description: updated
Changed in designate:
status: New → In Progress
description: updated
summary: - nova format integration is failed
+ nova/neutron format integration is failed
description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to designate (master)

Fix proposed to branch: master
Review: https://review.openstack.org/418813

Changed in designate:
status: In Progress → Fix Committed
Revision history for this message
Adrien Cunin (adri2000) wrote :

Unfortunately, it's not fix committed as the patch hasn't been merged yet.

Changed in designate:
status: Fix Committed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to designate (master)

Reviewed: https://review.openstack.org/418813
Committed: https://git.openstack.org/cgit/openstack/designate/commit/?id=b23cae7b7839af2d2ed38c06a126f1e2a869ddd3
Submitter: Jenkins
Branch: master

commit b23cae7b7839af2d2ed38c06a126f1e2a869ddd3
Author: MasayaAoyama <email address hidden>
Date: Wed Jan 11 19:00:15 2017 +0900

    nova/neutron format integration is failed

    Modify designate-sink formatv4/v6 parameter "project".
    "tenant" key is not contain at "context" variable,
    so I use "project_name" key.
    And "context" dict object cannot use getattr function.

    Change-Id: If485766a928bc2143b0b15afe99af38a6f927239
    Closes-Bug: #1655581

Changed in designate:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to designate (stable/ocata)

Fix proposed to branch: stable/ocata
Review: https://review.openstack.org/475768

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to designate (stable/ocata)

Reviewed: https://review.openstack.org/475768
Committed: https://git.openstack.org/cgit/openstack/designate/commit/?id=586db067579aa5828d03b566dc0a50d5a49235da
Submitter: Jenkins
Branch: stable/ocata

commit 586db067579aa5828d03b566dc0a50d5a49235da
Author: MasayaAoyama <email address hidden>
Date: Wed Jan 11 19:00:15 2017 +0900

    nova/neutron format integration is failed

    Modify designate-sink formatv4/v6 parameter "project".
    "tenant" key is not contain at "context" variable,
    so I use "project_name" key.
    And "context" dict object cannot use getattr function.

    Change-Id: If485766a928bc2143b0b15afe99af38a6f927239
    Closes-Bug: #1655581
    (cherry picked from commit b23cae7b7839af2d2ed38c06a126f1e2a869ddd3)

tags: added: in-stable-ocata
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/designate 5.0.0.0b3

This issue was fixed in the openstack/designate 5.0.0.0b3 development milestone.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/designate ocata-eol

This issue was fixed in the openstack/designate ocata-eol 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.