rhjira 2.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
rhjira-2.1.0/LICENSE ADDED
@@ -0,0 +1,285 @@
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 2, June 1991
3
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
4
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+ Preamble
8
+ The licenses for most software are designed to take away your
9
+ freedom to share and change it. By contrast, the GNU General Public
10
+ License is intended to guarantee your freedom to share and change free
11
+ software--to make sure the software is free for all its users. This
12
+ General Public License applies to most of the Free Software
13
+ Foundation's software and to any other program whose authors commit to
14
+ using it. (Some other Free Software Foundation software is covered by
15
+ the GNU Lesser General Public License instead.) You can apply it to
16
+ your programs, too.
17
+ When we speak of free software, we are referring to freedom, not
18
+ price. Our General Public Licenses are designed to make sure that you
19
+ have the freedom to distribute copies of free software (and charge for
20
+ this service if you wish), that you receive source code or can get it
21
+ if you want it, that you can change the software or use pieces of it
22
+ in new free programs; and that you know you can do these things.
23
+ To protect your rights, we need to make restrictions that forbid
24
+ anyone to deny you these rights or to ask you to surrender the rights.
25
+ These restrictions translate to certain responsibilities for you if you
26
+ distribute copies of the software, or if you modify it.
27
+ For example, if you distribute copies of such a program, whether
28
+ gratis or for a fee, you must give the recipients all the rights that
29
+ you have. You must make sure that they, too, receive or can get the
30
+ source code. And you must show them these terms so they know their
31
+ rights.
32
+ We protect your rights with two steps: (1) copyright the software, and
33
+ (2) offer you this license which gives you legal permission to copy,
34
+ distribute and/or modify the software.
35
+ Also, for each author's protection and ours, we want to make certain
36
+ that everyone understands that there is no warranty for this free
37
+ software. If the software is modified by someone else and passed on, we
38
+ want its recipients to know that what they have is not the original, so
39
+ that any problems introduced by others will not reflect on the original
40
+ authors' reputations.
41
+ Finally, any free program is threatened constantly by software
42
+ patents. We wish to avoid the danger that redistributors of a free
43
+ program will individually obtain patent licenses, in effect making the
44
+ program proprietary. To prevent this, we have made it clear that any
45
+ patent must be licensed for everyone's free use or not licensed at all.
46
+ The precise terms and conditions for copying, distribution and
47
+ modification follow.
48
+ GNU GENERAL PUBLIC LICENSE
49
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
50
+ 0. This License applies to any program or other work which contains
51
+ a notice placed by the copyright holder saying it may be distributed
52
+ under the terms of this General Public License. The "Program", below,
53
+ refers to any such program or work, and a "work based on the Program"
54
+ means either the Program or any derivative work under copyright law:
55
+ that is to say, a work containing the Program or a portion of it,
56
+ either verbatim or with modifications and/or translated into another
57
+ language. (Hereinafter, translation is included without limitation in
58
+ the term "modification".) Each licensee is addressed as "you".
59
+
60
+ Activities other than copying, distribution and modification are not
61
+ covered by this License; they are outside its scope. The act of
62
+ running the Program is not restricted, and the output from the Program
63
+ is covered only if its contents constitute a work based on the
64
+ Program (independent of having been made by running the Program).
65
+ Whether that is true depends on what the Program does.
66
+ 1. You may copy and distribute verbatim copies of the Program's
67
+ source code as you receive it, in any medium, provided that you
68
+ conspicuously and appropriately publish on each copy an appropriate
69
+ copyright notice and disclaimer of warranty; keep intact all the
70
+ notices that refer to this License and to the absence of any warranty;
71
+ and give any other recipients of the Program a copy of this License
72
+ along with the Program.
73
+ You may charge a fee for the physical act of transferring a copy, and
74
+ you may at your option offer warranty protection in exchange for a fee.
75
+ 2. You may modify your copy or copies of the Program or any portion
76
+ of it, thus forming a work based on the Program, and copy and
77
+ distribute such modifications or work under the terms of Section 1
78
+ above, provided that you also meet all of these conditions:
79
+ a) You must cause the modified files to carry prominent notices
80
+ stating that you changed the files and the date of any change.
81
+ b) You must cause any work that you distribute or publish, that in
82
+ whole or in part contains or is derived from the Program or any
83
+ part thereof, to be licensed as a whole at no charge to all third
84
+ parties under the terms of this License.
85
+ c) If the modified program normally reads commands interactively
86
+ when run, you must cause it, when started running for such
87
+ interactive use in the most ordinary way, to print or display an
88
+ announcement including an appropriate copyright notice and a
89
+ notice that there is no warranty (or else, saying that you provide
90
+ a warranty) and that users may redistribute the program under
91
+ these conditions, and telling the user how to view a copy of this
92
+ License. (Exception: if the Program itself is interactive but
93
+ does not normally print such an announcement, your work based on
94
+ the Program is not required to print an announcement.)
95
+ These requirements apply to the modified work as a whole. If
96
+ identifiable sections of that work are not derived from the Program,
97
+ and can be reasonably considered independent and separate works in
98
+ themselves, then this License, and its terms, do not apply to those
99
+ sections when you distribute them as separate works. But when you
100
+ distribute the same sections as part of a whole which is a work based
101
+ on the Program, the distribution of the whole must be on the terms of
102
+ this License, whose permissions for other licensees extend to the
103
+ entire whole, and thus to each and every part regardless of who wrote it.
104
+ Thus, it is not the intent of this section to claim rights or contest
105
+ your rights to work written entirely by you; rather, the intent is to
106
+ exercise the right to control the distribution of derivative or
107
+ collective works based on the Program.
108
+ In addition, mere aggregation of another work not based on the Program
109
+ with the Program (or with a work based on the Program) on a volume of
110
+ a storage or distribution medium does not bring the other work under
111
+ the scope of this License.
112
+ 3. You may copy and distribute the Program (or a work based on it,
113
+ under Section 2) in object code or executable form under the terms of
114
+ Sections 1 and 2 above provided that you also do one of the following:
115
+ a) Accompany it with the complete corresponding machine-readable
116
+ source code, which must be distributed under the terms of Sections
117
+ 1 and 2 above on a medium customarily used for software interchange; or,
118
+
119
+ b) Accompany it with a written offer, valid for at least three
120
+ years, to give any third party, for a charge no more than your
121
+ cost of physically performing source distribution, a complete
122
+ machine-readable copy of the corresponding source code, to be
123
+ distributed under the terms of Sections 1 and 2 above on a medium
124
+ customarily used for software interchange; or,
125
+ c) Accompany it with the information you received as to the offer
126
+ to distribute corresponding source code. (This alternative is
127
+ allowed only for noncommercial distribution and only if you
128
+ received the program in object code or executable form with such
129
+ an offer, in accord with Subsection b above.)
130
+ The source code for a work means the preferred form of the work for
131
+ making modifications to it. For an executable work, complete source
132
+ code means all the source code for all modules it contains, plus any
133
+ associated interface definition files, plus the scripts used to
134
+ control compilation and installation of the executable. However, as a
135
+ special exception, the source code distributed need not include
136
+ anything that is normally distributed (in either source or binary
137
+ form) with the major components (compiler, kernel, and so on) of the
138
+ operating system on which the executable runs, unless that component
139
+ itself accompanies the executable.
140
+ If distribution of executable or object code is made by offering
141
+ access to copy from a designated place, then offering equivalent
142
+ access to copy the source code from the same place counts as
143
+ distribution of the source code, even though third parties are not
144
+ compelled to copy the source along with the object code.
145
+ 4. You may not copy, modify, sublicense, or distribute the Program
146
+ except as expressly provided under this License. Any attempt
147
+ otherwise to copy, modify, sublicense or distribute the Program is
148
+ void, and will automatically terminate your rights under this License.
149
+ However, parties who have received copies, or rights, from you under
150
+ this License will not have their licenses terminated so long as such
151
+ parties remain in full compliance.
152
+ 5. You are not required to accept this License, since you have not
153
+ signed it. However, nothing else grants you permission to modify or
154
+ distribute the Program or its derivative works. These actions are
155
+ prohibited by law if you do not accept this License. Therefore, by
156
+ modifying or distributing the Program (or any work based on the
157
+ Program), you indicate your acceptance of this License to do so, and
158
+ all its terms and conditions for copying, distributing or modifying
159
+ the Program or works based on it.
160
+ 6. Each time you redistribute the Program (or any work based on the
161
+ Program), the recipient automatically receives a license from the
162
+ original licensor to copy, distribute or modify the Program subject to
163
+ these terms and conditions. You may not impose any further
164
+ restrictions on the recipients' exercise of the rights granted herein.
165
+ You are not responsible for enforcing compliance by third parties to
166
+ this License.
167
+ 7. If, as a consequence of a court judgment or allegation of patent
168
+ infringement or for any other reason (not limited to patent issues),
169
+ conditions are imposed on you (whether by court order, agreement or
170
+ otherwise) that contradict the conditions of this License, they do not
171
+ excuse you from the conditions of this License. If you cannot
172
+ distribute so as to satisfy simultaneously your obligations under this
173
+ License and any other pertinent obligations, then as a consequence you
174
+ may not distribute the Program at all. For example, if a patent
175
+ license would not permit royalty-free redistribution of the Program by
176
+ all those who receive copies directly or indirectly through you, then
177
+ the only way you could satisfy both it and this License would be to
178
+ refrain entirely from distribution of the Program.
179
+ If any portion of this section is held invalid or unenforceable under
180
+
181
+ any particular circumstance, the balance of the section is intended to
182
+ apply and the section as a whole is intended to apply in other
183
+ circumstances.
184
+ It is not the purpose of this section to induce you to infringe any
185
+ patents or other property right claims or to contest validity of any
186
+ such claims; this section has the sole purpose of protecting the
187
+ integrity of the free software distribution system, which is
188
+ implemented by public license practices. Many people have made
189
+ generous contributions to the wide range of software distributed
190
+ through that system in reliance on consistent application of that
191
+ system; it is up to the author/donor to decide if he or she is willing
192
+ to distribute software through any other system and a licensee cannot
193
+ impose that choice.
194
+ This section is intended to make thoroughly clear what is believed to
195
+ be a consequence of the rest of this License.
196
+ 8. If the distribution and/or use of the Program is restricted in
197
+ certain countries either by patents or by copyrighted interfaces, the
198
+ original copyright holder who places the Program under this License
199
+ may add an explicit geographical distribution limitation excluding
200
+ those countries, so that distribution is permitted only in or among
201
+ countries not thus excluded. In such case, this License incorporates
202
+ the limitation as if written in the body of this License.
203
+ 9. The Free Software Foundation may publish revised and/or new versions
204
+ of the General Public License from time to time. Such new versions will
205
+ be similar in spirit to the present version, but may differ in detail to
206
+ address new problems or concerns.
207
+ Each version is given a distinguishing version number. If the Program
208
+ specifies a version number of this License which applies to it and "any
209
+ later version", you have the option of following the terms and conditions
210
+ either of that version or of any later version published by the Free
211
+ Software Foundation. If the Program does not specify a version number of
212
+ this License, you may choose any version ever published by the Free Software
213
+ Foundation.
214
+ 10. If you wish to incorporate parts of the Program into other free
215
+ programs whose distribution conditions are different, write to the author
216
+ to ask for permission. For software which is copyrighted by the Free
217
+ Software Foundation, write to the Free Software Foundation; we sometimes
218
+ make exceptions for this. Our decision will be guided by the two goals
219
+ of preserving the free status of all derivatives of our free software and
220
+ of promoting the sharing and reuse of software generally.
221
+ NO WARRANTY
222
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
223
+ FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
224
+ OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
225
+ PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
226
+ OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
227
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
228
+ TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
229
+ PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
230
+ REPAIR OR CORRECTION.
231
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
232
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
233
+ REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
234
+ INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
235
+ OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
236
+ TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
237
+ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
238
+ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
239
+ POSSIBILITY OF SUCH DAMAGES.
240
+ END OF TERMS AND CONDITIONS
241
+
242
+ How to Apply These Terms to Your New Programs
243
+ If you develop a new program, and you want it to be of the greatest
244
+ possible use to the public, the best way to achieve this is to make it
245
+ free software which everyone can redistribute and change under these terms.
246
+ To do so, attach the following notices to the program. It is safest
247
+ to attach them to the start of each source file to most effectively
248
+ convey the exclusion of warranty; and each file should have at least
249
+ the "copyright" line and a pointer to where the full notice is found.
250
+ <one line to give the program's name and a brief idea of what it does.>
251
+ Copyright (C) <year> <name of author>
252
+ This program is free software; you can redistribute it and/or modify
253
+ it under the terms of the GNU General Public License as published by
254
+ the Free Software Foundation; either version 2 of the License, or
255
+ (at your option) any later version.
256
+ This program is distributed in the hope that it will be useful,
257
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
258
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
259
+ GNU General Public License for more details.
260
+ You should have received a copy of the GNU General Public License along
261
+ with this program; if not, write to the Free Software Foundation, Inc.,
262
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
263
+ Also add information on how to contact you by electronic and paper mail.
264
+ If the program is interactive, make it output a short notice like this
265
+ when it starts in an interactive mode:
266
+ Gnomovision version 69, Copyright (C) year name of author
267
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
268
+ This is free software, and you are welcome to redistribute it
269
+ under certain conditions; type `show c' for details.
270
+ The hypothetical commands `show w' and `show c' should show the appropriate
271
+ parts of the General Public License. Of course, the commands you use may
272
+ be called something other than `show w' and `show c'; they could even be
273
+ mouse-clicks or menu items--whatever suits your program.
274
+ You should also get your employer (if you work as a programmer) or your
275
+ school, if any, to sign a "copyright disclaimer" for the program, if
276
+ necessary. Here is a sample; alter the names:
277
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
278
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
279
+ <signature of Ty Coon>, 1 April 1989
280
+ Ty Coon, President of Vice
281
+ This General Public License does not permit incorporating your program into
282
+ proprietary programs. If your program is a subroutine library, you may
283
+ consider it more useful to permit linking proprietary applications with the
284
+ library. If this is what you want to do, use the GNU Lesser General
285
+ Public License instead of this License.
rhjira-2.1.0/PKG-INFO ADDED
@@ -0,0 +1,32 @@
1
+ Metadata-Version: 2.4
2
+ Name: rhjira
3
+ Version: 2.1.0
4
+ Summary: CLI for Red Hat Jira (https://issues.redhat.com)
5
+ Author-email: Prarit Bhargava <prarit@redhat.com>
6
+ Maintainer-email: Prarit Bhargava <prarit@redhat.com>
7
+ License-Expression: GPL-2.0-or-later
8
+ Project-URL: Homepage, https://gitlab.com/prarit/rhjira-python
9
+ Keywords: redhat,jira
10
+ Requires-Python: >=3.11
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: keyring
14
+ Requires-Dist: jira>=3.2.0
15
+ Requires-Dist: requests>=2.0.0
16
+ Requires-Dist: pillow>=8.0.0
17
+ Requires-Dist: tabulate
18
+ Dynamic: license-file
19
+
20
+ rhjira-python is a utility and library that provides functionality to interact with Red Hat's Jira, https://issues.redhat.com. The functionality in this project currently supports creating, editing, commenting on, and the displaying of jiras.
21
+
22
+ Token Configuration
23
+
24
+ rhjira-python requires a Jira Token (https://issues.redhat.com/secure/ViewProfile.jspa). The token can be exported as JIRA_TOKEN, however it is recommended users execute 'rhjira settoken' to store their token in their keyring. This is more secure than keeping the token in clear text and using JIRA_TOKEN.
25
+
26
+ Tokens can be removed from the keyring by simply removing the 'rhjira' entry. In the commonly used seahorse application, this can be done by removing the 'Password for '{username}' on 'rhjira'' entry.
27
+
28
+ Help
29
+
30
+ All commands are supported via --help. For example, to get help on the comment command, execute "rhjira comment --help".
31
+
32
+ Problems found with rhjira-python can be reported at https://gitlab.com/prarit/rhjira-python/-/issues. As with all my projects, merge requests are welcomed!
rhjira-2.1.0/README.md ADDED
@@ -0,0 +1,13 @@
1
+ rhjira-python is a utility and library that provides functionality to interact with Red Hat's Jira, https://issues.redhat.com. The functionality in this project currently supports creating, editing, commenting on, and the displaying of jiras.
2
+
3
+ Token Configuration
4
+
5
+ rhjira-python requires a Jira Token (https://issues.redhat.com/secure/ViewProfile.jspa). The token can be exported as JIRA_TOKEN, however it is recommended users execute 'rhjira settoken' to store their token in their keyring. This is more secure than keeping the token in clear text and using JIRA_TOKEN.
6
+
7
+ Tokens can be removed from the keyring by simply removing the 'rhjira' entry. In the commonly used seahorse application, this can be done by removing the 'Password for '{username}' on 'rhjira'' entry.
8
+
9
+ Help
10
+
11
+ All commands are supported via --help. For example, to get help on the comment command, execute "rhjira comment --help".
12
+
13
+ Problems found with rhjira-python can be reported at https://gitlab.com/prarit/rhjira-python/-/issues. As with all my projects, merge requests are welcomed!
@@ -0,0 +1,27 @@
1
+ [build-system]
2
+ requires = ["setuptools"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "rhjira"
7
+ version = "2.1.0"
8
+ description = "CLI for Red Hat Jira (https://issues.redhat.com)"
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ license = "GPL-2.0-or-later"
12
+ keywords = ["redhat", "jira"]
13
+ authors = [{ name = "Prarit Bhargava", email = "prarit@redhat.com" }]
14
+ maintainers = [{ name = "Prarit Bhargava", email = "prarit@redhat.com" }]
15
+ dependencies = [
16
+ "keyring",
17
+ "jira>=3.2.0",
18
+ "requests>=2.0.0",
19
+ "pillow>=8.0.0",
20
+ "tabulate"
21
+ ]
22
+
23
+ [project.urls]
24
+ "Homepage" = "https://gitlab.com/prarit/rhjira-python"
25
+
26
+ [project.scripts]
27
+ rhjira = "rhjira.cli:main"
rhjira-2.1.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,11 @@
1
+ from .comment import comment
2
+ from .create import create
3
+ from .dump import dump
4
+ from .edit import edit
5
+ from .list import list
6
+ from .login import login, setpassword
7
+ from .show import show
8
+ from .cli import main
9
+
10
+ def main():
11
+ cli.main()
@@ -0,0 +1,56 @@
1
+ import rhjira
2
+ import pprint
3
+ import sys
4
+
5
+ from jira import JIRAError
6
+
7
+ def usage():
8
+ print("Usage:")
9
+ print(" rhjira [flags] [command]")
10
+ print(" ")
11
+ print("Available Commands:")
12
+ print(" comment Comment on a jira ticket on https://issues.redhat.com")
13
+ print(" create Create a jira ticket on https://issues.redhat.com")
14
+ print(" dump Dump jira issue variables.")
15
+ print(" edit Edit a jira ticket on https://issues.redhat.com")
16
+ print(" help Help about any command")
17
+ print(" list list issues")
18
+ print(" show Edit a jira ticket on https://issues.redhat.com")
19
+ print(" settoken Save a jira token to the keyring (more secure than using $JIRA_TOKEN)")
20
+ print(" ")
21
+ print("For help on individual commands, execute rhjira [command] --help")
22
+ sys.exit(1)
23
+
24
+ def main():
25
+ if len(sys.argv) <= 1:
26
+ usage()
27
+
28
+ if sys.argv[1] != "settoken":
29
+ try:
30
+ jira = rhjira.login()
31
+ except JIRAError as e:
32
+ print(f"Jira login failed: {e.status_code} {e.text}")
33
+ sys.exit(1)
34
+
35
+ match sys.argv[1]:
36
+ case "comment":
37
+ rhjira.comment(jira)
38
+ case "close":
39
+ rhjira.edit(jira)
40
+ case "create":
41
+ rhjira.create(jira)
42
+ case "dump":
43
+ rhjira.dump(jira)
44
+ case "edit":
45
+ rhjira.edit(jira)
46
+ case "list":
47
+ rhjira.list(jira)
48
+ case "settoken":
49
+ rhjira.setpassword()
50
+ case "show":
51
+ rhjira.show(jira)
52
+ case _:
53
+ usage()
54
+
55
+ if __name__ == "__main__":
56
+ main()
@@ -0,0 +1,71 @@
1
+ import argparse
2
+ import os
3
+ import sys
4
+
5
+ from jira import JIRAError
6
+ from rhjira import login, util
7
+
8
+
9
+ def comment(jira):
10
+ # handle arguments
11
+ sys.argv.remove("comment")
12
+ parser = argparse.ArgumentParser(description="Comment on an RH jira ticket")
13
+ parser.add_argument("-f", "--file", type=str, help="file containing comment")
14
+ parser.add_argument(
15
+ "--noeditor",
16
+ action="store_true",
17
+ help="when set the editor will not be invoked",
18
+ )
19
+ parser.add_argument("ticketID", nargs=argparse.REMAINDER)
20
+ args = parser.parse_args()
21
+
22
+ if len(args.ticketID) != 1:
23
+ print("Error: ticketID not clear or found (ticketID must be last argument)")
24
+ sys.exit(1)
25
+
26
+ filename = args.file
27
+ noeditor = args.noeditor
28
+
29
+ ticketID = args.ticketID[0]
30
+
31
+ if jira == None:
32
+ try:
33
+ jira = login.login()
34
+ except JIRAError as e:
35
+ print(f"Jira login failed: {e.status_code} {e.text}")
36
+ sys.exit(1)
37
+
38
+ try:
39
+ issue = jira.issue(ticketID)
40
+ util.rhjiratax()
41
+ except JIRAError as e:
42
+ print(f"Jira lookup for {ticketID} failed: {e.status_code} {e.text}")
43
+ sys.exit(1)
44
+
45
+ editorText = "# Lines beginning with '#' will be ignored"
46
+ if filename:
47
+ # read the saved contents of $filename
48
+ try:
49
+ with open(filename, "r") as file:
50
+ editorText = file.read()
51
+ except Exception as error:
52
+ print(f"Unable to open {args.template}")
53
+ sys.exit(1)
54
+
55
+ savedText = editorText
56
+ if not args.noeditor:
57
+ savedText = util.editFile("rhjira", editorText)
58
+ if len(savedText) == 0:
59
+ print("Empty comment buffer ... aborting.")
60
+ os.Exit(1)
61
+
62
+ try:
63
+ jira.add_comment(ticketID, savedText)
64
+ except JIRAError as e:
65
+ print(f"Failed to add comment to {ticketID}: {e.status_code} {e.text}")
66
+ print("")
67
+ print("Comment text:")
68
+ print(savedText)
69
+ sys.exit(1)
70
+
71
+ print(f"https://issues.redhat.com/browse/{ticketID}")