juju 0.5.9

A library to interact with the Juju system. For an example charm see: https://github.com/cholcombe973/gluster-charm

A library to interface with Juju. For more information about Juju see Juju

A hello world Juju charm example in Rust: You will need a working Juju environment for this to function properly. See [Setting up Juju] (https://jujucharms.com/docs/stable/getting-started). After Juju is functioning see What makes a Charm for the base components of a charm.

Our src/main.rs will contain the following:


extern crate juju;
extern crate log;
use std::env;
use log::LogLevel;

fn config_changed()->Result<(), String>{
    juju::log("Hello Juju from Rust!", Some(LogLevel::Debug));
    return Ok(());

fn main(){
    let mut hook_registry: Vec<juju::Hook> = vec![
        hook!("config-changed", config_changed)
    let result =  juju::process_hooks(hook_registry);

    if result.is_err(){
        juju::log(&format!("Hook failed with error: {:?}", result.err()),
        juju::log("Hook call was successful!", Some(LogLevel::Debug));

Now you can build with cargo build and install the binary in the hooks directory.

Create a symlink in the hooks directory with ln -s hello-world config-changed. Juju will attempt to run that symlink and our Juju library will map that to our config_changed function.

We can test our hello-world charm by deploying with juju and watching the debug logs. See Deploying a Charm for more information.

You should see a message in juju debug-log like this unit-hello-world-0[6229]: 2015-08-21 16:16:05 INFO unit.hello-world/0.juju-log server.go:254 Hello Juju from Rust!