我正在尝试自动化部署过程,该过程将资源复制到目标文件夹并自动运行我已创建此结构文件的脚本。是否可以从Eclipse IDE运行它还是还有其他出路吗?请帮我完成这些步骤。同时验证我的fab文件,因为我是fabric和python的新手。
from fabric.api import *
import datetime
currentDate = datetime.datetime.now().strftime("%Y%m%d-%H%M%S")
backupDir = "/tmp/kanwal_tmp/Backup_Dev-" + currentDate
env.use_ssh_config = True
env.hosts = ["Pfsv1d.nsroot.net"]
env.user = "ks073"
env.port = 22
def test():
run("ls -al")
def DevDeploy():
backupToBackupDir()
copyToStagingFolder()
deploymentInProgress()
print("Deployment " + currentDate + " complete")
#-------------------
# Utility functions
#-------------------
def backupToBackupDir():
local("cp /opt/gpf/cps/CPSCacheServer/lib/CPSCacheServer-1.0_A14-jar-with-dependencies.jar backupDir")
local("cp /opt/gpf/cps/CPSCacheServer/lib/CPSCacheServer-1.0_A14.jar backupDir")
local("cp /opt/CPS/CPSWebServer/webapps/CPSWebService.war backupDir")
def copyToStagingFolder():
local("cp /tmp/deploy_tmp/CPSCacheServer/* /opt/gpf/cps/install/CPSCacheServer/lib")
local("cp /tmp/deploy_tmp/CPSCacheWebService/* /opt/CPSWebService/")
def deploymentInProgress():
cd("/opt/pfApps/scripts/")
run("./installCPSCacheServer.ksh")
cd("/opt/gpf/cps/CPSCacheServer/bin/")
run("./run_app.sh")
cd("/opt/CPS/CPSWebServer/bin/" )
run("./undeploy_CPSWebService_Node1.sh")
run("./deploy_CPSWebService_Node1.sh")