Reloading/installing plone products from the command lineΒΆ

Tags: plone

I had to do a bit of "continuous integration" magic in the last few days: installing a fresh zope instance, installing plone, installing two other products and starting the server, all from a shell script.

One part was simple: creating a new zope instance, installing plone and then zipping up the zope instance directory including all plone products and so. To ease further changes, I copied the config file and the Data.fs also. Copying? Yes, into the subversion project where I also stored the zope instance zip.

Then I added a reload.sh that removed the previous instance, unzipped the pre-packaged one, copied in the Data.fs and the config file, changedirred into the Products dir and checked out fresh copies of the two relevant projects out of subversion. Then it starts up the zope instance.

So far so good, the only thing left to do is to call the quickinstaller to install the two projects. Ouch, that took me almost a day of frustration.

  • I figured out the URL to call and called that with wget. Of course with the needed --http-user and --http-passwd options. No luck, plone returns a form where you can fill in your username/password.

    Calling things inside the zope root instead of the plone root works fine with that http authentication, by the way.

  • Calling the login page with wget and then calling the quickinstaller also didn't work. Wget doesn't store state in between. Telling it to set cookies also didn't solve the problem.
  • Ok, then off to python itself and the urllib.urlopen() stuff. I gave up after an hour or so. Either no state was saved or something else went wrong (I forgot what it was).
  • I got a tip to use __ac_username and __ac_password options in the URL when calling a page. I did that with wget. It did work! Only problem was that it got a redirection to the same page afterwards. Taking a lot of time. And again. And somehow installing the same product over and over again (which shouldn't happen). Since the second product imports some 2000 existing html pages, this was hosing the server.
  • In the end, the solution was simple. Write a sort script in the zope root that calls the quickinstaller from the plone subdirectory inside the zope root. As zope itself does work with the simple --http-user authentication, this worked like a charm.

    (I just had to load the fresh zope instance, add the python script inside zope and copy that Data.fs off to my reload shell script's directory).

In the end, it works. And it's nice to be able to hit reload.sh and get a completely fresh instance with all relevant products. It was a good learning experience for further continuous integration work, but it still took way too much time.

 
vanrees.org logo

About me

My name is Reinout van Rees and I work a lot with Python (programming language) and Django (website framework). I live in The Netherlands and I'm happily married to Annie van Rees-Kooiman.

Weblog feeds

Most of my website content is in my weblog. You can keep up to date by subscribing to the automatic feeds (for instance with Google reader):