Example #1
0
def setLocalMgmtPort(args, fromCLI):
    paramReq = ("port", )
    paramOpt = ()
    comm.validateArgs(paramReq, paramOpt, args)
    if fromCLI:
        validate.checkPortNum("port", args["port"])

    retDict = {}
    host = "localhost"
    key = "mgmtHostPort"
    currSetts = comm.readConfFile(fullWebConfig)

    if not webSettingsStanza in currSetts:
        currSetts[webSettingsStanza] = {}
    if key in currSetts[webSettingsStanza]:
        try:
            # this expects the uri as "blah:8000" - or just "a:b", really.
            host, oldPortWhichIsGarbage = currSetts[webSettingsStanza][
                key].split(":", 1)
        except ValueError:
            pass  # leaves localhost value from above

    currSetts[webSettingsStanza][key] = "%s:%s" % (host, args["port"])
    comm.writeConfFile(fullWebConfig, currSetts)
    return retDict
Example #2
0
def setLocalHttp(args, fromCLI):
    paramReq = ("port", )
    paramOpt = ()
    comm.validateArgs(paramReq, paramOpt, args)
    if fromCLI:
        validate.checkPortNum("port", args["port"])

    retDict = {}
    key = "httpport"
    currSetts = comm.readConfFile(fullWebConfig)

    if not webSettingsStanza in currSetts:
        currSetts[webSettingsStanza] = {}
    currSetts[webSettingsStanza][key] = args["port"]

    comm.writeConfFile(fullWebConfig, currSetts)
    return retDict
def setLocalHttp(args, fromCLI):
  paramReq = ("port",)
  paramOpt = ()
  comm.validateArgs(paramReq, paramOpt, args)
  if fromCLI:
    validate.checkPortNum("port", args["port"])

  retDict = {}
  key = "httpport"
  currSetts = comm.readConfFile(fullWebConfig)

  if not webSettingsStanza in currSetts:
    currSetts[webSettingsStanza] = {}
  currSetts[webSettingsStanza][key] = args["port"]

  comm.writeConfFile(fullWebConfig, currSetts)
  return retDict
def setLocalMgmtPort(args, fromCLI):
  paramReq = ("port",)
  paramOpt = ()
  comm.validateArgs(paramReq, paramOpt, args)
  if fromCLI:
    validate.checkPortNum("port", args["port"])

  retDict = {}
  host = "localhost"
  key  = "mgmtHostPort"
  currSetts = comm.readConfFile(fullWebConfig)

  if not webSettingsStanza in currSetts:
    currSetts[webSettingsStanza] = {}
  if key in currSetts[webSettingsStanza]:
    try:
      # this expects the uri as "blah:8000" - or just "a:b", really.
      host, oldPortWhichIsGarbage = currSetts[webSettingsStanza][key].split(":", 1)
    except ValueError:
      pass # leaves localhost value from above

  currSetts[webSettingsStanza][key] = "%s:%s" % (host, args["port"])
  comm.writeConfFile(fullWebConfig, currSetts)
  return retDict