Categories
Uncategorized

Ubuntu and Juju with local providers

Want to play with Ubuntu’s awesome Juju but don’t want to get into the hassle of getting EC2 configured?

https://juju.ubuntu.com/

It’s actually pretty easy to set up a local provider to experiment with this.

You need to be running Ubuntu 12.04 (yes, it’s not released yet but you can use the beta version or daily  images). Oh, and you can install this on a virtual machine if you really don’t want Juju to mess with your actual system.

Make sure to have a valid SSH key, if you don’t have one, create it with

ssh-keygen

Then

apt-get install juju llibvirt-bin lxc apt-cacher-ng zookeeper

Once the packages are installed, run

newgrp libvirtd

this adds you to the libvirtd group at runtime.

Then run juju bootstrap. Juju will complain about a config file or something. Ignore it! and then edit .juju/environments.yaml and replace everything on that file with this:

environments:
  local:
    type: local
    data-dir: /tmp/local-dev
    admin-secret: b3a5dee4fb8c4fc9a4db04751e5936f4
    default-series: oneiric

The admin-secret is a MD5 random key, you should probably generate your own with something like this:

head -c 10 /dev/urandom |md5sum

Then finally it’s time to bootstrap things:

juju bootstrap

This will exit pretty quickly, but things are not ready yet. Note that it will take a few minutes to get packages and actually prepare the nodes.

Once your juju is bootstrapped you can follow the rest of the steps here:

https://juju.ubuntu.com/docs/user-tutorial.html#bootstrapping

Categories
Uncategorized

Find and -exec and why doesn’t basename work in there?

Ever wonder why this doesn’t work to rename all your isos to .nrg?

find ./ -iname *iso -exec rename {} `basename {} .iso`.nrg \;

The thing is, the backticks are a bash construct, and whatever you specify to -exec does *not* get shell-expanded. So it’s being passed verbatim, with the only substitution being the {} for the found filenames.

But this works! (though quoting may pose some challenges). This works because it *is* being processed through bash, so all the normal expansion and shell tricks will work.

find ./ -iname *iso -exec bash -c "rename {} `basename {} .iso`.nrg"  \;