自己寫的fabric指令碼

czxin788發表於2018-04-23

功能:使用fabric自動化發版


點選(此處)摺疊或開啟

  1. #-*-coding:utf8-*-
  2. from fabric.api import *
  3. import subprocess
  4. import os
  5. import sys
  6. import glob
  7. import shutil

  8. env.roledefs = {
  9.         'cz-oms-core':['czoms@10.2.88.47','czoms@10.2.88.48'],
  10.         'cz-oms-core-new':['czoms@10.2.88.37','czoms@10.2.88.46'],
  11.         'cz-oms-core-new1':['czoms@10.2.88.40','czoms@10.2.88.41'],
  12.         'cz':['appuser@10.2.88.30']
  13.     }



  14. env.passwords = {
  15.         'czoms@10.2.88.47:22':'fdfdfsdf',
  16.         'czoms@10.2.88.48:22':'fdfdfsdf',
  17.         'czoms@10.2.88.37:22':'fdfdfsdf',
  18.         'czoms@10.2.88.46:22':'fdfdfsdf',
  19.         'czoms@10.2.88.40:22':'fdfdfsdf',
  20.         'czoms@10.2.88.41:22':'fdfdfsdf',
  21.         'appuser@10.2.88.30:22':'appuser@0630',
  22.     }


  23. #通用函式
  24. def unzip():
  25.     with lcd('patch'):
  26.         local('winrar x *.zip')

  27. #Update SVN
  28. def UpdateSVN(path):
  29.     p = subprocess.Popen(['svn','update',path],shell=True,stdout=subprocess.PIPE)
  30.     print p.stdout.readlines()


  31.     
  32. #根據filelist生成發版目錄
  33. def faban_dir():
  34.     count = 0
  35.     with open('filelist.txt','r') as f:
  36.         for line in f:
  37.             if line.startswith('bj-oms-api'):
  38.                 #filelist檔案路徑預處理
  39.                 classpath_filename = line.replace('bj-oms-api/src/main/java/','../online_svn/bj-oms/bj-oms-api/target/classes/')
  40.                 classpath_filename = classpath_filename.replace('.java','.class')
  41.                 classpath_filename = classpath_filename.replace('\n','') #去掉換行符
  42.                 #構造patch目錄結構
  43.                 patchpath_filename = line.replace('bj-oms-api/src/main/java/','')
  44.                 patchpath_filename = patchpath_filename.replace('.java','.class')
  45.                 patchpath_filename = patchpath_filename.replace('\n','')
  46.                 patchpath_filename = 'patch/' + 'bj-oms-api/' + patchpath_filename
  47.                 patchpath = os.path.dirname(patchpath_filename)
  48.                 #如果patch目錄不存在,就建立目錄
  49.                 try:
  50.                     os.listdir(patchpath)
  51.                 except WindowsError:
  52.                     os.makedirs(patchpath) #makedirs可以在windows 的patch目錄下遞迴建立資料夾
  53.                 #複製父類到patch目錄下
  54.                 parentclass_path_filename = classpath_filename
  55.                 patchpath_filename = patchpath_filename
  56.                 print "複製svn class檔案到patch目錄: %s ---> %s " % (parentclass_path_filename,patchpath_filename)
  57.                 shutil.copy(parentclass_path_filename,patchpath_filename)
  58.                 count += 1
  59.                 print "***********第%s個檔案複製成功***************" % count
  60.                 #用glob尋找子類
  61.                 path_filename = os.path.split(classpath_filename) #split:返回一個二元組,包含檔案的路徑與檔名
  62.                 filename_splitext = os.path.splitext(path_filename[1]) #去掉副檔名
  63.                 subclass_path_filenames = glob.glob('%s/%s$*' % (path_filename[0],filename_splitext[0]))
  64.                 #把子類複製到patch目錄下
  65.                 for subclass_path_filename in subclass_path_filenames:
  66.                     subclass_path_filename = subclass_path_filename.replace('\\',r'/')
  67.                     patchpath_filename = subclass_path_filename.replace('../online_svn/bj-oms/bj-oms-api/target/classes/','patch/bj-oms-api/')
  68.                     print "複製svn subclass檔案到patch目錄: %s ---> %s " % (subclass_path_filename,patchpath_filename)
  69.                     shutil.copy(subclass_path_filename,patchpath_filename)
  70.                     count += 1
  71.                     print "***********第%s個檔案複製成功,注意該檔案是子類哦^_^ *****************************************" % count

  72.             elif line.startswith('bj-oms-domain'):
  73.                 #filelist檔案路徑預處理
  74.                 classpath_filename = line.replace('bj-oms-domain/src/main/java/','../online_svn/bj-oms/bj-oms-domain/target/classes/')
  75.                 classpath_filename = classpath_filename.replace('.java','.class')
  76.                 classpath_filename = classpath_filename.replace('\n','') #去掉換行符
  77.                 #構造patch目錄結構
  78.                 patchpath_filename = line.replace('bj-oms-domain/src/main/java/','')
  79.                 patchpath_filename = patchpath_filename.replace('.java','.class')
  80.                 patchpath_filename = patchpath_filename.replace('\n','')
  81.                 patchpath_filename = 'patch/' + 'bj-oms-domain/' + patchpath_filename
  82.                 patchpath = os.path.dirname(patchpath_filename)
  83.                 #如果patch目錄不存在,就建立目錄
  84.                 try:
  85.                     os.listdir(patchpath)
  86.                 except WindowsError:
  87.                     os.makedirs(patchpath) #makedirs可以在windows 的patch目錄下遞迴建立資料夾
  88.                 #複製父類到patch目錄下
  89.                 parentclass_path_filename = classpath_filename
  90.                 patchpath_filename = patchpath_filename
  91.                 print "複製svn class檔案到patch目錄: %s ---> %s " % (parentclass_path_filename,patchpath_filename)
  92.                 shutil.copy(parentclass_path_filename,patchpath_filename)
  93.                 count += 1
  94.                 print "***********第%s個檔案複製成功***************" % count
  95.                 #用glob尋找子類
  96.                 path_filename = os.path.split(classpath_filename) #split:返回一個二元組,包含檔案的路徑與檔名
  97.                 filename_splitext = os.path.splitext(path_filename[1]) #去掉副檔名
  98.                 subclass_path_filenames = glob.glob('%s/%s$*' % (path_filename[0],filename_splitext[0]))
  99.                 #把子類複製到patch目錄下
  100.                 for subclass_path_filename in subclass_path_filenames:
  101.                     subclass_path_filename = subclass_path_filename.replace('\\',r'/')
  102.                     patchpath_filename = subclass_path_filename.replace('../online_svn/bj-oms/bj-oms-domain/target/classes/','patch/bj-oms-domain/')
  103.                     print "複製svn subclass檔案到patch目錄: %s ---> %s " % (subclass_path_filename,patchpath_filename)
  104.                     shutil.copy(subclass_path_filename,patchpath_filename)
  105.                     count += 1
  106.                     print "***********第%s個檔案複製成功,注意該檔案是子類哦^_^ *****************************************" % count

  107.             elif line.startswith('bj-oms-core-new1'): #位置1,不可調換,因為bj-oms-core包含bj-oms-core-new1
  108.                 #filelist檔案路徑預處理
  109.                 classpath_filename = line.replace('bj-oms-core-new1/src/main/java/','../online_svn/bj-oms/bj-oms-core-new1/target/classes/')
  110.                 classpath_filename = classpath_filename.replace('.java','.class')
  111.                 classpath_filename = classpath_filename.replace('\n','') #去掉換行符
  112.                 #構造patch目錄結構
  113.                 patchpath_filename = line.replace('bj-oms-core-new1/src/main/java/','')
  114.                 patchpath_filename = patchpath_filename.replace('.java','.class')
  115.                 patchpath_filename = patchpath_filename.replace('\n','')
  116.                 patchpath_filename = 'patch/' + 'bj-oms-core-new1/' + patchpath_filename
  117.                 patchpath = os.path.dirname(patchpath_filename)
  118.                 #如果patch目錄不存在,就建立目錄
  119.                 try:
  120.                     os.listdir(patchpath)
  121.                 except WindowsError:
  122.                     os.makedirs(patchpath) #makedirs可以在windows 的patch目錄下遞迴建立資料夾
  123.                 #複製父類到patch目錄下
  124.                 parentclass_path_filename = classpath_filename
  125.                 patchpath_filename = patchpath_filename
  126.                 print "複製svn class檔案到patch目錄: %s ---> %s " % (parentclass_path_filename,patchpath_filename)
  127.                 shutil.copy(parentclass_path_filename,patchpath_filename)
  128.                 count += 1
  129.                 print "***********第%s個檔案複製成功***************" % count
  130.                 #用glob尋找子類
  131.                 path_filename = os.path.split(classpath_filename) #split:返回一個二元組,包含檔案的路徑與檔名
  132.                 filename_splitext = os.path.splitext(path_filename[1]) #去掉副檔名
  133.                 subclass_path_filenames = glob.glob('%s/%s$*' % (path_filename[0],filename_splitext[0]))
  134.                 #把子類複製到patch目錄下
  135.                 for subclass_path_filename in subclass_path_filenames:
  136.                     subclass_path_filename = subclass_path_filename.replace('\\',r'/')
  137.                     patchpath_filename = subclass_path_filename.replace('../online_svn/bj-oms/bj-oms-core-new1/target/classes/','patch/bj-oms-core-new1/')
  138.                     print "複製svn subclass檔案到patch目錄: %s ---> %s " % (subclass_path_filename,patchpath_filename)
  139.                     shutil.copy(subclass_path_filename,patchpath_filename)
  140.                     count += 1
  141.                     print "***********第%s個檔案複製成功,注意該檔案是子類哦^_^ *****************************************" % count

  142.             elif line.startswith('bj-oms-core'): #位置2,不可調換,因為bj-oms-core包含bj-oms-core-new1
  143.                 #filelist檔案路徑預處理
  144.                 classpath_filename = line.replace('bj-oms-core/src/main/java/','../online_svn/bj-oms/bj-oms-core/target/classes/')
  145.                 classpath_filename = classpath_filename.replace('.java','.class')
  146.                 classpath_filename = classpath_filename.replace('\n','') #去掉換行符
  147.                 #構造patch目錄結構
  148.                 patchpath_filename = line.replace('bj-oms-core/src/main/java/','')
  149.                 patchpath_filename = patchpath_filename.replace('.java','.class')
  150.                 patchpath_filename = patchpath_filename.replace('\n','')
  151.                 patchpath_filename = 'patch/' + 'bj-oms-core/' + patchpath_filename
  152.                 patchpath = os.path.dirname(patchpath_filename)
  153.                 #如果patch目錄不存在,就建立目錄
  154.                 try:
  155.                     os.listdir(patchpath)
  156.                 except WindowsError:
  157.                     os.makedirs(patchpath) #makedirs可以在windows 的patch目錄下遞迴建立資料夾
  158.                 #複製父類到patch目錄下
  159.                 parentclass_path_filename = classpath_filename
  160.                 patchpath_filename = patchpath_filename
  161.                 print "複製svn class檔案到patch目錄: %s ---> %s " % (parentclass_path_filename,patchpath_filename)
  162.                 shutil.copy(parentclass_path_filename,patchpath_filename)
  163.                 count += 1
  164.                 print "***********第%s個檔案複製成功***************" % count
  165.                 #用glob尋找子類
  166.                 path_filename = os.path.split(classpath_filename) #split:返回一個二元組,包含檔案的路徑與檔名
  167.                 filename_splitext = os.path.splitext(path_filename[1]) #去掉副檔名
  168.                 subclass_path_filenames = glob.glob('%s/%s$*' % (path_filename[0],filename_splitext[0]))
  169.                 #把子類複製到patch目錄下
  170.                 for subclass_path_filename in subclass_path_filenames:
  171.                     subclass_path_filename = subclass_path_filename.replace('\\',r'/')
  172.                     patchpath_filename = subclass_path_filename.replace('../online_svn/bj-oms/bj-oms-core/target/classes/','patch/bj-oms-core/')
  173.                     print "複製svn subclass檔案到patch目錄: %s ---> %s " % (subclass_path_filename,patchpath_filename)
  174.                     shutil.copy(subclass_path_filename,patchpath_filename)
  175.                     count += 1
  176.                     print "***********第%s個檔案複製成功,注意該檔案是子類哦^_^ *****************************************" % count

  177.             elif line.startswith('bj-oms-rest'):
  178.                 #filelist檔案路徑預處理
  179.                 classpath_filename = line.replace('bj-oms-rest/src/main/java/','../online_svn/bj-oms/bj-oms-rest/target/classes/')
  180.                 classpath_filename = classpath_filename.replace('.java','.class')
  181.                 classpath_filename = classpath_filename.replace('\n','') #去掉換行符
  182.                 #構造patch目錄結構
  183.                 patchpath_filename = line.replace('bj-oms-rest/src/main/java/','')
  184.                 patchpath_filename = patchpath_filename.replace('.java','.class')
  185.                 patchpath_filename = patchpath_filename.replace('\n','')
  186.                 patchpath_filename = 'patch/' + 'bj-oms-rest/' + patchpath_filename
  187.                 patchpath = os.path.dirname(patchpath_filename)
  188.                 #如果patch目錄不存在,就建立目錄
  189.                 try:
  190.                     os.listdir(patchpath)
  191.                 except WindowsError:
  192.                     os.makedirs(patchpath) #makedirs可以在windows 的patch目錄下遞迴建立資料夾
  193.                 #複製父類到patch目錄下
  194.                 parentclass_path_filename = classpath_filename
  195.                 patchpath_filename = patchpath_filename
  196.                 print "複製svn class檔案到patch目錄: %s ---> %s " % (parentclass_path_filename,patchpath_filename)
  197.                 shutil.copy(parentclass_path_filename,patchpath_filename)
  198.                 count += 1
  199.                 print "***********第%s個檔案複製成功***************" % count
  200.                 #用glob尋找子類
  201.                 path_filename = os.path.split(classpath_filename) #split:返回一個二元組,包含檔案的路徑與檔名
  202.                 filename_splitext = os.path.splitext(path_filename[1]) #去掉副檔名
  203.                 subclass_path_filenames = glob.glob('%s/%s$*' % (path_filename[0],filename_splitext[0]))
  204.                 #把子類複製到patch目錄下
  205.                 for subclass_path_filename in subclass_path_filenames:
  206.                     subclass_path_filename = subclass_path_filename.replace('\\',r'/')
  207.                     patchpath_filename = subclass_path_filename.replace('../online_svn/bj-oms/bj-oms-rest/target/classes/','patch/bj-oms-rest/')
  208.                     print "複製svn subclass檔案到patch目錄: %s ---> %s " % (subclass_path_filename,patchpath_filename)
  209.                     shutil.copy(subclass_path_filename,patchpath_filename)
  210.                     count += 1
  211.                     print "***********第%s個檔案複製成功,注意該檔案是子類哦^_^ *****************************************" % count

  212.             elif line.startswith('bj-oms-jobs'):
  213.                 #filelist檔案路徑預處理
  214.                 classpath_filename = line.replace('bj-oms-jobs/src/main/java/','../online_svn/bj-oms/bj-oms-jobs/target/classes/')
  215.                 classpath_filename = classpath_filename.replace('.java','.class')
  216.                 classpath_filename = classpath_filename.replace('\n','') #去掉換行符
  217.                 #構造patch目錄結構
  218.                 patchpath_filename = line.replace('bj-oms-jobs/src/main/java/','')
  219.                 patchpath_filename = patchpath_filename.replace('.java','.class')
  220.                 patchpath_filename = patchpath_filename.replace('\n','')
  221.                 patchpath_filename = 'patch/' + 'bj-oms-jobs/' + patchpath_filename
  222.                 patchpath = os.path.dirname(patchpath_filename)
  223.                 #如果patch目錄不存在,就建立目錄
  224.                 try:
  225.                     os.listdir(patchpath)
  226.                 except WindowsError:
  227.                     os.makedirs(patchpath) #makedirs可以在windows 的patch目錄下遞迴建立資料夾
  228.                 #複製父類到patch目錄下
  229.                 parentclass_path_filename = classpath_filename
  230.                 patchpath_filename = patchpath_filename
  231.                 print "複製svn class檔案到patch目錄: %s ---> %s " % (parentclass_path_filename,patchpath_filename)
  232.                 shutil.copy(parentclass_path_filename,patchpath_filename)
  233.                 count += 1
  234.                 print "***********第%s個檔案複製成功***************" % count
  235.                 #用glob尋找子類
  236.                 path_filename = os.path.split(classpath_filename) #split:返回一個二元組,包含檔案的路徑與檔名
  237.                 filename_splitext = os.path.splitext(path_filename[1]) #去掉副檔名
  238.                 subclass_path_filenames = glob.glob('%s/%s$*' % (path_filename[0],filename_splitext[0]))
  239.                 #把子類複製到patch目錄下
  240.                 for subclass_path_filename in subclass_path_filenames:
  241.                     subclass_path_filename = subclass_path_filename.replace('\\',r'/')
  242.                     patchpath_filename = subclass_path_filename.replace('../online_svn/bj-oms/bj-oms-jobs/target/classes/','patch/bj-oms-jobs/')
  243.                     print "複製svn subclass檔案到patch目錄: %s ---> %s " % (subclass_path_filename,patchpath_filename)
  244.                     shutil.copy(subclass_path_filename,patchpath_filename)
  245.                     count += 1
  246.                     print "***********第%s個檔案複製成功,注意該檔案是子類哦^_^ *****************************************" % count

  247.             elif line.startswith('bj-tran'):
  248.                 #filelist檔案路徑預處理
  249.                 classpath_filename = line.replace('bj-tran/src/main/java/','../online_svn/bj-tran/target/classes/')
  250.                 classpath_filename = classpath_filename.replace('.java','.class')
  251.                 classpath_filename = classpath_filename.replace('\n','') #去掉換行符
  252.                 #構造patch目錄結構
  253.                 patchpath_filename = line.replace('bj-tran/src/main/java/','')
  254.                 patchpath_filename = patchpath_filename.replace('.java','.class')
  255.                 patchpath_filename = patchpath_filename.replace('\n','')
  256.                 patchpath_filename = 'patch/' + 'bj-tran/' + patchpath_filename
  257.                 patchpath = os.path.dirname(patchpath_filename)
  258.                 #如果patch目錄不存在,就建立目錄
  259.                 try:
  260.                     os.listdir(patchpath)
  261.                 except WindowsError:
  262.                     os.makedirs(patchpath) #makedirs可以在windows 的patch目錄下遞迴建立資料夾
  263.                 #複製父類到patch目錄下
  264.                 parentclass_path_filename = classpath_filename
  265.                 patchpath_filename = patchpath_filename
  266.                 print "複製svn class檔案到patch目錄: %s ---> %s " % (parentclass_path_filename,patchpath_filename)
  267.                 shutil.copy(parentclass_path_filename,patchpath_filename)
  268.                 count += 1
  269.                 print "***********第%s個檔案複製成功***************" % count
  270.                 #用glob尋找子類
  271.                 path_filename = os.path.split(classpath_filename) #split:返回一個二元組,包含檔案的路徑與檔名
  272.                 filename_splitext = os.path.splitext(path_filename[1]) #去掉副檔名
  273.                 subclass_path_filenames = glob.glob('%s/%s$*' % (path_filename[0],filename_splitext[0]))
  274.                 #把子類複製到patch目錄下
  275.                 for subclass_path_filename in subclass_path_filenames:
  276.                     subclass_path_filename = subclass_path_filename.replace('\\',r'/')
  277.                     patchpath_filename = subclass_path_filename.replace('../online_svn/bj-tran/target/classes/','patch/bj-tran/')
  278.                     print "複製svn subclass檔案到patch目錄: %s ---> %s " % (subclass_path_filename,patchpath_filename)
  279.                     shutil.copy(subclass_path_filename,patchpath_filename)
  280.                     count += 1
  281.                     print "***********第%s個檔案複製成功,注意該檔案是子類哦^_^ *****************************************" % count


  282.             elif line.startswith('bj-whm-rest'):
  283.                 #filelist檔案路徑預處理
  284.                 classpath_filename = line.replace('bj-whm-rest/src/main/java/','../online_svn/bj-whm-rest/target/classes/')
  285.                 classpath_filename = classpath_filename.replace('.java','.class')
  286.                 classpath_filename = classpath_filename.replace('\n','') #去掉換行符
  287.                 #構造patch目錄結構
  288.                 patchpath_filename = line.replace('bj-whm-rest/src/main/java/','')
  289.                 patchpath_filename = patchpath_filename.replace('.java','.class')
  290.                 patchpath_filename = patchpath_filename.replace('\n','')
  291.                 patchpath_filename = 'patch/' + 'bj-whm-rest/' + patchpath_filename
  292.                 patchpath = os.path.dirname(patchpath_filename)
  293.                 #如果patch目錄不存在,就建立目錄
  294.                 try:
  295.                     os.listdir(patchpath)
  296.                 except WindowsError:
  297.                     os.makedirs(patchpath) #makedirs可以在windows 的patch目錄下遞迴建立資料夾
  298.                 #複製父類到patch目錄下
  299.                 parentclass_path_filename = classpath_filename
  300.                 patchpath_filename = patchpath_filename
  301.                 print "複製svn class檔案到patch目錄: %s ---> %s " % (parentclass_path_filename,patchpath_filename)
  302.                 shutil.copy(parentclass_path_filename,patchpath_filename)
  303.                 count += 1
  304.                 print "***********第%s個檔案複製成功***************" % count
  305.                 #用glob尋找子類
  306.                 path_filename = os.path.split(classpath_filename) #split:返回一個二元組,包含檔案的路徑與檔名
  307.                 filename_splitext = os.path.splitext(path_filename[1]) #去掉副檔名
  308.                 subclass_path_filenames = glob.glob('%s/%s$*' % (path_filename[0],filename_splitext[0]))
  309.                 #把子類複製到patch目錄下
  310.                 for subclass_path_filename in subclass_path_filenames:
  311.                     subclass_path_filename = subclass_path_filename.replace('\\',r'/')
  312.                     patchpath_filename = subclass_path_filename.replace('../online_svn/bj-whm-rest/target/classes/','patch/bj-whm-rest/')
  313.                     print "複製svn subclass檔案到patch目錄: %s ---> %s " % (subclass_path_filename,patchpath_filename)
  314.                     shutil.copy(subclass_path_filename,patchpath_filename)
  315.                     count += 1
  316.                     print "***********第%s個檔案複製成功,注意該檔案是子類哦^_^ *****************************************" % count
  317.             
  318.             
  319.             else:
  320.                 print "%s:該專案沒有配置,請聯絡管理員" % line
  321.                 sys.exit()

  322.        
  323. #down jar包
  324. @hosts('czoms@10.2.88.47')
  325. def download_bj_oms_api_jar():
  326.     get('/opt/bj-oms-core/lib/bj-oms-api-1.0-SNAPSHOT.jar','patch/bj-oms-api/')

  327. @hosts('czoms@10.2.88.47')
  328. def download_bj_oms_domain_jar():
  329.     get('/opt/bj-oms-core/lib/bj-oms-domain-1.0-SNAPSHOT.jar','patch/bj-oms-domain/')

  330. @hosts('czoms@10.2.88.40')
  331. def download_bj_oms_core_new1_jar():
  332.     get('/opt/bj-oms-core/lib/bj-oms-core-1.0-SNAPSHOT.jar','patch/bj-oms-core-new1/')

  333. @hosts('appuser@10.2.88.30')
  334. def download_bj_oms_rest_jar():
  335.     get('/opt/bj-oms-rest/lib/bj-oms-rest-1.0-SNAPSHOT.jar','patch/bj-oms-rest/')

  336. @hosts('appuser@10.2.88.30')
  337. def download_bj_oms_job_jar():
  338.     get('/opt/bj-oms-job/lib/bj-oms-job-1.0-SNAPSHOT.jar','patch/bj-oms-jobs/')

  339. @hosts('czoms@10.2.88.47')
  340. def download_bj_oms_core_jar():
  341.     get('/opt/bj-oms-core/lib/bj-oms-core-1.0-SNAPSHOT.jar','patch/bj-oms-core/')


  342. #替換jar包裡面的檔案
  343. def replace_file_to_local_bj_oms_api_jar():
  344.     with lcd('patch/bj-oms-api/'):
  345.         local('jar -uvf bj-oms-api-1.0-SNAPSHOT.jar * ')
  346. '''
  347. def replace_file_to_local_bj_oms_core_new1_jar():
  348.     with lcd('patch/bj-oms-core-new1/'):
  349.         local('jar -uvf bj-oms-core-1.0-SNAPSHOT.jar * ')
  350. '''
  351.         
  352. def replace_file_to_local_bj_oms_domain_jar():
  353.     with lcd('patch/bj-oms-domain/'):
  354.         local('jar -uvf bj-oms-domain-1.0-SNAPSHOT.jar * ')
  355.         
  356. def replace_file_to_local_bj_oms_job_jar():
  357.     with lcd('patch/bj-oms-job/'):
  358.         local('jar -uvf bj-oms-job-1.0-SNAPSHOT.jar * ')

  359. def replace_file_to_local_bj_oms_rest_jar():
  360.     with lcd('patch/bj-oms-rest/'):
  361.         local('jar -uvf bj-oms-rest-1.0-SNAPSHOT.jar * ')

  362. def replace_file_to_local_bj_oms_core_jar():
  363.     with lcd('patch/bj-oms-core/'):
  364.         local('jar -uvf bj-oms-core-1.0-SNAPSHOT.jar * ')

  365.         


  366. #backup
  367. @hosts('czoms@10.2.88.47')
  368. def backup_bj_oms_api_jar():
  369.     run('dir1=$(date +%Y%m%d%H%M%S) && mkdir /backup/$dir1 && cp -a /opt/bj-oms-core/lib/bj-oms-api-1.0-SNAPSHOT.jar /backup/$dir1')
  370.     puts('bj-oms-api-1.0-SNAPSHOT.jar包備份到了10.2.88.47的/backup目錄下')

  371. @hosts('czoms@10.2.88.47')
  372. def backup_bj_oms_domain_jar():
  373.     run('dir1=$(date +%Y%m%d%H%M%S) && mkdir /backup/$dir1 && cp -a /opt/bj-oms-core/lib/bj-oms-domain-1.0-SNAPSHOT.jar /backup/$dir1')
  374.     puts('bj-oms-domain-1.0-SNAPSHOT.jar包備份到了10.2.88.47的/backup目錄下')

  375. @hosts('czoms@10.2.88.40')
  376. def backup_bj_oms_core_new1_jar():
  377.     run('dir1=$(date +%Y%m%d%H%M%S) && mkdir /backup/$dir1 && cp -a /opt/bj-oms-core/lib/bj-oms-core-1.0-SNAPSHOT.jar /backup/$dir1')
  378.     puts('bj-oms-core-1.0-SNAPSHOT.jar包備份到了10.2.88.40的/backup目錄下')

  379. @hosts('appuser@10.2.88.30')
  380. def backup_bj_oms_rest_jar():
  381.     run('dir1=$(date +%Y%m%d%H%M%S) && mkdir /backup/$dir1 && cp -a /opt/bj-oms-rest/lib/bj-oms-rest-1.0-SNAPSHOT.jar /backup/$dir1')
  382.     puts('bj-oms-rest-1.0-SNAPSHOT.jar包備份到了10.2.88.30的/backup/目錄下')

  383. @hosts('appuser@10.2.88.30')
  384. def backup_bj_oms_job_jar():
  385.     run('dir1=$(date +%Y%m%d%H%M%S) && mkdir /backup/bj-oms-job/$dir1 && cp -a /opt/bj-oms-job/lib/bj-oms-job-1.0-SNAPSHOT.jar /backup/bj-oms-job/$dir1')
  386.     puts('bj-oms-job-1.0-SNAPSHOT.jar包備份到了10.2.88.30的/backup/目錄下')

  387. @hosts('appuser@10.2.88.30')
  388. def backup_bj_web():
  389.     run('dir1=$(date +%Y%m%d%H%M%S) && mkdir /backup/$dir1 && cp -a /opt/tomcat-oms/webapps/bj-web /backup/$dir1')
  390.     puts('bj-web包備份到了10.2.88.30的/backup/目錄下')

  391. @hosts('czoms@10.2.88.47')
  392. def backup_bj_oms_core_jar():
  393.     run('dir1=$(date +%Y%m%d%H%M%S) && mkdir /backup/$dir1 && cp -a /opt/bj-oms-core/lib/bj-oms-core-1.0-SNAPSHOT.jar /backup/$dir1')
  394.     puts('bj_oms_core包備份到了10.2.88.30的/backup/目錄下')

  395.     
  396. #發版,上傳jar包
  397. @hosts('czoms@10.2.88.47','czoms@10.2.88.48','czoms@10.2.88.37','czoms@10.2.88.46','czoms@10.2.88.40','czoms@10.2.88.41')
  398. def put_bj_oms_api_jar_4748_3746_4041():
  399.     with lcd ('patch/bj-oms-api/'):
  400.         put('bj-oms-api-1.0-SNAPSHOT.jar','/opt/bj-oms-core/lib/')

  401. @hosts('appuser@10.2.88.30')
  402. def put_bj_oms_api_jar_30():
  403.     with lcd ('patch/bj-oms-api/'):
  404.         put('bj-oms-api-1.0-SNAPSHOT.jar','/opt/bj-oms-rest/lib')
  405.         put('bj-oms-api-1.0-SNAPSHOT.jar','/opt/bj-oms-job/lib')
  406.         put('bj-oms-api-1.0-SNAPSHOT.jar','/opt/tomcat-oms/webapps/bj-web/WEB-INF/lib')
  407.         

  408. @hosts('czoms@10.2.88.47','czoms@10.2.88.48','czoms@10.2.88.37','czoms@10.2.88.46','czoms@10.2.88.40','czoms@10.2.88.41')
  409. def put_bj_oms_domain_jar_4748_3746_4041():
  410.     with lcd ('patch/bj-oms-domain/'):
  411.         put('bj-oms-domain-1.0-SNAPSHOT.jar','/opt/bj-oms-core/lib')

  412. @hosts('appuser@10.2.88.30')
  413. def put_bj_oms_domain_jar_30():
  414.     with lcd ('patch/bj-oms-domain/'):
  415.         put('bj-oms-domain-1.0-SNAPSHOT.jar','/opt/bj-oms-rest/lib')
  416.         put('bj-oms-domain-1.0-SNAPSHOT.jar','/opt/bj-oms-job/lib')
  417.         put('bj-oms-domain-1.0-SNAPSHOT.jar','/opt/tomcat-oms/webapps/bj-web/WEB-INF/lib')
  418.         

  419. @roles('cz-oms-core-new1')
  420. def put_bj_oms_core_new1_jar():
  421.     with lcd ('patch/bj-oms-core-new1/'):
  422.         put('bj-oms-core-1.0-SNAPSHOT.jar','/opt/bj-oms-core/lib')

  423. @roles('cz')
  424. def put_bj_oms_rest_jar():
  425.     with lcd ('patch/bj-oms-rest/'):
  426.         put('bj-oms-rest-1.0-SNAPSHOT.jar','/opt/bj-oms-rest/lib')

  427. @roles('cz')
  428. def put_bj_oms_job_jar():
  429.     with lcd ('patch/bj-oms-jobs/'):
  430.         put('bj-oms-job-1.0-SNAPSHOT.jar','/opt/bj-oms-job/lib')

  431. @roles('cz')
  432. def put_bj_web():
  433.     with lcd ('patch/'):
  434.         put('bj-web.zip','/opt/tomcat-oms/webapps')
  435.         run('cd /opt/tomcat-oms/webapps && unzip -o bj-web.zip && rm -rf bj-web.zip')

  436. @roles('cz-oms-core')
  437. def put_bj_oms_core_jar():
  438.     with lcd ('patch/bj-oms-core'):
  439.         put('bj-oms-core-1.0-SNAPSHOT.jar','/opt/bj-oms-core/lib')


  440. #重啟服務
  441. @roles('cz-oms-core')
  442. def stop_cz_oms_core_4748():
  443.     sudo('/opt/bj-oms-core/bin/stop.sh',pty=False)

  444. @roles('cz-oms-core')
  445. def start_cz_oms_core_4748():
  446.     sudo('/opt/bj-oms-core/bin/start.sh',pty=False)

  447.     

  448. @roles('cz-oms-core-new')
  449. def stop_cz_oms_core__new_3746():
  450.     sudo('/opt/bj-oms-core/bin/stop.sh',pty=False)

  451. @roles('cz-oms-core-new')
  452. def start_cz_oms_core__new_3746():
  453.     sudo('nohup /opt/bj-oms-core/bin/start.sh &',pty=False)



  454. @roles('cz-oms-core-new1')
  455. def stop_cz_oms_core__new1_4041():
  456.     sudo('/opt/bj-oms-core/bin/stop.sh',pty=False)

  457. @roles('cz-oms-core-new1')
  458. def start_cz_oms_core__new1_4041():
  459.     sudo('/opt/bj-oms-core/bin/start.sh',pty=False)


  460.     

  461. @roles('cz')
  462. def stop_cz_bj_oms_rest_30():
  463.     sudo('/opt/bj-oms-rest/bin/stop.sh',pty=False)
  464.     
  465. @roles('cz')
  466. def start_cz_bj_oms_rest_30():
  467.     sudo('nohup /opt/bj-oms-rest/bin/start.sh &',pty=False)

  468.     

  469. @roles('cz')
  470. def stop_cz_bj_oms_job_30():
  471.     sudo('/opt/bj-oms-job/bin/stop.sh',pty=False)

  472. @roles('cz')
  473. def start_cz_bj_oms_job_30():
  474.     sudo('/opt/bj-oms-job/bin/start.sh',pty=False)


  475.     
  476. @roles('cz')
  477. def stop_cz_tomcat_oms_30():
  478.     sudo('/opt/tomcat-oms/bin/shutdown.sh',pty=False)
  479.     
  480. @roles('cz')
  481. def start_cz_tomcat_oms_30():
  482.     sudo('/opt/tomcat-oms/bin/start.sh',pty=False)



  483.     

  484.         


  485. #主程式
  486. if __name__ == '__main__':
  487.     #Update SVN
  488.     while True:
  489.         temp = str(raw_input('1) 請問你要Update SVN嗎?[yes/no]:'.decode('utf-8').encode('gb2312')))
  490.         tips = temp.strip().lower()
  491.         if tips == 'yes':
  492.             print "Now begin Update SVN..."
  493.             UpdateSVN('../online_svn/bj-oms/bj-oms-api')
  494.             UpdateSVN('../online_svn/bj-oms/bj-oms-core')
  495.             UpdateSVN('../online_svn/bj-oms/bj-oms-core-new')
  496.             UpdateSVN('../online_svn/bj-oms/bj-oms-core-new1')
  497.             UpdateSVN('../online_svn/bj-oms/bj-oms-domain')
  498.             UpdateSVN('../online_svn/bj-oms/bj-oms-jobs')
  499.             UpdateSVN('../online_svn/bj-oms/bj-oms-rest')
  500.             UpdateSVN('../online_svn/bj-tran')
  501.             UpdateSVN('../online_svn/bj-whm')
  502.             break
  503.         elif tips == 'no':
  504.             break
  505.     #刪除patch目錄下所有內容
  506.     while True:
  507.         temp = str(raw_input('2)刪除patch目錄下所有目錄嗎?[yes/no]:'.decode('utf-8').encode('gb2312')))
  508.         tips = temp.strip().lower()
  509.         if tips == 'yes':
  510.             for line in os.listdir('patch'):
  511.                 shutil.rmtree('patch/%s' % line)
  512.             break
  513.         elif tips == 'no':
  514.             break

  515.  #提示是否eclipse編譯程式碼
  516.     while True:
  517.         temp = str(raw_input('3) 提示:請問你手工透過eclse編譯css程式碼了嗎[yes/no]:'))
  518.         tips = temp.strip().lower()
  519.         if tips == 'yes':
  520.             break
  521.         elif tips == 'no':
  522.             break
  523.         

  524.     #根據filelist生成發版目錄
  525.     while True:
  526.         temp = str(raw_input('4)根據filelist生成發版目錄嗎?[yes/no]:'.decode('utf-8').encode('gb2312')))
  527.         tips = temp.strip().lower()
  528.         if tips == 'yes':
  529.             print "Now begin generate faban dir..."
  530.             faban_dir()
  531.             break
  532.         elif tips == 'no':
  533.             break
  534.          

  535.     #unzip
  536.     while True:
  537.         temp = str(raw_input('5)解壓zip包到本地patch目錄嗎?[yes/no]:'.decode('utf-8').encode('gb2312')))
  538.         tips = temp.strip().lower()
  539.         if tips == 'yes':
  540.             print "Now begin unzip jar to patch dir..."
  541.             output = subprocess.check_output(['fab','unzip'],shell=True,stderr = subprocess.STDOUT)
  542.             print output
  543.             break
  544.         elif tips == 'no':
  545.             break
  546.     
  547.     #download jar to localpath
  548.     while True:
  549.         temp = str(raw_input('6)把jar包下載到本地的patch目錄嗎?[yes/no]:'.decode('utf-8').encode('gb2312')))
  550.         tips = temp.strip().lower()
  551.         if tips == 'yes':
  552.             print "Now begin download jar to patch dir..."
  553.             dirs = [item for item in os.listdir('patch/') if not item.endswith('zip')]
  554.             for index,item in enumerate(dirs,1):
  555.                 if item == 'bj-oms-api':
  556.                     print "%d: %s is downoading..." % (index,item)
  557.                     output = subprocess.check_output(['fab','download_bj_oms_api_jar'],shell=True,stderr = subprocess.STDOUT) #shell=True在windows時可以關閉cmd視窗的回顯
  558.                     print output
  559.                 elif item == "bj-oms-core-new1":
  560.                     print "%d: %s is downoading..." % (index,item)
  561.                     output = subprocess.check_output(['fab','download_bj_oms_core_new1_jar'],shell=True,stderr = subprocess.STDOUT)
  562.                     print output
  563.                 elif item == "bj-oms-rest":
  564.                     print "%d: %s is downoading..." % (index,item)
  565.                     output = subprocess.check_output(['fab','download_bj_oms_rest_jar'],shell=True,stderr = subprocess.STDOUT)
  566.                     print output
  567.                 elif item == "bj-oms-jobs":
  568.                     print "%d: %s is downoading..." % (index,item)
  569.                     output = subprocess.check_output(['fab','download_bj_oms_job_jar'],shell=True,stderr = subprocess.STDOUT)
  570.                     print output
  571.                 elif item == "bj-oms-domain":
  572.                     print "%d: %s is downoading..." % (index,item)
  573.                     output = subprocess.check_output(['fab','download_bj_oms_domain_jar'],shell=True,stderr = subprocess.STDOUT)
  574.                     print output
  575.                 elif item == "bj-oms-core":
  576.                     print "%d: %s is downoading..." % (index,item)
  577.                     output = subprocess.check_output(['fab','download_bj_oms_core_jar'],shell=True,stderr = subprocess.STDOUT)
  578.                     print output
  579.                 elif item == "bj-web":
  580.                     pass
  581.                 else:
  582.                     print('%s下載失敗,因為該檔案沒有在發版程式裡面配置,請聯絡管理員') % item
  583.                     sys.exit()
  584.             break
  585.         elif tips == 'no':
  586.             break



  587.     #replace file to jar
  588.     while True:
  589.         temp = str(raw_input('7)替換jar包裡面的配置檔案嗎?[yes/no]:'.decode('utf-8').encode('gb2312')))
  590.         tips = temp.strip().lower()
  591.         if tips == 'yes':
  592.             print "Now begin replace class file from jar ..."
  593.             dirs = [item for item in os.listdir('patch/') if not item.endswith('zip')]
  594.             for index,item in enumerate(dirs,1):
  595.                 if item == 'bj-oms-api':
  596.                     print "%d: %s is replacing jar now..." % (index,item)
  597.                     output = subprocess.check_output(['fab','replace_file_to_local_bj_oms_api_jar'],shell=True,stderr = subprocess.STDOUT)
  598.                     print output
  599.                 elif item == "bj-oms-core-new1":
  600.                     while True:
  601.                         temp = str(raw_input('注意:因bj-oms-core-new1包裡面有重複檔案,所以需要手工更新jar包裡面的內容,你更新了嗎?[yes/no]:'.decode('utf-8').encode('gb2312')))
  602.                         tips = temp.strip().lower()
  603.                         if tips == 'yes':
  604.                             break
  605.                         elif tips == 'no':
  606.                             break
  607.                 elif item == 'bj-oms-domain':
  608.                     print "%d: %s is replacing jar now..." % (index,item)
  609.                     output = subprocess.check_output(['fab','replace_file_to_local_bj_oms_domain_jar'],shell=True,stderr = subprocess.STDOUT)
  610.                     print output
  611.                 elif item == 'bj-oms-job':
  612.                     print "%d: %s is replacing jar now..." % (index,item)
  613.                     output = subprocess.check_output(['fab','replace_file_to_local_bj_oms_job_jar'],shell=True,stderr = subprocess.STDOUT)
  614.                     print output
  615.                 elif item == 'bj-oms-rest':
  616.                     print "%d: %s is replacing jar now..." % (index,item)
  617.                     output = subprocess.check_output(['fab','replace_file_to_local_bj_oms_rest_jar'],shell=True,stderr = subprocess.STDOUT)
  618.                     print output
  619.                 elif item == 'bj-oms-core':
  620.                     print "%d: %s is replacing jar now..." % (index,item)
  621.                     output = subprocess.check_output(['fab','replace_file_to_local_bj_oms_core_jar'],shell=True,stderr = subprocess.STDOUT)
  622.                     print output
  623.             break
  624.         elif tips == 'no':
  625.             break




  626.     #backup jar
  627.     while True:
  628.         temp = str(raw_input('8)在正式發版前希望備份遠端伺服器的jar包嗎?[yes/no]:'.decode('utf-8').encode('gb2312')))
  629.         tips = temp.strip().lower()
  630.         if tips == 'yes':
  631.             print "Now begin backup jar to /backup..."
  632.             dirs = [item for item in os.listdir('patch/') if not item.endswith('zip')]
  633.             for index,item in enumerate(dirs,1):
  634.                 if item == 'bj-oms-api':
  635.                     print "%d: %s is backuping..." % (index,item)
  636.                     output = subprocess.check_output(['fab','backup_bj_oms_api_jar'],shell=True,stderr = subprocess.STDOUT) #shell=True在windows時可以關閉cmd視窗的回顯
  637.                     print output
  638.                     print
  639.                 elif item == 'bj-oms-domain':
  640.                     print "%d: %s is backuping..." % (index,item)
  641.                     output = subprocess.check_output(['fab','backup_bj_oms_domain_jar'],shell=True,stderr = subprocess.STDOUT)
  642.                     print output
  643.                 elif item == 'bj-oms-core-new1':
  644.                     print "%d: %s is backuping..." % (index,item)
  645.                     output = subprocess.check_output(['fab','backup_bj_oms_core_new1_jar'],shell=True,stderr = subprocess.STDOUT)
  646.                     print output
  647.                 elif item == 'bj-oms-rest':
  648.                     print "%d: %s is backuping..." % (index,item)
  649.                     output = subprocess.check_output(['fab','backup_bj_oms_rest_jar'],shell=True,stderr = subprocess.STDOUT)
  650.                     print output
  651.                 elif item == 'bj-oms-jobs':
  652.                     print "%d: %s is backuping..." % (index,item)
  653.                     output = subprocess.check_output(['fab','backup_bj_oms_job_jar'],shell=True,stderr = subprocess.STDOUT)
  654.                     print output
  655.                 elif item == 'bj-web':
  656.                     print "%d: %s is backuping..." % (index,item)
  657.                     output = subprocess.check_output(['fab','backup_bj_web'],shell=True,stderr = subprocess.STDOUT)
  658.                     print output
  659.                 elif item == 'bj-oms-core':
  660.                     print "%d: %s is backuping..." % (index,item)
  661.                     output = subprocess.check_output(['fab','backup_bj_oms_core_jar'],shell=True,stderr = subprocess.STDOUT)
  662.                     print output
  663.             break
  664.         elif tips == 'no':
  665.             break

  666.     #發版,上傳jar包到生產伺服器
  667.     while True:
  668.         temp = str(raw_input('9)請問開始向生產伺服器發版嗎?[yes/no]:'.decode('utf-8').encode('gb2312')))
  669.         tips = temp.strip().lower()
  670.         if tips == 'yes':
  671.             print "Now begin publish..."
  672.             dirs = [item for item in os.listdir('patch/') if not item.endswith('zip')]
  673.             for index,item in enumerate(dirs,1):
  674.                 if item == 'bj-oms-api':
  675.                     print "%d: %s is publishing..." % (index,item)
  676.                     output = subprocess.check_output(['fab','put_bj_oms_api_jar_4748_3746_4041'],shell=True,stderr = subprocess.STDOUT) #shell=True在windows時可以關閉cmd視窗的回顯
  677.                     print output
  678.                     output = subprocess.check_output(['fab','put_bj_oms_api_jar_30'],shell=True,stderr = subprocess.STDOUT)
  679.                     print output
  680.                     print
  681.                 elif item == 'bj-oms-domain':
  682.                     print "%d: %s is publishing..." % (index,item)
  683.                     output = subprocess.check_output(['fab','put_bj_oms_domain_jar_4748_3746_4041'],shell=True,stderr = subprocess.STDOUT)
  684.                     print output
  685.                     output = subprocess.check_output(['fab','put_bj_oms_domain_jar_30'],shell=True,stderr = subprocess.STDOUT)
  686.                     print output
  687.                 elif item == 'bj-oms-core-new1':
  688.                     print "%d: %s is publishing..." % (index,item)
  689.                     output = subprocess.check_output(['fab','put_bj_oms_core_new1_jar'],shell=True,stderr = subprocess.STDOUT)
  690.                     print output
  691.                 elif item == 'bj-oms-rest':
  692.                     print "%d: %s is publishing..." % (index,item)
  693.                     output = subprocess.check_output(['fab','put_bj_oms_rest_jar'],shell=True,stderr = subprocess.STDOUT)
  694.                     print output
  695.                 elif item == 'bj-oms-jobs':
  696.                     print "%d: %s is publishing..." % (index,item)
  697.                     output = subprocess.check_output(['fab','put_bj_oms_job_jar'],shell=True,stderr = subprocess.STDOUT)
  698.                     print output
  699.                 elif item == 'bj-web':
  700.                     print "%d: %s is publishing..." % (index,item)
  701.                     output = subprocess.check_output(['fab','put_bj_web'],shell=True,stderr = subprocess.STDOUT)
  702.                     print output
  703.                 elif item == 'bj-oms-core':
  704.                     print "%d: %s is publishing..." % (index,item)
  705.                     output = subprocess.check_output(['fab','put_bj_oms_core_jar'],shell=True,stderr = subprocess.STDOUT)
  706.                     print output
  707.             break
  708.         elif tips == 'no':
  709.             break

  710.     #關閉服務
  711.     while True:
  712.         temp = str(raw_input('10)請問開始關閉服務嗎,包含服務tomcat、rest、job、core?[yes/no]:'.decode('utf-8').encode('gb2312')))
  713.         tips = temp.strip().lower()
  714.         if tips == 'yes':
  715.             print "Now begin stop service..."
  716.             output = subprocess.check_output(['fab','stop_cz_tomcat_oms_30'],shell=True,stderr = subprocess.STDOUT)
  717.             print output
  718.             output = subprocess.check_output(['fab','stop_cz_bj_oms_rest_30'],shell=True,stderr = subprocess.STDOUT)
  719.             print output
  720.             output = subprocess.check_output(['fab','stop_cz_bj_oms_job_30'],shell=True,stderr = subprocess.STDOUT)
  721.             print output
  722.             output = subprocess.check_output(['fab','stop_cz_oms_core_4748'],shell=True,stderr = subprocess.STDOUT)
  723.             print output
  724.             output = subprocess.check_output(['fab','stop_cz_oms_core__new_3746'],shell=True,stderr = subprocess.STDOUT)
  725.             print output
  726.             output = subprocess.check_output(['fab','stop_cz_oms_core__new1_4041'],shell=True,stderr = subprocess.STDOUT)
  727.             print output
  728.         
  729.         elif tips == 'no':
  730.             break

  731.     #開啟服務
  732.     while True:
  733.         temp = str(raw_input('11)請問開始啟動服務嗎,包含服務core、tomcat、rest、job?[yes/no]:'.decode('utf-8').encode('gb2312')))
  734.         tips = temp.strip().lower()
  735.         if tips == 'yes':
  736.             print "Now begin stop service..."
  737.             output = subprocess.check_output(['fab','start_cz_oms_core__new1_4041'],shell=True,stderr = subprocess.STDOUT)
  738.             print output
  739.             output = subprocess.check_output(['fab','start_cz_oms_core__new_3746'],shell=True,stderr = subprocess.STDOUT)
  740.             print output
  741.             output = subprocess.check_output(['fab','start_cz_oms_core_4748'],shell=True,stderr = subprocess.STDOUT)
  742.             print output
  743.             output = subprocess.check_output(['fab','start_cz_tomcat_oms_30'],shell=True,stderr = subprocess.STDOUT)
  744.             print output
  745.             output = subprocess.check_output(['fab','start_cz_bj_oms_rest_30'],shell=True,stderr = subprocess.STDOUT)
  746.             print output
  747.             output = subprocess.check_output(['fab','start_cz_bj_oms_job_30'],shell=True,stderr = subprocess.STDOUT)
  748.             print output
  749.         elif tips == 'no':
  750.             break

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28916011/viewspace-2153243/,如需轉載,請註明出處,否則將追究法律責任。

相關文章