Heat custom resource plugin

asked 2015-02-09 04:10:14 -0500

upendra.moturi gravatar image

updated 2015-02-09 08:40:34 -0500

larsks gravatar image

Hi Team, I am trying to write a custom resource for heat.The plugin's purpose its to copy scripts to remote machine using ssh. handle_create method is not waiting for copy to finish using paramiko (its not even triggering os.system or subprocess.call ) The same piece of code works fine outside heat plugin.

import subprocess
pipe=subprocess.Popen(["/usr/bin/scp","-i","/opt/scripts/key_heat.pem","/opt/scripts/cloudadmin.tar.gz" ,"centos@"],stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT).wait()

Please help me

Thanks Upendra

edit retag flag offensive close merge delete


It might help if you could give us a pointer to your actual code. It's probably too long to post here, but if you can stick it on github or something and post a link that would be great.

larsks gravatar imagelarsks ( 2015-02-09 08:41:54 -0500 )edit

Alternatively, rather than copying files in, you could just provide your instances with a user-data script that would fetch the necessary files using, e.g., curl.

larsks gravatar imagelarsks ( 2015-02-09 08:42:18 -0500 )edit

The Popen.wait docs https://docs.python.org/2/library/sub... , suggest "this will deadlock if the child process generates enough output to a stdout or stderr pipe such that it blocks waiting for the OS pipe buffer to accept more data". Use Popen.communicate instead.

unmesh-gurjar gravatar imageunmesh-gurjar ( 2015-02-09 11:03:02 -0500 )edit

I would also suggest you implement the check_create_complete( ) method for the resource!

unmesh-gurjar gravatar imageunmesh-gurjar ( 2015-02-09 11:04:26 -0500 )edit