mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-184: add createFileInDomr plugin
This commit is contained in:
parent
a3c80ebf4e
commit
acaa22003d
@ -360,6 +360,26 @@ def createFile(session, args):
|
||||
|
||||
return txt
|
||||
|
||||
@echo
|
||||
def createFileInDomr(session, args):
|
||||
file_path = args['filepath']
|
||||
file_contents = args['filecontents']
|
||||
domrip = args['domrip']
|
||||
try:
|
||||
tmpfile = util.pread2(['mktemp']).strip()
|
||||
f = open(tmpfile, "w")
|
||||
f.write(file_contents)
|
||||
f.close()
|
||||
target = "root@" + domrip + ":" + file_path
|
||||
util.pread2(['scp','-P','3922','-q','-o','StrictHostKeyChecking=no','-i','/root/.ssh/id_rsa.cloud',tmpfile, target])
|
||||
util.pread2(['rm',tmpfile])
|
||||
txt = 'success'
|
||||
except:
|
||||
util.SMlog(" failed to create HA proxy cfg file ")
|
||||
txt = ''
|
||||
|
||||
return txt
|
||||
|
||||
@echo
|
||||
def deleteFile(session, args):
|
||||
file_path = args["filepath"]
|
||||
@ -1452,4 +1472,5 @@ if __name__ == "__main__":
|
||||
"setLinkLocalIP":setLinkLocalIP,
|
||||
"cleanup_rules":cleanup_rules,
|
||||
"bumpUpPriority":bumpUpPriority,
|
||||
"createFileInDomr":createFileInDomr,
|
||||
"kill_copy_process":kill_copy_process})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user