10
10
from requests .auth import HTTPBasicAuth
11
11
12
12
class Environment :
13
- def __init__ (self , jira_base_url , jira_username , jira_api_key , jira_server_pat , action ,
13
+ def __init__ (self , jira_base_url , jira_username , jira_api_key , action ,
14
14
issue , issue_project , issue_summary , issue_description , issue_type , issue_components , issue_customfields ,
15
15
existing_comment_id , comment_body , status , jql_query , jql_query_max_results ,
16
16
verbose ):
17
17
self .jira_base_url = jira_base_url
18
18
self .jira_username = jira_username
19
19
self .jira_api_key = jira_api_key
20
- self .jira_server_pat = jira_server_pat
21
20
self .action = action
22
21
self .issue = issue
23
22
self .issue_project = issue_project
@@ -33,23 +32,9 @@ def __init__(self, jira_base_url, jira_username, jira_api_key, jira_server_pat,
33
32
self .jql_query_max_results = jql_query_max_results
34
33
self .verbose = verbose
35
34
36
- def valudate_input (current_environment ):
37
- if not current_environment .jira_api_key and current_environment .jira_username :
38
- raise Exception ('JIRA_API_KEY required for basic authentication' )
39
-
40
- if current_environment .jira_api_key and not current_environment .jira_username :
41
- raise Exception ('JIRA_USERNAME required for basic authentication' )
42
-
43
- if not current_environment .jira_api_key and not current_environment .jira_server_pat :
44
- raise Exception ('Credentials not provided' )
45
-
46
- if current_environment .jira_api_key and current_environment .jira_server_pat :
47
- raise Exception ('Only one of JIRA_API_KEY and JIRA_SERVER_PAT allowed' )
48
-
49
35
50
36
def main ():
51
37
current_environment = environment_setup ()
52
- valudate_input (current_environment )
53
38
authenticated_jira = authentication (current_environment )
54
39
step_action (current_environment .action , authenticated_jira , current_environment )
55
40
@@ -60,7 +45,6 @@ def environment_setup():
60
45
jira_base_url = StepUtility .getEnvironmentVariable ('JIRA_BASE_URL' , env )
61
46
jira_username = StepUtility .getEnvironmentVariable ('JIRA_USERNAME' , env )
62
47
jira_api_key = StepUtility .getEnvironmentVariable ('JIRA_API_KEY' , env )
63
- jira_server_pat = StepUtility .getEnvironmentVariable ('JIRA_SERVER_PAT' , env )
64
48
action = StepUtility .getEnvironmentVariable ('ACTION' , env )
65
49
66
50
# Logic here to use the regex to grab the jira issue key and assign it to issue
@@ -116,7 +100,6 @@ def environment_setup():
116
100
jira_base_url ,
117
101
jira_username ,
118
102
jira_api_key ,
119
- jira_server_pat ,
120
103
action ,
121
104
issue ,
122
105
issue_project ,
@@ -135,14 +118,6 @@ def environment_setup():
135
118
136
119
137
120
def authentication (current_environment ):
138
- if current_environment .jira_server_pat :
139
- # Jira Server authentication with a PAT
140
- jira = JIRA (
141
- current_environment .jira_base_url ,
142
- token_auth = current_environment .jira_server_pat
143
- )
144
- return jira
145
-
146
121
# Basic authentication with an API Token
147
122
jira = JIRA (
148
123
current_environment .jira_base_url ,
0 commit comments