stephane.dobbelaere wrote:
hello
I use func in a script to upload a zip file (100 Mo) and unzip it
with this
[...]
def uploadFile(minion,srcfile,dstfile):
client = fc.Client(minion)
fb = file(srcfile,"r").read()
data = xmlrpclib.Binary(fb)
upload = client.copyfile.copyfile(dstfile,data,0755)
t = upload[minion]
if t == 0:
upload = ">" + msg['exist']
if t == 1:
upload = ">" + msg['success']
if t == -1:
upload = ">" + msg['error']
sys.exit()
return upload
#this not work because file are too strong
#so with wget
def wgetFile(minion,file):
client = fc.Client(minion)
cmd = "wget " + url + file + " -P /tmp/"
up = client.command.run(cmd)
t = up[minion][0]
if t == 0:
service = ">" + msg['success']
if t == 1:
err=" : " + up[minion][2]
service = ">" + msg['error'] + err
def unzip(minion,file,folder):
efr = existFile(minion,file)
if efr == True:
client = fc.Client(minion)
cmd = "unzip " + file + " -d " + folder
extr = client.command.run(cmd)
t = extr[minion][0]
if t == 0:
r = ">" + msg['success']
if t == 1:
err = " : " +chdir[minion][2]
r = ">" + msg['error'] + err
return r
else:
r = "no file to backup"
return r
[...]
the result is the file is upload but :
[root@eppjsx01 ~]# ps aux |grep Z
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 11858 10.3 0.0 0 0 ? Z 13:02 0:22 [funcd]
<defunct>
root 11864 0.0 0.0 4128 708 pts/1 S+ 13:05 0:00 grep Z
je teste sur un autre serveur et paf le chien
[root@eppjsx50 ~]# ps aux |grep Z
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 9382 0.0 0.0 0 0 ? Z 06:24 0:00 [funcd]
<defunct>
root 9441 0.0 0.1 4776 708 pts/2 S+ 06:26 0:00 grep Z
and if I wait
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 11722 0.7 0.0 0 0 ? Z 12:50 0:20 [funcd]
<defunct>
root 11723 0.7 0.0 0 0 ? Z 12:51 0:20 [funcd]
<defunct>
root 11858 1.0 0.0 0 0 ? Z 13:02 0:22 [funcd]
<defunct>
root 11877 0.0 0.0 4600 708 pts/1 S+ 13:37 0:00 grep Z
and nothing in log func
Thanks
Stéphane
------------------------------------------------------------------------
_______________________________________________
Func-list mailing list
Func-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/func-list
You're going to need the overlord module for copyfile rather than using
a bulk copy in one operation. Overlord modules are wrappers around func
calls, potentially calls to multiple modules or more than one module at
a time.
Here's the source for this one:
https://fedorahosted.org/func/browser/func/overlord/modules/copyfile.py
You can call it like this:
client.local.copyfile.send(filename,remotepath)
It looks like the documentation is due for an update to show how to call
it programmatically:
https://fedorahosted.org/func/wiki/CopyFileModule
So I'll update it, thanks for the heads up!
--Michael
_______________________________________________
Func-list mailing list
Func-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/func-list