From d14c1a5e158328614793c38a3dcc77b14d35c0c9 Mon Sep 17 00:00:00 2001 From: Manas Date: Jun 26 2019 15:01:30 +0000 Subject: keyring issues fixed with pagure --- diff --git a/config.ini b/config.ini index 125a458..4528088 100644 --- a/config.ini +++ b/config.ini @@ -57,16 +57,15 @@ RELEASE_NOTES_REPO = Test-for-Release-Notes SERVICE_ID = bugzilla SERVICE_TOKEN = bugzilla_auth PROJECT_ID = 315827 # for test only -BUGZILLA_URL = https://bugzilla.redhat.com/ +BUGZILLA_URL = https://bugzilla.redhat.com/xmlrpc.cgi ; TEST = no [EMAIL] SERVICE_ID = email SENDER_EMAIL_ID = manasmangaonkar@gmail.com -LIST: ["manas.man95@gmail.com","ttim3886@gmail.com"] +LIST: ["bcotton@funnelfiasco.com","bcotton@redhat.com"] ; LIST: [devel@lists.fedoraproject.org,devel-announce@lists.fedoraproject.org] PORT = 465 SMTP_SERVER = smtp.gmail.com ; TEST = yes ; 1892835 - diff --git a/pgure/fesco.py b/pgure/fesco.py index 4d133e0..3e3c97b 100644 --- a/pgure/fesco.py +++ b/pgure/fesco.py @@ -19,13 +19,15 @@ else: """ -def fesissue(args, configpath): +def fesissue(args): + configpath = args.config config = configparser.ConfigParser() config.read(configpath) service_id = config['TAIGA']['SERVICE_ID'] # service id service_token = config['TAIGA']['SERVICE_TOKEN'] project_id = config['TAIGA']['PROJECT_ID'] - for x in args: # iteratingover name space object + value = args.fesco + for x in value: # iteratingover name space object try: r = tgaissue.get_issue(x, config) # x is user story refrence id if r.status_code == 200: diff --git a/pgure/issues.py b/pgure/issues.py index 60e0c64..9b8131c 100644 --- a/pgure/issues.py +++ b/pgure/issues.py @@ -66,10 +66,10 @@ def post_issue(payload, repo, config): #print(repo_name) headers = { 'Content-Type': 'application/json', - 'Authorization': 'token {0}'.format(keyring.get_password(config['PAGURE']['SERVICE_ID'], "repo_name")) + 'Authorization': 'token {0}'.format(keyring.get_password(config['PAGURE']['SERVICE_ID'], repo)) } print(headers) - url = str(config['PAGURE']['API_URL']) + '/' + repo + '/new_issue' + url = str(config['PAGURE']['API_URL']) + repo + '/new_issue' #print(data) # debug only print(url) print(payload) diff --git a/pgure/pagure_auth.py b/pgure/pagure_auth.py index cf26169..3d5d547 100644 --- a/pgure/pagure_auth.py +++ b/pgure/pagure_auth.py @@ -8,18 +8,21 @@ import getpass import configparser -def reset(configpath): +def reset(args): + configpath = args.config config = configparser.ConfigParser() config.read(configpath) print("Your auth token will be securly store in the Keyring") # username = input("Enter your user id for taiga: ") service_id = config['PAGURE']['SERVICE_ID'] - repo_name = input("Enter the repo name you want to set api key for: ") - token = getpass.getpass("Enter your token for" + ' ' + repo_name + ' ' "repository: ") + #repo_name = input("Enter the repo name you want to set api key for: ") + fescotoken = getpass.getpass("Enter your token for" + ' ' + "fesco" + ' ' "repository: ") + releasetoken = getpass.getpass("Enter your token for" + ' ' + "release-notes" + ' ' "repository: ") try: # keyring.set_password("taiga", username) - keyring.set_password(service_id, "repo_name", repo_name) - keyring.set_password(service_id, repo_name, str(token)) + #keyring.set_password(service_id, "repo_name", repo_name) + keyring.set_password(service_id, config['PAGURE']['FESCO_REPO'], str(fescotoken)) + keyring.set_password(service_id, config['PAGURE']['RELEASE_NOTES_REPO'], str(releasetoken)) print("token reset succesfully") except (keyring.errors.PasswordSetError, Exception) as e: print("Failed to reset token")