def delete_vm(options):
 cmd = 'salt-cloud -d {0} -y'.format(options.delete_vm)
 print('Running CMD: {0}'.format(cmd))
 sys.stdout.flush()
 proc = NonBlockingPopen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stream_stds=True)
 proc.poll_and_read_until_finish(interval=0.5)
 proc.communicate()

def delete_vm ( options ) : cmd = 'salt-cloud -d {0} -y' . format ( options . delete_vm ) print ( 'Running CMD: {0}' . format ( cmd ) ) sys . stdout . flush ( ) proc = NonBlockingPopen ( cmd , shell = True , stdout = subprocess . PIPE , stderr = subprocess . PIPE , stream_stds = True ) proc . poll_and_read_until_finish ( interval = 0.5 ) proc . communicate ( )
stop a vm .