Beispiel #1
0
def main(args):
    try:
        while True:
            try:
                pwd = getpass.getpass("Confluence password for %s: "\
                                          % getpass.getuser())
                rc = cli.login(getpass.getuser(), pwd, page.SPACE_KEY)
                break
            except cli.AuthFailure:
                pass

        if args.page:
            cid = page.extractPageId(args.page)
            if not cid:
                return False
        else:
            while True:
                cid = page.askForPageId()
                break

        return updateProperty(cid)

    except KeyboardInterrupt:
        print
    return False
Beispiel #2
0
def main(args):

    while True:
        try:
            pwd = getpass.getpass("Confluence password for %s: "\
                                      % getpass.getuser())
            rc = cli.login(getpass.getuser(), pwd, page.SPACE_KEY)
            break
        except cli.AuthFailure:
            pass

    if args.page:
        cid = page.extractPageId(args.page)
        if not cid:
            return False
    else:
        while True:
            try:
                cid = page.askForPageId()
                break
            except fields.AbortPage:
                print
                print "-ERROR- Page aborted."
            except KeyboardInterrupt:
                return False

    return add_efuse(cid=cid,
                     efuse=args.efuse,
                     force=args.force,
                     dryrun=args.dryrun)
Beispiel #3
0
def main():
    rc = cli.login(
        getpass.getuser(),
        getpass.getpass("Confluence password for %s: " % getpass.getuser()),
        page.SPACE_KEY)
    print cli.getToken()
    return 0
Beispiel #4
0
def main():
    count = getint("Number of new pages: ")
    pwd = getpass.getpass("Confluence password: "******"Confluence login failed."
        return 1

    stamp = datetime.datetime.now().strftime("%Y_%m_%d_%H%M%S")
    fname = "hwdb_blanks_" + stamp + ".csv"
    outfile = open(fname, mode="w")
    print "Writing URLs to file: %s" % fname
    outfile.write("Long URL, Short URL\n")

    blank_page = page.Page()

    for i in xrange(count):
        # Create the page using a title based on process ID and current date+time,
        # to ensure uniqueness. No page ID is available until after creation.
        stamp = str(os.getpid()) + datetime.datetime.utcnow().isoformat()
        title = page.BLANK_TITLE_TEMPLATE.substitute(pageId=stamp)
        cid = cli.addPage(title,
                          parentTitle=page.BLANK_PARENT,
                          content=blank_page.getMarkup())
        if not cid:
            return 1
        # Rename the page to a title with the true page ID.
        if not cli.renamePage(page.BLANK_TITLE_TEMPLATE.substitute(pageId=cid),
                              cid=cid):
            return 1

        long_url = page.PAGE_URL_TEMPLATE.substitute(cid=cid)
        short_url = page.extractPageShortURL(long_url)
        print "%s, %s" % (long_url, short_url)
        outfile.write("%s, %s\n" % (long_url, short_url))
    return 0
Beispiel #5
0
def main():
    user = getpass.getuser()
    rc = cli.login(user, getpass.getpass("Confluence password for %s: " % user), page.SPACE_KEY)
    if rc: return 1
    # Regex to match only the children.
    titleRegex = page.BLANK_TITLE_TEMPLATE.substitute(pageId=r"\d+")
    pages = cli.getPageList(title=page.BLANK_PARENT, descendants=True, titleRegex=titleRegex)
    print >>sys.stderr, len(pages), "pages"
    for p in pages:
        print page.PAGE_URL_TEMPLATE.substitute(cid=p["Id"])
    return 0
Beispiel #6
0
def main():
    print "Check device pages in the hardware database in Confluence."
    print "Type control-D or control-C at a prompt to terminate."
    print
    pwd = getpass.getpass("Confluence password for %s: " % getpass.getuser())
    rc = cli.login(getpass.getuser(), pwd, page.SPACE_KEY)
    if rc:
        return 1
    while True:
        print
        ans = raw_input("Enter page ID (or URL with page ID in it): ")
        cid = page.extractPageId(ans)
        if cid is None:
            print "Could not find a page ID in that."
        elif check.validDevicePage(cid):
            print "OK"
Beispiel #7
0
def main(args):
    try:
        while True:
            try:
                pwd = getpass.getpass("Confluence password for %s: "\
                                          % getpass.getuser())
                rc = cli.login(getpass.getuser(), pwd, page.SPACE_KEY)
                break
            except cli.AuthFailure:
                pass

        cid = page.extractPageId(args.page)
            if not cid:
                return False

        return add_label(cid=cid, 
                         label=args.tag)
Beispiel #8
0
def main(args):
    print """
Type control-D or control-C at a prompt to terminate.
While making a page type a period to abort the page.
"""
    while True:
        try:
            pwd = getpass.getpass("Confluence password for %s: "\
                                      % getpass.getuser())
            rc = cli.login(getpass.getuser(), pwd, page.SPACE_KEY)
            break
        except cli.AuthFailure:
            pass

    try:
        if args.page:
            cid = page.extractPageId(args.page)
            if not cid:
                return False
            return init_page(cid=cid,
                             devtype=args.board,
                             tag=args.tag,
                             status=args.status,
                             site=args.loc,
                             dryrun=args.dryrun)

        # If the page wasn't specified on the command line,
        # just keep asking for new pages.
        else:
            while True:
                cid = page.askForPageId()
                init_page(cid=cid,
                          devtype=args.board,
                          tag=args.tag,
                          status=args.status,
                          site=args.loc,
                          dryrun=args.dryrun)

    except fields.AbortPage:
        print
        print "-ERROR- Page aborted."
    except KeyboardInterrupt:
        print
        return False
Beispiel #9
0
    sys.exit(1)

  macs = []
  if args.burn:
    macs = cmb_efuse.burn_macs()
    cmb_efuse.dump_macs()
  else:
    print "BURN option not selected"

  if args.dump:
    macs = cmb_efuse.dump_macs()

  if args.hwdb and macs:
    print "Updating Hardware Database with MACs"
    
    while True:
      try:
        pwd = getpass.getpass("Confluence password for %s: " % getpass.getuser())
        rc = cli.login(getpass.getuser(), pwd, page.SPACE_KEY)
        break
      except cli.AuthFailure:
        pass

    cid = page.askForPageId()
    
    maclist = [m.addr for m in macs]
    try:
      update_macs.add_macs(cid, idx=0, macs=maclist)
    except ValueError, e:
      print "Couldn't update HWDB:", e