Friday, March 27, 2015

Clash of Titans, Ansible vs Puppet vs Salt

I have read this excellent article

with part 2

I have been dreaming of writing the same article for a long time....

2 statements caught my attention

"“I would say that if you don’t have a Puppet champion (someone that knows it well and is pushing to have it running) it is probably not worth for this.""

" I tend to agree with Lyft’s conclusion that if you have a centralized Ops team in change of deployments then they can own a Puppet codebase. On the other hand if you want more wide-spread ownership of your configuration management scripts, a tool with a shallower learning curve like Ansible is a better choice."

I haven't used Ansible, but such is my experience with Puppet: you need a technical guru (or max 2) dictating standards and finding solutions to common problems and bridging communication among departments and teams.... you can't just "leave it to the masses" and hoping everybody will be a champion... also, who wants Ruby? All my stuff is in Python !!!

And here goes a very interesting comparison Ansible vs Salt...

Thursday, March 26, 2015

Learning Python

I have been using Python for many years, mainly associated with WLST.

As most WLST programmers, I know only the BASIC of the language.... I don't go beyond some essential OO use (yes, I like OO and I hate unstructured procedural programming).

So now I have decided to go through some training and serious (hahaha) study.

This Learn Python interactive tutorial site is just great to get started.

You can read the 4th edition of the great (>1000 pages) Mark Lutz "Learning Python" book for free here - it's definitely very authoritative, and covers both Python 2 and 3.

Oh jah cool, "import this" works also in WLST.... nice...

Wednesday, March 25, 2015

WLST / Python: execfile versus import

I have lately come across to some usage of "execfile".

I had immediately the impression "this stinks, why don't they use import instead?"
I also read here that execfile is stinky-stinky.

Let's see if they are actually equivalent.
def hello():
  print 'helloooo!'

To use the method I run the and type:

ok cool, so execfile has the effect of "inlining" your code. This is very 1960-programming style. All is just a big ball of mud.

If instead of execfile I use import:
import toimport

NameError: hello


the apparent advantage is that the method is QUALIFIED by its module. Disadvantage is that you must type the extra module name.

The "better" way (IMHO) is to explicitly import the method:
from toimport import hello


Needless to say, one should strive for true OO programming, so that the method hello() is defined for a specific class of objects... so please steer away from this "static method compulsive programming syndrome (SMCPS)".

PS execfile is deprecated in Python 3... so just get used to NOT using it...