flagellum
Posts: 8
Joined: Mon Dec 08, 2014 5:26 pm

Can schedules and event listeners be scripted?

Postby flagellum » Wed Jan 14, 2015 10:27 pm

As part of my company's deployment process for Production sandboxes (Clover Server 3.5.0.57), I would like to automate the following:

[list=]
[*] creation of a schedule for new Jobflows
[*] creation of event listeners for new Jobflows
[/list]

These can both be selectively exported (as XML) and imported via the administrative Clover Server console, but is there any way to script these processes? (The HTTP API doesn't seem to cover these administrative tasks... Writing SQL scripts for the metadata database is possible...)

Thanks,
-- flag

kubosj
Posts: 372
Joined: Thu Jan 12, 2012 9:10 am

Re: Can schedules and event listeners be scripted?

Postby kubosj » Fri Jan 16, 2015 3:15 pm

Hi flag,

Unfortunately we don't have API for that. Most suitable seems export of configuration (operation export_server_config), doing change in XML, import of configuration (import_server_config). If you prepare template for scheduler/listener then automation may be easy.

I hope this helps.
Jaroslav Kubos
CloverCARE Support
CloverETL | Rapid Data Integration

Visit us online at http://www.cloveretl.com

flagellum
Posts: 8
Joined: Mon Dec 08, 2014 5:26 pm

Re: Can schedules and event listeners be scripted?

Postby flagellum » Fri Jan 16, 2015 3:42 pm

Seems like a viable approach, especially since our deployment process can easily use the HTTP API (http://server-demo-ec2.cloveretl.com/cl ... ver_config) via PowerShell. 8)

One last question then: If I import 'schedules' for example, will they completely overwrite all all the schedules on the target server, or will new ones just be added to the existing schedules? (I'll try it out myself on our dev server when possible.)

This is quite important because our production server will probably have schedules that are NOT on our development server and I do not want to accidentally delete production schedules!

Thanks again,
-- flag

kubosj
Posts: 372
Joined: Thu Jan 12, 2012 9:10 am

Re: Can schedules and event listeners be scripted?

Postby kubosj » Fri Jan 16, 2015 3:53 pm

There is parameter "newOnly" on mentioned service doing exactly what you want. Existing schedulers not presented in XML will be left untouched anyway.
Jaroslav Kubos
CloverCARE Support
CloverETL | Rapid Data Integration

Visit us online at http://www.cloveretl.com

flagellum
Posts: 8
Joined: Mon Dec 08, 2014 5:26 pm

Re: Can schedules and event listeners be scripted?

Postby flagellum » Fri Jan 16, 2015 3:58 pm

Excellent - I did see that parameter but I was concerned about the Hibernate Sequence in the Clover database and the possibility that, if there is an overlap of IDs how the 'upsert' process would react to that. Please consider this thread solved.

-- flag

flagellum
Posts: 8
Joined: Mon Dec 08, 2014 5:26 pm

Re: Can schedules and event listeners be scripted?

Postby flagellum » Tue Jan 20, 2015 10:03 pm

I'm going to try the HTTP API 's import_server_config. Assuming there is a file on the Clover server, c:\temp\listeners.xml, which has my event listeners:

HTTP GET
{my server's base URL}:8080/clover/simpleHttpApi/import_server_config?newOnly=true&include=eventListeners&verbose=FULL&xmlFile=c%3A%5Ctemp%5Clisteners.xml

The xml file content is from a config export from the Clover Server GUI. I deleted the corresponding listener and executed this HTTP GET import process, but no luck with either Postman or Fiddler (using Basic auth and the Clover administrative user credentials).

The import call gives an HTTP 200 response and sadly isn't accompanied by any message. I've attached the xml file. Can you provide some insight how to get this import to work?

Thanks,
-- flag
Attachments
listeners.xml
(1.21 KiB) Downloaded 46 times

slechtaj
Posts: 192
Joined: Wed Aug 15, 2012 8:18 am

Re: Can schedules and event listeners be scripted?

Postby slechtaj » Mon Jan 26, 2015 11:22 am

Hi Flag,

you should use POST method instead of GET. See the screenshot from Postman below:
postman.png
postman.png (15.13 KiB) Viewed 1606 times


Hope this helps.
Jan Slechta
CloverCARE Support
CloverETL | Rapid Data Integration

Visit us online at http://www.cloveretl.com

How to speed up communication with CloverCARE support

flagellum
Posts: 8
Joined: Mon Dec 08, 2014 5:26 pm

Re: Can schedules and event listeners be scripted?

Postby flagellum » Wed Jan 28, 2015 4:20 am

Thanks Jan,

This works perfectly fine as a POST with Postman (can't believe I missed that :shock: ).

I've also managed it in PowerShell for our Windows-based deployment automation, using 'Invoke-WebRequest' and constructing the body of the message using a .Net StringBuilder since PowerShell isn't as straightforward as CURL for this flavor of POST.

(Shameless plug for Fiddler's 'compare' feature, without which I would have spent hours finding out why my PowerShell requests were failing while Postman's worked just fine!)

Thanks again,
-- flag
Attachments
CloverConfigUpload.ps1.txt
Apologies if my obfuscation of sensitive information from a working script introduced any syntax errors.
(3.43 KiB) Downloaded 47 times


cron