Topology and Orchestration Specification for Cloud Applications (TOSCA) and Juju
Thomas Leonard
tal at it-innovation.soton.ac.uk
Fri Aug 24 08:29:15 UTC 2012
On 2012-08-23 23:51, Clint Byrum wrote:
> Excerpts from Johannes Wettinger's message of 2012-08-23 13:44:04 -0700:
[...]
>> a hook inside a charm is a binary, i.e. a shell script, a python file
>> or anything else which can be executed. As a result, a hook of a
>> particular charm cannot be a platform-independent artifact (e.g., a
>> binary that runs on both Windows and Linux). The consequence is that
>> we cannot have any conditional logic based on platform inside a hook,
>> can we?
>>
>
> Any unix platform can take advantage of the "shebang" on script executables.
> Those executables can definitely do
>
> if $platform == 'Ubuntu':
> ...
> elif $platform == 'NetBSD':
> ...
>
> From there the scripts can download and execute binaries for the necessary
> platform, in exactly the same way the current scripts download a .deb for
> amd64 or i386 based on the local architecture.
>
> Windows could be handled in a number of ways, including a compat layer to
> do the shebang running/translation on the fly.
One thing I'm hoping to look at soonish is using 0install (which is named
"zeroinstall-injector" in the Ubuntu repository) to handle charm
dependencies (including the interpreter) in a cross platform way. With that,
a charm could say e.g.
<command name="juju-run-hook" path="hooks/hook.py">
<runner interface="http://repo.roscidus.com/python/python">
<version not-before='2.6' before='3'/>
</runner>
</command>
That would find (or install) a Python 2.6 or 2.7 interpreter on any platform
and use it to run the hook. e.g.
- On Ubuntu, it would run /usr/bin/python
- On Arch, it would run /usr/bin/python2
- On Windows, it would download Python 2 somewhere and use that
I'm not sure how to handle all the separate hooks yet. I see some charms
dispatch everything to a central handler script anyway, which would be
easiest. Adding an XML <command> for each one seems like overkill, but
another option would be to pass just path='hooks' and have Juju specify the
hook name using the --main option.
I also need to think about how to fit this in with the YAML format. I've
used 0install's XML format above. I'm not sure yet whether they'd be
separate, or one would be generated from the other or something.
--
Dr Thomas Leonard
IT Innovation Centre
Gamma House, Enterprise Road,
Southampton SO16 7NS, UK
tel: +44 23 8059 8866
mailto:tal at it-innovation.soton.ac.uk
http://www.it-innovation.soton.ac.uk/
More information about the Juju
mailing list