[openstack-dev] [Congress] Push Type Driver implementation

Masahito MUROI muroi.masahito at lab.ntt.co.jp
Fri Mar 25 05:07:47 UTC 2016


I checked it, too. The reason why python client raises error is it 
expects driver has dict parameter in config field. But the doctor driver 
has None in the field, then it causes "'NoneType' object has no 
attribute 'items'".

The workaround I think is python client will allow None in the config 
field, or another is Congress Server returns {} if the field is None. I 
pushed a patch about first workaround[1], so please check it.

[1]: https://review.openstack.org/#/c/297515/

On 2016/03/25 3:34, Tim Hinrichs wrote:
> I tried the doctorDriver again.  This time I was successful!  I'm still
> getting an error when listing the datasources though.  I tried updating
> and installing my client, but no change.
>
> // Create the datasource
> $ openstack congress datasource create doctor doctor
> +-------------+--------------------------------------+
> | Field       | Value                                |
> +-------------+--------------------------------------+
> | config      | None                                 |
> | description | None                                 |
> | driver      | doctor                               |
> | enabled     | True                                 |
> | id          | 3717095c-25a7-4fe2-8f18-25d845b11c60 |
> | name        | doctor                               |
> | type        | None                                 |
> +-------------+--------------------------------------+
>
> // Push data
> $ curl -g -i -X PUT
> http://localhost:1789/v1/data-sources/3717095c-25a7-4fe2-8f18-25d845b11c60/tables/events/rows
> -H "User-Agent: python-congressclient" -H "Content-Type:
> application/json" -H "Accept: application/json" -d  '[
>  >       {
>  >         "id": "0123-4567-89ab",
>  >         "time": "2016-02-22T11:48:55Z",
>  >         "type": "compute.host.down",
>  >         "details": {
>  >             "hostname": "compute1",
>  >             "status": "down",
>  >             "monitor": "zabbix1",
>  >             "monitor_event_id": "111"
>  >         }
>  >       }
>  >     ]'
> HTTP/1.1 200 OK
> Content-Type: application/json; charset=UTF-8
> Content-Length: 0
> X-Openstack-Request-Id: req-47c6dfdf-74cd-4101-829a-657b6aea1e2c
> Date: Thu, 24 Mar 2016 18:28:31 GMT
>
>
> // Ask for contents of table that we pushed
> $ openstack congress datasource row list doctor events
> +----------------+------------------+------------------+----------+--------+---------+------------------+
> | id             | time             | type             | hostname |
> status | monitor | monitor_event_id |
> +----------------+------------------+------------------+----------+--------+---------+------------------+
> | 0123-4567-89ab | 2016-02-22T11:48 | compute.host.dow | compute1 | down
>    | zabbix1 | 111              |
> |                | :55Z             | n                |          |
>     |         |                  |
> +----------------+------------------+------------------+----------+--------+---------+------------------+
>
>
> // List the datasources
> $ openstack congress datasource list
> 'NoneType' object has no attribute 'items'
>
> Tim
>
>
> On Thu, Mar 17, 2016 at 5:56 PM Tim Hinrichs <tim at styra.com
> <mailto:tim at styra.com>> wrote:
>
>     I tried the doctor driver out.  I just added the file to
>     congress/datasources, and set up /etc/congress/congress.conf to
>     include congress.datasources.doctor_driver.DoctorDriver.
>
>     I could create a new doctor driver, but afterwards I couldn't list
>     all the datasources, and I couldn't push any data to it.  See
>     transcript below.
>
>     $ openstack congress datasource create doctor doctor
>     +-------------+--------------------------------------+
>     | Field       | Value                                |
>     +-------------+--------------------------------------+
>     | config      | None                                 |
>     | description | None                                 |
>     | driver      | doctor                               |
>     | enabled     | True                                 |
>     | id          | 906c6327-15f1-4f3c-aa51-1590540c06b9 |
>     | name        | doctor                               |
>     | type        | None                                 |
>     +-------------+--------------------------------------+
>
>     $ openstack congress datasource list
>     'NoneType' object has no attribute 'items'
>
>     The other problem I saw was that the schema was fixed for the doctor
>     driver.  So I tried to create a push driver that would accept any
>     collection of tuples.  This wouldn't allow the user to push
>     arbitrary JSON, but they could push any tuples they'd like.  While
>     experimenting, I fixed the problem mentioned above by adding a
>     single (unnecessary) configuration option.  Then I ran into a
>     Datasource not found problem.  I pushed the code to review so we can
>     all take a look.
>
>     https://review.openstack.org/294348
>
>     $ curl -g -i -X PUT
>     http://localhost:1789/v1/data-sources/push/tables/data/rows -H
>     "User-Agent: python-congressclient" -H "Content-Type:
>     application/json" -H "Accept: application/json" -d '[[1]]'
>     HTTP/1.1 404 Not Found
>     Content-Type: application/json; charset=UTF-8
>     Content-Length: 102
>     X-Openstack-Request-Id: req-23432974-b107-4657-9bbc-c2e05fd25a98
>     Date: Thu, 17 Mar 2016 21:13:03 GMT
>
>     {"error": {"message": "Not Found::Datasource not found push",
>     "error_data": null, "error_code": 404}}
>
>     Masahito: do you know what the Datasource Not Found problem is? If
>     not, could you look into it? I ran into it with the Doctor Driver too.
>
>     Tim
>
>
>     On Thu, Mar 17, 2016 at 2:31 AM Masahito MUROI
>     <muroi.masahito at lab.ntt.co.jp <mailto:muroi.masahito at lab.ntt.co.jp>>
>     wrote:
>
>         Hi folks,
>
>         This[1] is the driver I mentioned at meeting. It is used for OPNFV
>         Doctor[2]. So I plan to push it into master in Newton release, since
>         feature freeze for Mitaka was passed and the schema of its
>         translator is
>         under the discussion.
>
>         If it's worth to push it in current release to test push driver,
>         I don't
>         mind doing it.
>
>         [1]
>         https://github.com/muroi/congress/blob/doctor-poc/congress/datasources/doctor_driver.py
>         [2] https://wiki.opnfv.org/doctor
>
>         --
>         室井 雅仁(Masahito MUROI)
>         Software Innovation Center, NTT
>         Tel: +81-422-59-4539
>
>
>
>         __________________________________________________________________________
>         OpenStack Development Mailing List (not for usage questions)
>         Unsubscribe:
>         OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
>         <http://OpenStack-dev-request@lists.openstack.org?subject:unsubscribe>
>         http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>
>
>
> __________________________________________________________________________
> OpenStack Development Mailing List (not for usage questions)
> Unsubscribe: OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>


-- 
室井 雅仁(Masahito MUROI)
Software Innovation Center, NTT
Tel: +81-422-59-4539





More information about the OpenStack-dev mailing list