Пример #1
0
def mainline():
  ## need from_version & to_version
  if len(sys.argv) == 3:
    p_from_ver = sys.argv[1]
    p_to_ver = sys.argv[2]
  else:
    print ("ERROR: Invalid number of parameters, try: ")
    print ("         python update-hub.py from_version  to_version")
    sys.exit(1)

  print ("")
  print ("Running update-hub from v" + p_from_ver + " to v" + p_to_ver)

  if p_from_ver >= p_to_ver:
    print ("Nothing to do.")
    sys.exit(0)

  if (p_from_ver < "2.7.0") and (p_to_ver >= "2.7.0"):
    update_2_7_0()
  if (p_from_ver < "3.1.0") and (p_to_ver >= "3.1.0"):
    update_3_1_0()
  if (p_from_ver < "3.1.1") and (p_to_ver >= "3.1.1"):
    update_3_1_1()

  if (p_from_ver < "3.2.1") and (p_to_ver >= "3.2.1"):
    update_3_2_1()
    PGC_HOME = os.getenv('PGC_HOME', '')
    try:
      import shutil
      src = os.path.join(os.path.dirname(__file__), "pgc.sh")
      dst = os.path.join(PGC_HOME, "pgc")
      if platform.system() == "Windows":
        src = os.path.join(os.path.dirname(__file__), "pgc.bat")
        dst = os.path.join(PGC_HOME, "pgc.bat")
      shutil.copy(src, dst)
    except Exception as e:
      pass

  if (p_from_ver < "3.2.9") and (p_to_ver >= "3.2.9"):
    old_default_repo = "http://s3.amazonaws.com/pgcentral"
    new_default_repo = "https://s3.amazonaws.com/pgcentral"
    current_repo = util.get_value("GLOBAL", "REPO")
    if current_repo == old_default_repo:
      util.set_value("GLOBAL", "REPO", new_default_repo)

  if (p_from_ver < "3.3.0") and (p_to_ver >= "3.3.0"):
    update_3_3_0()

  if (p_from_ver < "3.3.3") and (p_to_ver >= "3.3.3"):
    update_3_3_3()

  print (" ")
  print ("Goodbye.")
  sys.exit(rc)
  return
Пример #2
0
 def setTestSetting(self, val):
     """
     Method to set the test list setting of bam.
     :return: It yields json string.
     """
     util.set_value("GLOBAL", "STAGE", val)
Пример #3
0
PGC_HOME = os.getenv('PGC_HOME', '')
PGC_LOGS = os.getenv('PGC_LOGS', '')

# Initialize the ConsoleLogger to redirect the console output log file
sys.stdout = ConsoleLogger()

homedir = os.path.join(PGC_HOME, component_name)

logdir = os.path.join(homedir, 'logs')

try:
    with open(os.path.join(PGC_HOME,'conf','bam_config.json'), 'r+') as _file:
        BamConfigData = json.loads(_file.read())
        if "test" in BamConfigData:
            if BamConfigData.get('test'):
                util.set_value("GLOBAL", "STAGE", "test")
            del BamConfigData["test"]
            with open(os.path.join(PGC_HOME,'conf','bam_config.json'), 'w') as bfile:
                json.dump(BamConfigData, bfile)
except Exception as e:
    pass


def check_is_service_installed(svcName):
    import win32serviceutil

    is_service_installed = False
    try:
        win32serviceutil.QueryServiceStatus(svcName)
        is_service_installed = True
    except:
Пример #4
0
 def setBetaFeatureSetting(self, settingName, val):
     """
     Method to set the test list setting of bam.
     :return: It yields json string.
     """
     util.set_value("BETA", settingName, val)