ewsterrenburg / python-otrs

Pythonic interface to OTRS SOAP API
GNU General Public License v3.0
47 stars 27 forks source link

Support for additional connectors (ConfigItemConnector, FAQConnector) #19

Closed mjducharme closed 8 years ago

mjducharme commented 8 years ago

I require support for the ConfigItemConnector in python-otrs, so that in addition to Tickets, I am able to work with Config items, etc. I am able to develop it myself, but first I found that the design of this code made it tricky to add new modules.

As a result, I spent quite a while re-architecting this, so that it is now very easy to add new modules to support the GenericConfigItemConnectorSOAP and other future connectors without cluttering things up too much.

In the process many methods have changed, but I carefully added methods to allow backward compatibility so that all existing code should work as before with this updated version.

https://github.com/mjducharme/python-otrs

I will be adding support for the ConfigItemConnector into this, but first I was hoping to get your feedback, because I would like to quickly get this to a state that you are happy to merge into your master (I would do a pull request to commit these changes). I am not a programmer by profession, but spent a long time researching the design of this and planning it out, so I hope I have done things in a sensible and python-ic way.

Thanks

mjducharme commented 8 years ago

To clarify, there are three levels of objects the client (an instance of GenericInterfaceClient), which contains one or more instances of the WebService object (normally just one, the ticketconnector, tc). The WebService object contains one or more Operation objects (TicketGet, TicketCreate, etc.). It is therefore structured just like OTRS itself (you have a webservice, and have operations inside that webservice).

After writing a configitem interface, one could use the same client to access both interfaces, example:

server_uri = r'https://otrs.example.net' ticket_webservice_name = 'GenericTicketConnectorSOAP' configitem_webservice_name = 'GenericConfigItemConnectorSOAP' client = GenericInterfaceClient(server_uri, tc=GenericTicketConnectorSOAP(ticket_webservice_name), cic=GenericConfigItemConnectorSOAP(configitem_webservice_name))

After this can call both client.tc.TicketGet(13) to get a ticket 13 or client.cic.ConfigItemGet(1000022) to get otrs itsm config item # 1000022

It is also structured so that the user can make their own custom web service object and add whatever operations they want to it, rather than the generic ones, so the same customization options available in OTRS to make this more in line with the OTRS web service design.

mjducharme commented 8 years ago

here are the new yml files from otrs:

https://github.com/OTRS/otrs/blob/master/development/webservices/GenericTicketConnectorSOAP.yml (older versions were called GenericTicketConnector.yml)

http://blog.otrs.org/wp-content/uploads/2014/11/GenericConfigItemConnectorSOAP.yml_.txt

mjducharme commented 8 years ago

I've started work on the ConfigItemConnector interface; I would have ConfigItemGet working already, unfortunately there seems to be a bug in OTRS where it is pulling the correct ConfigItem but fails to properly format it as SOAP output, so I've opened a bug report.

mjducharme commented 8 years ago

I've added support for GenericFAQConnectorSOAP and submitted a pull request as a result. Still need to add support for GenericConfigItemConnectorSOAP, after OTRS fixes their bug.

ewsterrenburg commented 8 years ago

Thanks for the hard work and the updates. I'll look into it soon (probably later this week).

Erwin

ewsterrenburg commented 8 years ago

@mjducharme Thanks again :). I merged your pull-request into a separate branch and made some additional changes (mostly linting, removed some unused imports and added some imports that were missing).

I will do some more testing/refinement in the near future before merging this into the master branch and create a new release. If you also do some changes meanwhile, you can make a pull request to this branch.

Backward compatibility is not that big of an issue for me, yet you seem to have handled it nicely so I'll keep it like this, maybe will add an extra section to the README.

Kind regards, Erwin

mjducharme commented 8 years ago

Excellent, this is great, lots of useful comments. There were a few comments that you added that are slightly inaccurate:

I might look into the OTRS bug myself regarding the ConfigItem connector, because they don't seem to be in a hurry to fix it.

ewsterrenburg commented 8 years ago

Updated the comments with your remarks and added the ssl_context in the same way as the loginname and password.

mjducharme commented 8 years ago

Good catch on the ssl_context, my server doesn't have SSL so I couldn't test that bit when I was coding.

ewsterrenburg commented 8 years ago

To do in near future:

To do beforehand: