new receiver

I got a new receiver for Christmas, and it rocks! I got a Sony STR-DH800. I had to pull out my 14 year old Technics SB-CR55 floor speakers πŸ™‚

Sony STR-DH800 (image from sonystyle.com)
Technics SB-CR55 (not my actual picture)

sm-photo-tool release – 1.20

Version 1.20 of sm-photo-tool is ready to go. You can download it from github: http://github.com/jmrodri/sm-photo-tool/downloads.

The following are new configuration options:

  • square thumbs
  • hide owner
  • world searchable
  • smug searchable
  • sort method
  • max size option added to create

Bugs fixed:

  • If filename ends with +, append instead of overwriting log file
  • prompt for password if not in config file
  • invalid login no longer throws a stack trace

Thanks got Lloyd Cha for contributing the fixes for this release.

prompting for password

can I have a do over?

The next webapp I write, I think I’m going with some of the new hotness: NoSQL datastore, RESTful API, and Ruby. On a recent project I chose to use a RESTful API which I really like, but it definitely changes how you think of things coming from the XML-RPC way of doing APIs, but I still like its simplicity.

Unfortunately, I went with Java as the implementation instead of something like python or Ruby, and looking back I don’t know why I did that. I should know by now that python and Ruby are much easier to work with than Java has proven to. Hell even the build environment is a pain: ant – write xml build file from scratch, maven – reminds me of make with lot’s of pom.xml files, or buildr – ruby based maven replacement, annoys all Java people. If I had a do over on this I’d choose Ruby as the implementation language.

Since we’re using Java and needed a database we went with Hibernate. If I had to redo this decision, I most certainly would’ve gone with a NoSQL datastore like MongoDB or CouchDB, this way I could avoid the annoying mapping of domain model to relational tables which is highly annoying.

So if you’re planning a new webapp avoid the boring, traditional webapp design of using a relational database with ORM and compiled languages πŸ™‚

Spacewalk 0.7 RELEASED

Sorry for being so late, but I’m happy to see that Spacewalk 0.7 was released on December 4th, 2009.

Here are some of the features in this release:

  • new script “spacewalk-report” allows you to create reports with output to CSV fileΒ ScriptBasedReporting
  • pages with erratas have column with links to CVE description, erratas can be filtered by its type
  • Spacewalk can be installed on Fedora 12
  • Top level package spacewalk do not exists any more. It has been split into spacewalk-oracle and spacewalk-postgresql, which depends on oracle or postgresql library. Note: postgresql version is highly experimental.
  • Spacewalk now tracks date and time of package installation
  • Config channels now can handle symlinks
  • Support for WebUI based KVM guest management & provisioning
  • Spacewalk repositories have been split to server and client parts
  • Base client packages are now in Fedora. That means you are now able to register Fedora machine to Spacewalk, without setting up additional repository
  • and much more

Congrats to the Spacewalk team for another great release!

“synergize” with cobbler

I mentioned several days ago that my “Integrating with Cobbler” talk didn’t make the cut at FUDCon Toronto 2009.

Before you can integrate with Cobbler, you need to know a little about its objects and API. Then I can talk about some of the possible integration methods.

Cobbler has the following object types:

  • distro
    • represents the distribution (at a minimum the kernel and initrd locations)
  • profile
    • represents the kickstart description of what you want a machine to look like
  • system
    • represents the actual system
  • repo
    • package repository for mirroring (optional)
  • image
    • virtual guest image

The API that Cobbler exposes is actually very simple. Most of the objects have a set of operations find, get, remove, copy, etc. The convention used by Cobbler’s api is OPERATION_OBJECTTYPE. For example, to get a distro you would call get_distro(). To find a profile simply call find_profile(). Below is a list of the common api methods exposed by Cobbler. The {object*} represents the object type single or plural.

  • get_{object*(s)}
    • returns the object with the given type and id
  • find_{object*}
    • returns the object with the given criteria
  • get_{object*}_handle
    • returns a reference to be used by modify_* and save_*
  • remove_{object*}
    • removes the object with the given id
  • copy_{object*}
    • copies the object with the given id to the new name
  • rename_{object*}
    • renames the object to the new name
  • new_{object*}
    • creates a new object
  • modify_{object*}
    • changes the value of one of the object’s attributes
  • save_{object*}
    • commit all of the object’s changes

As you can see the API is quite simple and pretty straight forward. I’ve seen many APIs, and Cobbler has one of the cleanest ones I’ve seen in quite a long time.

You like the API as well but don’t use python? We you might consider one of Cobbler’s language bindings:

  • cobbler4j – a Java binding that tries to give you POJOs to work with
  • rubygem-cobbler – a Ruby binding
  • XML-RPC – most languages have an XML-RPC library

Cobbler4j was born from the integration of Spacewalk with Cobbler, primarily because working with XML-RPC from Java SUCKS! Also, most Java guys want to deal with objects, so it was only natural to create a binding for those developers.

Cobbler4j is autogenerated from the Cobbler python code which helps keep it up to date, and avoids the problem of ‘oops I updated the python code but forgot to change cobbler4j’. But what does it look like in practice? Ok, here’s an example of cobbler4j in action:

import java.util.*;
import org.fedorahosted.cobbler.*;
import org.fedorahosted.cobbler.autogen.*;

// REQUIRES: cobbler 2.0
public class Cobbler4jExample {
  public static void main(String[] args) {

    // gets connection and login at the same time
    CobblerConnection conn = new CobblerConnection(
      "http://localhost", "testing", "testing");

    Finder finder = Finder.getInstance();

    // see if there are any distros there already
    List distros = (List) finder.listItems(conn, ObjectType.DISTRO);
    System.out.println("there are " + distros.size() + " distros");

    // create a new distro, name, kernel and initrd are required
    Distro distro = new Distro(conn);
    distro.setName("cobbler-integration-java");
    distro.setKernel("/tmp/cobbler.fake");
    distro.setInitrd("/tmp/cobbler.fake");

    // in order to persist an object, we must call commit method
    distro.commit();

    // see our new distro
    distros = (List) finder.listItems(conn, ObjectType.DISTRO);
    System.out.println("there are now " + distros.size() + " distros");
    for (Distro d : distros) {
        System.out.println(d.toString());
    }

    // cleanup
    distro.remove();
  }
}

That’s cool and all, but I already know how to call APIs exposed by services. But what are some of the strategies for putting Cobbler into my application? I’m glad you asked (if not, you really should be thinking this) πŸ™‚

There are basically 3 ways of setting up Cobbler for your application.

  • Standalone
  • Master
  • Slave

Standalone is just that, you simply run Cobbler as a Service (CaaS) and use it to manage your DHCP, PXE infrastructure and deploying your systems. No other integration besides maybe a few scripts to fit into your processes. This is one of the popular use cases.

Next, we have the Master setup. This means you might have an in house integration GUI or other application but you let Cobbler be the canonical location for the provisioning data. Your application simply passes through to Cobbler’s APIs. The Genome project uses Cobbler in this way.

Lastly, there’s what I call the Slave mode. This setup is when you have an application that does a lot more than what Cobbler was meant to do and have more data than Cobbler is meant to handle. Your application will be the canonical source of the data, and will sync it to Cobbler on a periodic basis. Spacewalk is an example of using the Slave method of integration.

So which is the best way of integrating with Cobbler? Honestly it completely depends on your situation and needs. All of the above strategies are correct. So figure out what your application does best and whether you want to have to do synchronization of data or if you need your own application at all.

Happy integrating! If you want to see my presentation on this topic checkout my Fedora people page: http://jmrodri.fedorapeople.org/cobbler-integration.pdf (PDF)