| |
@@ -4,19 +4,38 @@
|
| |
import json
|
| |
import argparse
|
| |
import sys
|
| |
- from auth import tauth
|
| |
- # import taiga
|
| |
- from convert import convert
|
| |
+ import accept
|
| |
+ import update
|
| |
|
| |
+ from tga import taiga_auth
|
| |
+ from pgure import pagure_auth
|
| |
+ from bz import bugzilla_auth
|
| |
+ from tga import issues as tgaissue
|
| |
+ from tga import userstory as tguserstory
|
| |
+ from tga import convert
|
| |
+ from tga import createprop
|
| |
+ from mail import climail
|
| |
+ from mail import mailauth
|
| |
+ from pgure import fesco
|
| |
+ from logger import setup_logging_to_file, log_exception
|
| |
|
| |
class Change_Tool(object):
|
| |
def __init__(self):
|
| |
parser = argparse.ArgumentParser(
|
| |
description='Cli for Change Tool',
|
| |
- usage='''change-tool <command> [<args>]'''
|
| |
- )
|
| |
+ usage='''fedora-change-wrangler <command> [<args>]
|
| |
|
| |
- parser.add_argument('command', help='Subcommand to run')
|
| |
+ The commands are:
|
| |
+ auth Authenticates with Bugzilla,Taiga and Pagure
|
| |
+ convert Converts the Taiga issues to user stories
|
| |
+ list Lists the Pending issues/userstory as per the optinal argument
|
| |
+ announce Announces to the mailing list of the approved change
|
| |
+ fesco Creates issues on the fesco repo with details from the approved change proposal
|
| |
+ accept Accepts the Change Proposal by Converting issue to user story and creates a tracking bug in Bugzilla
|
| |
+ sync Syncs the tracking bug status with Taiga status
|
| |
+ --help Lists out the subcommand in each subcommand of the cli
|
| |
+ ''')
|
| |
+ parser.add_argument('command', help='Subcommand --flags')
|
| |
# parse_args defaults to [1:] for args, but you need to
|
| |
# exclude the rest of the args too, or validation will fail
|
| |
args = parser.parse_args(sys.argv[1:2])
|
| |
@@ -30,44 +49,257 @@
|
| |
def auth(self):
|
| |
parser = argparse.ArgumentParser(
|
| |
description='Module for authentication functions')
|
| |
- parser.add_argument('--auth', help='runs the auth instance')
|
| |
+ # parser.add_argument('--auth', help='runs the auth instance')
|
| |
subparsers = parser.add_subparsers(dest='command', help='sub-command help')
|
| |
|
| |
# Subparser for taiga
|
| |
taiga = subparsers.add_parser('taiga', help='taiga auth module')
|
| |
taiga.add_argument('--token', action='store_true', help='refreshes the token')
|
| |
- taiga.add_argument('--reset', action='store_true', help='resets the user id and pass')
|
| |
+ taiga.add_argument('--reset', action='store_true', help='sets/resets the user id and pass')
|
| |
|
| |
# subparser for pagure
|
| |
pagure = subparsers.add_parser('pagure', help='pagure auth module')
|
| |
- pagure.add_argument('--token', action='store_true', help='refreshes the token')
|
| |
- pagure.add_argument('--reset', action='store_true', help='resets the user id and pass')
|
| |
+ pagure.add_argument('--whoami', action='store_true', help='returns who the user is,for debug/developement only')
|
| |
+ pagure.add_argument('--reset', action='store_true', help='resets the pagure token')
|
| |
|
| |
# subparser for bugzilla
|
| |
bugzilla = subparsers.add_parser('bugzilla', help='bugzilla auth module')
|
| |
- bugzilla.add_argument('--token', action='store_true', help='refreshes the token')
|
| |
- bugzilla.add_argument('--reset', action='store_true', help='resets the user id and pass')
|
| |
+ bugzilla.add_argument('--token', action='store_true', help='sets the the token for bugzilla')
|
| |
+ bugzilla.add_argument('--reset', action='store_true', help='sets/resets the user id,pass and the api token')
|
| |
+
|
| |
+ email = subparsers.add_parser('email', help='email auth module')
|
| |
+ email.add_argument('--reset', action='store_true', help='sets/resets teh email adress')
|
| |
+ parser.add_argument('--config',
|
| |
+ #dest='configpath',
|
| |
+ #action='store',
|
| |
+ #type=string,
|
| |
+ default='config.ini',
|
| |
+ help='Sets config path')
|
| |
args = parser.parse_args(sys.argv[2:])
|
| |
- if args.auth:
|
| |
- print("Incomplete command,please specify the auth")
|
| |
+ configpath = args.config
|
| |
+ print(configpath) # debug only
|
| |
+ print(args) # debug only
|
| |
+ # print(args) # debug only
|
| |
if args.command == 'taiga':
|
| |
if args.token:
|
| |
- tauth.refresh_token()
|
| |
+ taiga_auth.refresh_token(args)
|
| |
elif args.reset:
|
| |
- tauth.reset()
|
| |
+ taiga_auth.reset(args)
|
| |
+ else:
|
| |
+ print("Wrong command")
|
| |
+ print(parser.print_help())
|
| |
+ elif args.command == 'pagure':
|
| |
+ if args.reset:
|
| |
+ pagure_auth.reset(args)
|
| |
+ else:
|
| |
+ print("Wrong command")
|
| |
+ print(parser.print_help())
|
| |
+ elif args.command == 'bugzilla':
|
| |
+ if args.token:
|
| |
+ bugzilla_auth.refresh_token(args)
|
| |
+ elif args.reset:
|
| |
+ bugzilla_auth.reset(args)
|
| |
+ else:
|
| |
+ print("Wrong command,please check documentation for the proper command")
|
| |
+ print(parser.print_help())
|
| |
+ elif args.command == 'email':
|
| |
+ if args.reset:
|
| |
+ mailauth.reset(args)
|
| |
+ else:
|
| |
+ print("Wrong Command check documentation")
|
| |
+ print(parser.print_help())
|
| |
+ else:
|
| |
+ print("Please Check the Documentation for the proper command or press --h for help")
|
| |
+ print(parser.print_help())
|
| |
+
|
| |
# print("Running the auth instance.....")
|
| |
# authenticate()
|
| |
-
|
| |
+
|
| |
def convert(self):
|
| |
+ """
|
| |
+ Convert is the only module
|
| |
+ that has directly mapped args to the module
|
| |
+ as we want to maintain the ability to use
|
| |
+ the convert functionality on its own and
|
| |
+ the way the multi[ple conversion is
|
| |
+ structured,prevents passing just the args
|
| |
+ as a whole.
|
| |
+ """
|
| |
parser = argparse.ArgumentParser(
|
| |
description='converts taiga issue to user story')
|
| |
parser.add_argument('--taiga',
|
| |
nargs='+',
|
| |
type=int,
|
| |
- help="Converts Issue to User Story")
|
| |
+ help='Converts Issue to User Story')
|
| |
+ parser.add_argument('--config',
|
| |
+ #dest='configpath',
|
| |
+ #action='store',
|
| |
+ #type=string,
|
| |
+ default='config.ini',
|
| |
+ help='Sets config path')
|
| |
+ args = parser.parse_args(sys.argv[2:])
|
| |
+ configpath = args.config
|
| |
+ print(configpath) # Debug only
|
| |
+ print(args) # debug only
|
| |
+ if args.command == 'taiga':
|
| |
+ convert.convert(args.taiga, args.config)
|
| |
+ elif args.command == 'help':
|
| |
+ print(parser.print_help())
|
| |
+ else:
|
| |
+ print("Wrong Command")
|
| |
+ print(parser.print_help())
|
| |
+
|
| |
+ def list(self):
|
| |
+ parser = argparse.ArgumentParser(
|
| |
+ description='announces to mailing list')
|
| |
+ #parser.add_argument('--list', help='runs the auth instance')
|
| |
+ subparsers = parser.add_subparsers(dest='command', help='sub-command help')
|
| |
+
|
| |
+ # list issues
|
| |
+ issue = subparsers.add_parser('issue', help='Lists issues')
|
| |
+ issue.add_argument('--pending', action='store_true', help='lists all the pending issues')
|
| |
+
|
| |
+ userstory = subparsers.add_parser('userstory', help='Lists user stories')
|
| |
+ userstory.add_argument('--pending', action='store_true', help='lists pending users stories')
|
| |
+ parser.add_argument('--config',
|
| |
+ #action='store',
|
| |
+ #type=string,
|
| |
+ #dest='configpath',
|
| |
+ default='config.ini',
|
| |
+ #required=False,
|
| |
+ help='Sets config path')
|
| |
+ args = parser.parse_args(sys.argv[2:])
|
| |
+ if args.command == 'issue':
|
| |
+ if args.pending:
|
| |
+ tgaissue.list_issue(args)
|
| |
+ else:
|
| |
+ print("wrong command")
|
| |
+ elif args.command == 'userstory':
|
| |
+ if args.pending:
|
| |
+ tguserstory.list_us(args)
|
| |
+ else:
|
| |
+ print("Wrong command")
|
| |
+ else:
|
| |
+ print("wrong command")
|
| |
+
|
| |
+ def announce(self):
|
| |
+ parser = argparse.ArgumentParser(
|
| |
+ description='announces to mailing list')
|
| |
+ parser.add_argument('--ml',
|
| |
+ nargs='+',
|
| |
+ type=int,
|
| |
+ help='Announces to Mailing list')
|
| |
+ parser.add_argument('--reply',
|
| |
+ #nargs='+',
|
| |
+ action='store_true',
|
| |
+ help="""Option to set reply to header
|
| |
+ if not set defaults reply to all recivers
|
| |
+ listed in config""")
|
| |
+ parser.add_argument('--config',
|
| |
+ #dest='configpath',
|
| |
+ #action='store',
|
| |
+ #type=string,
|
| |
+ default='config.ini',
|
| |
+ help='Sets config path')
|
| |
+ args = parser.parse_args(sys.argv[2:])
|
| |
+ configpath = args.config
|
| |
+ print(configpath)
|
| |
+ #print(args)
|
| |
+ print(args.reply)
|
| |
+ # print(args) # debug only
|
| |
+ #climail.mails(args.ml, args.reply, args.config)
|
| |
+ climail.mails(args)
|
| |
+
|
| |
+ def fesco(self):
|
| |
+ parser = argparse.ArgumentParser(
|
| |
+ description='Creates a Issue on fesco repo on pagure')
|
| |
+ parser.add_argument('--fesco',
|
| |
+ nargs='+',
|
| |
+ type=int,
|
| |
+ help='Announces to Fesco')
|
| |
+ parser.add_argument('--config',
|
| |
+ #dest='configpath',
|
| |
+ #action='store',
|
| |
+ #type=string,
|
| |
+ default='config.ini',
|
| |
+ help='Sets config path')
|
| |
+ args = parser.parse_args(sys.argv[2:])
|
| |
+ configpath = args.config
|
| |
+ print(configpath)
|
| |
+ print(args)
|
| |
+ # print(args) # debug only
|
| |
+ #fesco.fesissue(args.fesco, args.config)
|
| |
+ fesco.fesissue(args)
|
| |
+
|
| |
+ def accept(self):
|
| |
+ parser = argparse.ArgumentParser(
|
| |
+ description='announces to mailing list')
|
| |
+ parser.add_argument('--issue',
|
| |
+ nargs='+',
|
| |
+ type=int,
|
| |
+ #description='Issue No',
|
| |
+ help='Accepts the taiga change propsal issue')
|
| |
+ parser.add_argument('--config',
|
| |
+ #dest='configpath',
|
| |
+ #action='store',
|
| |
+ #type=string,
|
| |
+ default='config.ini',
|
| |
+ help='Sets User Defined Config path')
|
| |
+ args = parser.parse_args(sys.argv[2:])
|
| |
+ #configpath = args.config
|
| |
+ #print(configpath)
|
| |
+ #print(args)
|
| |
+ #print(args.reply)
|
| |
+ # print(args) # debug only
|
| |
+ #accept.accept(args.accept, args.config)
|
| |
+ accept.accept(args)
|
| |
+
|
| |
+ def update(self):
|
| |
+ parser = argparse.ArgumentParser(
|
| |
+ description='Syncing Between Bugzilla and Taiga')
|
| |
+
|
| |
+ parser.add_argument('--release',
|
| |
+ nargs='+',
|
| |
+ type=int,
|
| |
+ help='Syncing between bugzilla and taiga')
|
| |
+
|
| |
+ parser.add_argument('--config',
|
| |
+ #dest='configpath',
|
| |
+ #action='store',
|
| |
+ #type=string,
|
| |
+ default='config.ini',
|
| |
+ help='Sets config path')
|
| |
+ args = parser.parse_args(sys.argv[2:])
|
| |
+ #update.sync(args)
|
| |
+ update.update(args)
|
| |
+
|
| |
+ def create(self):
|
| |
+ parser = argparse.ArgumentParser(
|
| |
+ description='File a Change proposal from the cli')
|
| |
+ parser.add_argument('--config',
|
| |
+ default='config.ini',
|
| |
+ help='Sets config path')
|
| |
args = parser.parse_args(sys.argv[2:])
|
| |
- # print(args) # Debug only
|
| |
- convert(args)
|
| |
+ createprop.create(args)
|
| |
+
|
| |
+ """
|
| |
+ def config(self):
|
| |
+ parser = argparse.ArgumentParser(
|
| |
+ description='sets the user defined config')
|
| |
+ parser.add_argument('--config',
|
| |
+ action='store',
|
| |
+ type='string',
|
| |
+ dest='configPath',
|
| |
+ default='"%s/config.ini" % (expanduser("~))',
|
| |
+ help='configPath is set')
|
| |
+
|
| |
+ args = parser.parse_args(sys.argv[2:])
|
| |
+ """
|
| |
+ """
|
| |
+ def accept(self):
|
| |
+ parser = argparse.ArgumentParser(
|
| |
+ description='accepts the proposal and pushes to bugzilla')
|
| |
+ """
|
| |
|
| |
|
| |
if __name__ == "__main__":
|
| |
This pr shows the work done till final evaluation of gsoc,this is not the final status of the project and some more features,code cleanup is in progress that shall last beyond the timeline of gsoc.
Goals Accomplished :
Functionality to Accept the Change Proposals and automatically sync them with Pagure/Bugzilla
Functionality to Create proposals from the cli and a release engineering ticket as well
Sync with the mailing lists
Generate a Static HTML report on all the accepted proposals
Epic mapping Sync as per the attributes in proposals
Documentation both for The users and for further development/maintenance.
Much more smaller functionalities,issues as per the milestones/roadmap
https://www.pagure.io/fedora-change-wrangler/roadmap