On 2014-13-06 18:36, cheniour ghassen wrote:
Hi everyone,
I have developed a puppet script for automating openstack configurations.
Now i have to make UML diagrams to model my puppet script. I need to
make a class diagram. But i didn't figure how because i have modules and
not packages, i have defines and not functions...
So my question is what is the suitable way to modeling puppet script?
If we can use An UML class diagram, how is that possible and is there
an example?
Thanks.
Depends on what you want a model of. There are basically two things of
interest - the manifests (the instructions), and the resulting catalog
(for a given node).
Short answer:
You can get some diagrams, but not UML without coding,
if you want actual UML output you need to write code in Java or Ruby,
and when doing so requires a fair bit of Puppet knowledge and at least
intermediate modeling knowledge (EMF, Ecore, UML, XMI, etc.)
Longer answer:
Without coding, you can get a diagram of the source and its dependencies
- there is a sample service called "wham" that you can try out at
wham.cloudsmith.com - here is a sample output for the puppetlabs/apache
module http://wham.cloudsmith.com/#puppetlabs/apache (you can download
the result as an .svg vector image).
That diagrams shows dependencies between modules, and what is being
used. It can also render a complete configuration.
Catalogs can be obtained in JSON format, and can be transformed to a
graph. Puppet has a rudimentary dot renderer that gives you the content
in graphviz dot format which can then be rendered. If you want some
other graphical representation you have to write code.
If you want the catalog in UML, there are a number of things you need to do.
- define a mapping to UML (how to represent puppet hostclass, resource,
puppet modules, etc).
- transform the catalog (in Json) to the UML model
- serialize it as XMI
- open the model with a UML diagramming tool - do the layout/formatting
There is an Ecore model of the Catalog in the Geppetto Project (IIRC),
and I also believe it contains the ability to deserialize a catalog in
Json to this model. The next step would be to transform that model to an
ecore reprsentation and serialize as XMI.
All of the Geppetto code is written in Java. If you consider doing this
you can get some help on the Geppetto google group.
There is currently no corresponding Catalog model in Ruby.
For source, the future parser in Puppet is built using modeling
techology, and you can obtain an ecore model per source file (that you
can transform into something else, serialize etc.) To do this you need
to write code in Ruby.
Having a standard UML representation of Puppet logic would be a cool
thing to have, but I don't see that happening in the standard Puppet
code base for quite some time.
Regards
- henrik
Visit my Blog "Puppet on the Edge"
http://puppet-on-the-edge.blogspot.se/
--
You received this message because you are subscribed to the Google Groups "Puppet
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/lnfsnh%246nh%241%40ger.gmane.org.
For more options, visit https://groups.google.com/d/optout.