Actually, the current 'deploy_node' method with ScriptDeployment object as
a parameter, it stores the results in its *stdout, stderr* and
*exit_status* attributes
(
https://github.com/apache/libcloud/blob/trunk/libcloud/compute/deployment.py#L151)
and
you can take decisions after execute it.
A improved example of my previous mail (where I forgot to mention the
ScriptDeployment object) would be:
sd = ScriptDeployment('apt-get install --only-upgrade libssl')
for node in connection.list_nodes():
node.execute(sd)
print(sd.stdout)
print(sd.stderr)
if sd.exit_status != expected_result:
foo()
On 30 January 2013 14:41, Matt Hogstrom <[email protected]> wrote:
> The feature would be a big help for a farm with lots of virtual machines.
> In my experience, the commands execute most of the time but when something
> goes wrong you need to know what happened where. In addition to executing
> the command, capturing and archiving the console output from the commands
> would be needed. You'd also like to probably run a script before actually
> executing the update to make sure that there are no known conflicts (other
> processes with a lock on a required file, etc.)
>
> Matt Hogstrom
> [email protected]
> +1 (919) 656-0564
> PGP Key: 0F143BC1
>
> "Men occasionally stumble over the truth, but most of them pick themselves
> up and hurry off as it nothing had happened." -Winston Churchill
>
>
>
>
> On Jan 30, 2013, at 2:59 AM, Jaume Devesa <[email protected]> wrote:
>
> > Hi all,
> >
> > I send this email cause I would like to discuss a feature request with
> all
> > of you.
> >
> > Current Node's method 'deploy_node' is a powerful feature. I love to have
> > the ability to create a new node and execute some initial scripts there
> > like a simple approach of automating tools such as Chef or Puppet,
> offered
> > as a core libcloud functionality.
> >
> > However, I think it is a pity to only have the ability to send remote
> > commands to my Virtual Machines in creation time. Imagine I have 50
> > machines in my production environment and a new ssl security flaw has
> been
> > discovered. So I have to update all my systems to new *libssl* version.
> It
> > would be great to do something more or less like this:
> >
> > sd = 'apt-get install --only-upgrade libssl'
> > for node in connection.list_nodes():
> > node.execute(sd)
> >
> > Watching the 'deploy_node' code, I think it would be plausible to offer
> > this 'execute' feature as a core functionality of the Node class. Maybe
> it
> > is as easy as move the logic of 'deploy_node' to the new 'execute'
> function
> > (I am sure it is not that simple, but it seems to me that it wouldn't be
> > hard). This way, the deploy_node would be == create_node + execute.
> >
> > What do you think?
> >
> > Regards.
> >
> > PD: don't trust in my when I have to name methods/classes! The 'execute'
> > name is just the first name that came to my head.
>
>