What would you like to see in the virtual Charm School hangouts?

Peter M. Petrakis peter.petrakis at canonical.com
Fri May 24 18:37:44 UTC 2013



On 05/24/2013 11:25 AM, franck.dehay at orange.com wrote:
> Hi Mark,
>
> Thanks for the reply, really nice to see top management involved in
> Juju J
>
> We tried some basic charm writing and followed your advice to use
> ruby but ruby is not in the precise distribution!
>
> So, am supposed to write the following install hook? :
>
> Install
>
> sudo apt-get update && sudo apt-get install ruby-1.9.1-full
>
> ruby install.rb
>
> install.rb
>
> # whatever ruby code

Just create a shell script that installs the deps and then runs
the additional script.

cat > install << EOF
#!/bin/bash

apt-get update && apt-get install -y ruby-1.9.1-full
ruby hooks/install.rb
EOF

All hooks are executed from the charm's root.

A common idiom is to create a single dispatch file and
use symlinks as verbs. Keeps all the code in one place.

Example.
https://bazaar.launchpad.net/~charmers/charms/precise/opengrok/trunk/view/head:/hooks/opengrok_common

where python is used in config-changed.
...
   config-changed)
     hooks/py-config-changed
     ;;

I apologize if I appear to be hawking my charm, however... opengrok is
pretty useful :)

Regards,
Peter

BTW, you don't need sudo, you're root when a charm hook is executing.

>
> ….
>
> This does not look very nice. Install here is installing the required
> tool for the installation.
>
> Couldn’t we get a “pre-install” hook somewhere?
>
> People writing python charms use jinja2 normally as well and imagine
> all kinds of pre-hook mechanisms that are rather ugly…
>
> It should be possible to execute the pre-install hook if it is there
> thus not breaking existing charms.
>
> Just my 2 cents
>
> Best Regards
>
> *Franck Dehay*
>
> *De :*Mark Shuttleworth [mailto:mark at ubuntu.com] *Envoyé :* mercredi
> 22 mai 2013 16:28 *À :* DEHAY Franck DMGP/PORTAIL *Cc :*
> juju at lists.ubuntu.com *Objet :* Re: What would you like to see in the
> virtual Charm School hangouts?
>
> On 05/22/2013 02:49 PM, franck.dehay at orange.com
> <mailto:franck.dehay at orange.com> wrote:
>
> Browsing through the charm store, I see lots of diversity, which is
> normal as juju requires only executable files as hooks.
>
> Some implement all in one python program with symlinks (quite cute I
> would say), most do the install with bash…
>
> If you guys had some proposal for best suited method it would be
> nice.
>
>
> General guidance is that if you are serious about the charm, treat it
> like code, use version control and if possible test suites, and pick
> a high-level language you are comfortable in.
>
> Most charms start out as a quick-and-dirty proof of concept in Bash,
> then the serious ones switch to something more suited to flow
> control, architecture and testing.
>
>
> I remember having read in the archives that python would be the
> recommended language.
>
> Is it still the vision?
>
>
> I would expect to see the Rails charm in Ruby, and the Node charm in
> Node.js :) We'll generally try to implement utilities as things which
> can be used from any language, but yes, many / most of the
> industrial-grade charms will use Python, given its status as a
> popular glue language.
>
> Mark
>
> _________________________________________________________________________________________________________________________
>
>  Ce message et ses pieces jointes peuvent contenir des informations
> confidentielles ou privilegiees et ne doivent donc pas etre diffuses,
> exploites ou copies sans autorisation. Si vous avez recu ce message
> par erreur, veuillez le signaler a l'expediteur et le detruire ainsi
> que les pieces jointes. Les messages electroniques etant susceptibles
> d'alteration, France Telecom - Orange decline toute responsabilite si
> ce message a ete altere, deforme ou falsifie. Merci.
>
> This message and its attachments may contain confidential or
> privileged information that may be protected by law; they should not
> be distributed, used or copied without authorisation. If you have
> received this email in error, please notify the sender and delete
> this message and its attachments. As emails may be altered, France
> Telecom - Orange is not liable for messages that have been modified,
> changed or falsified. Thank you.
>
>
>



More information about the Juju mailing list