Code Monkey home page Code Monkey logo

jirash's Introduction

A limited JIRA CLI. Get an issue. Create an issue. Update project versions. Etc.

Install

npm install -g jirash
jirash --version

This supports Bash completion. Install it something like this:

# Mac
jirash completion > /usr/local/etc/bash_completion.d/jirash \
    && source /usr/local/etc/bash_completion.d/jirash

# Linux
sudo jirash completion > /etc/bash_completion.d/jirash \
    && source /etc/bash_completion.d/jirash

Config

First you need a config file with Jira URL and auth info:

$ cat ~/.jirash.json
{
    "jira_url": "https://jira.example.com",
    "jira_username": "joe.blow",
    "jira_password": "secret"
}

Usage

List available commands:

$ jirash help
Usage:
    jirash COMMAND [ARGS...]
    jirash help [COMMAND]
...
Commands:
...
    issue       Search, get, and create JIRA issues.
...

Some examples follow. Get info on an issue:

$ jirash issue get IMGAPI-654
IMGAPI-654 IMGAPI ExportImage when basename(MANTA_PATH) doesn't exist is (a) wrong and (b) unhelpful (trent.mick -> <unassigned>, Bug, 4 - Normal, Open)

A shortcut for that:

$ jirash IMGAPI-654

A full JSON dump of REST API data for the issue:

$ jirash issue get -j IMGAPI-654
{
    "id": "64401",
    "self": "https://jira.joyent.us/rest/api/2/issue/64401",
    "key": "IMGAPI-654",
    "fields": {
...

List your favourite filters (saved issue searches):

$ jirash filter ls
ID     NAME                                       OWNER.NAME
10644  ADMINUI: open issues                       trent.mick
10580  AGENT: open issues                         trent.mick
10577  All issues                                 trent.mick
...

List issues in a filter:

$ jirash issue ls AGENT
KEY         SUMMARYCLIPPED                            ASSIGNEE     REPORTER    P  STAT  CREATED     UPDATED
AGENT-1083  Want auto.DATACENTER_NAME in config-ageÉ  cody.mello   cody.mello  4  Open  2017-09-26  2017-09-26
AGENT-1081  config-agent could use one-shot mode foÉ  dap          dap         3  Open  2017-08-01  2017-08-01
AGENT-1080  hagfish-watcher should use sdcnode        josh.clulow  trent.mick  4  Open  2017-07-14  2017-07-14
...

Edit an issue:

This is less user-friendly than other commands, but allows you more control
over editing issues. For more information on JSON accepted, see the Jira API
docs:
https://docs.atlassian.com/software/jira/docs/api/REST/7.4.2/#api/2/issue-editIssue

$ jirash issue edit TRITON-1140 '{"labels": [{"add": "lullaby-phase2"}]}'

Configuration Reference

Configuration is via a JSON file at "~/.jirash.json". Example:

{
    "jira_url": "https://dev.example.com/jira",
    "jira_username": "joe.blow",
    "jira_password": "secret"
}

The possible config vars are:

  • jira_url The base Jira URL. This or jirash -J <jira-url> ... is required.
  • jira_username Required. The Jira username with which to auth.
  • jira_password Required. The password for the given Jira username.

Module Usage

There is a lib/jirashapi.js that is a reasonable REST API wrapper, albeit with coverage of very little of the JIRA REST API.

var JirashApi = require('jirash').JirashApi;

var config = require('/Users/trentm/.jirash.json');
var api = new JirashApi({config: config});

api.getIssue('IMGAPI-654', function (err, issue) {
    if (err) {
        // Handle `err`.
    }
    console.log(issue);
        // { id: '64401',
        //  self: 'https://jira.joyent.us/rest/api/2/issue/64401',
        //  key: 'IMGAPI-654',
        //  fields:
        //  ...
});

Development

There is automated code formatting (using eslint --fix and prettier):

make fmt

There is lint/style checking (using eslint and prettier --list-different):

make check

Please be sure to run all of the above prior to submitting changes. One easy way to remember that is to run the following once for a clone to run them automatically prior to git commit:

make git-hooks

Sadly, there is not yet a test suite (no make test).

License

MIT. See the LICENSE.txt file.

jirash's People

Contributors

inno avatar jacques avatar trentm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jirash's Issues

Failures With Listing Issues: "ExpatError: reference to invalid character number"

Hi Trent,

Hitting this failure when trying to list out issues - the full run with both the numeric filter ID and the actual filter name are below.

Jay

 jschmidt@scrat  ~/repos/jirash/bin   master  ./jirash issues -f 10938

Traceback (most recent call last):
  File "/Users/jschmidt/repos/jirash/lib/jirashell.py", line 1297, in <module>
    retval = main(sys.argv)
  File "/Users/jschmidt/repos/jirash/lib/jirashell.py", line 1292, in main
    return shell.main(argv, loop=cmdln.LOOP_IF_EMPTY)
  File "/Users/jschmidt/repos/jirash/lib/cmdln.py", line 259, in main
    return self.cmd(args)
  File "/Users/jschmidt/repos/jirash/lib/cmdln.py", line 277, in cmd
    retval = self.onecmd(argv)
  File "/Users/jschmidt/repos/jirash/lib/cmdln.py", line 412, in onecmd
    return self._dispatch_cmd(handler, argv)
  File "/Users/jschmidt/repos/jirash/lib/cmdln.py", line 1115, in _dispatch_cmd
    return handler(argv[0], opts, *args)
  File "/Users/jschmidt/repos/jirash/lib/jirashell.py", line 721, in do_issues
    issues = self.jira.issues_from_filter(opts.filter)
  File "/Users/jschmidt/repos/jirash/lib/jirashell.py", line 278, in issues_from_filter
    return self.server.jira1.getIssuesFromFilter(self.auth, filterObj["id"])
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1240, in __call__
    return self.__send(self.__name, args)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1599, in __request
    verbose=self.__verbose
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1280, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1313, in single_request
    return self.parse_response(response)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1484, in parse_response
    p.feed(data)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 558, in feed
    self._parser.Parse(data, 0)
ExpatError: reference to invalid character number: line 1771, column 0

Python: 2.7.10 (default, Aug 22 2015, 20:33:39)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.1)]
OS: Darwin-15.0.0-x86_64-i386-64bit

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* If this is obviously not user error, please log a bug at  *
*    https://github.com/trentm/jirash/issues                *
* to report this error. Thanks!                             *
* -- Trent                                                  *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 ✘ jschmidt@scrat  ~/repos/jirash/bin   master 
 ✘ jschmidt@scrat  ~/repos/jirash/bin   master  ./jirash issues -f "On-Prem Issues"

Traceback (most recent call last):
  File "/Users/jschmidt/repos/jirash/lib/jirashell.py", line 1297, in <module>
    retval = main(sys.argv)
  File "/Users/jschmidt/repos/jirash/lib/jirashell.py", line 1292, in main
    return shell.main(argv, loop=cmdln.LOOP_IF_EMPTY)
  File "/Users/jschmidt/repos/jirash/lib/cmdln.py", line 259, in main
    return self.cmd(args)
  File "/Users/jschmidt/repos/jirash/lib/cmdln.py", line 277, in cmd
    retval = self.onecmd(argv)
  File "/Users/jschmidt/repos/jirash/lib/cmdln.py", line 412, in onecmd
    return self._dispatch_cmd(handler, argv)
  File "/Users/jschmidt/repos/jirash/lib/cmdln.py", line 1115, in _dispatch_cmd
    return handler(argv[0], opts, *args)
  File "/Users/jschmidt/repos/jirash/lib/jirashell.py", line 721, in do_issues
    issues = self.jira.issues_from_filter(opts.filter)
  File "/Users/jschmidt/repos/jirash/lib/jirashell.py", line 278, in issues_from_filter
    return self.server.jira1.getIssuesFromFilter(self.auth, filterObj["id"])
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1240, in __call__
    return self.__send(self.__name, args)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1599, in __request
    verbose=self.__verbose
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1280, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1313, in single_request
    return self.parse_response(response)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1484, in parse_response
    p.feed(data)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 558, in feed
    self._parser.Parse(data, 0)
ExpatError: reference to invalid character number: line 1771, column 0

Python: 2.7.10 (default, Aug 22 2015, 20:33:39)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.1)]
OS: Darwin-15.0.0-x86_64-i386-64bit

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* If this is obviously not user error, please log a bug at  *
*    https://github.com/trentm/jirash/issues                *
* to report this error. Thanks!                             *
* -- Trent                                                  *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

Support the default filters from Jira

Currently there is no way to pass a negative filter id or pass 'My open issues'.

zsh/2 5213 [1]  (git)-[master]-% jirash issue ls '-1'
jirash issue ls: error: unknown option: "-1"
usage: jirash issue ls [ --help | -h ] [ -H ] [ -o field1,... ] [ --long | -l ]
    [ -s field1,... ] [ --json | -j ] ...
zsh/2 5215 [1]  (git)-[master]-% jirash issue ls 'My open issues'
jirash issue ls: error: no favourite filter names match "My open issues"

Creating a JIRA issue with "createissue" is causing an error with python

Following is the way I tried to create a JIRA on a Mountain Lion python:

$ jirash createissue PROJ my-subject-line
Assignee (blank for default, 'me' for yourself): John Doe
Description (use '.' on a line by itself to finish):
....

.

Following is the python error:

>jirash: ERROR: 'ascii' codec can't decode byte 0xe2 in position 548: ordinal not in range(128) (/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py:809 in _send_output)
()
Traceback (most recent call last):
  File "/Users/drende/opt/jirash/lib/jirashell.py", line 823, in <module>
    retval = main(sys.argv)
  File "/Users/drende/opt/jirash/lib/jirashell.py", line 817, in main
    return shell.main(argv, loop=cmdln.LOOP_IF_EMPTY)
  File "/Users/drende/opt/jirash/lib/cmdln.py", line 259, in main
    return self.cmd(args)
  File "/Users/drende/opt/jirash/lib/cmdln.py", line 277, in cmd
    retval = self.onecmd(argv)
  File "/Users/drende/opt/jirash/lib/cmdln.py", line 412, in onecmd
    return self._dispatch_cmd(handler, argv)
  File "/Users/drende/opt/jirash/lib/cmdln.py", line 1115, in _dispatch_cmd
    return handler(argv[0], opts, *args)
  File "/Users/drende/opt/jirash/lib/jirashell.py", line 685, in do_createissue
    issue = self.jira.create_issue(data)
  File "/Users/drende/opt/jirash/lib/jirashell.py", line 340, in create_issue
    return self.server.jira1.createIssue(self.auth, data)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1224, in __call__
    return self.__send(self.__name, args)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1575, in __request
    verbose=self.__verbose
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1264, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1292, in single_request
    self.send_content(h, request_body)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1439, in send_content
    connection.endheaders(request_body)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 951, in endheaders
    self._send_output(message_body)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 809, in _send_output
    msg += message_body
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 548: ordinal not in range(128)

jirash createissue blows up on an exact match of `-t ARG` to an issue type

Traceback (most recent call last):
  File "/Users/trentm/tm/jirash/lib/jirashell.py", line 1206, in <module>
    retval = main(sys.argv)
  File "/Users/trentm/tm/jirash/lib/jirashell.py", line 1201, in main
    return shell.main(argv, loop=cmdln.LOOP_IF_EMPTY)
  File "/Users/trentm/tm/jirash/lib/cmdln.py", line 259, in main
    return self.cmd(args)
  File "/Users/trentm/tm/jirash/lib/cmdln.py", line 277, in cmd
    retval = self.onecmd(argv)
  File "/Users/trentm/tm/jirash/lib/cmdln.py", line 412, in onecmd
    return self._dispatch_cmd(handler, argv)
  File "/Users/trentm/tm/jirash/lib/cmdln.py", line 1115, in _dispatch_cmd
    return handler(argv[0], opts, *args)
  File "/Users/trentm/tm/jirash/lib/jirashell.py", line 928, in do_createissue
    data["type"] = int(it.id)
AttributeError: 'dict' object has no attribute 'id'

jirash blows up when resolving a ticket that's already resolved.

jirash resolve OS-1670
()
Traceback (most recent call last):
 File "/home/mcavage/work/jirash/lib/jirashell.py", line 986, in <module>
   retval = main(sys.argv)
 File "/home/mcavage/work/jirash/lib/jirashell.py", line 981, in main
   return shell.main(argv, loop=cmdln.LOOP_IF_EMPTY)
 File "/home/mcavage/work/jirash/lib/cmdln.py", line 259, in main
   return self.cmd(args)
 File "/home/mcavage/work/jirash/lib/cmdln.py", line 277, in cmd
   retval = self.onecmd(argv)
 File "/home/mcavage/work/jirash/lib/cmdln.py", line 412, in onecmd
   return self._dispatch_cmd(handler, argv)
 File "/home/mcavage/work/jirash/lib/cmdln.py", line 1115, in _dispatch_cmd
   return handler(argv[0], opts, *args)
 File "/home/mcavage/work/jirash/lib/jirashell.py", line 809, in do_resolve
   self.jira.resolve(key)
 File "/home/mcavage/work/jirash/lib/jirashell.py", line 358, in resolve
   res = self._jira_soap_call("progressWorkflowAction", [key, "5"])
 File "/home/mcavage/work/jirash/lib/jirashell.py", line 97, in _jira_soap_call
   out = getattr(server, methodName)(*authedArgs)
 File "/home/mcavage/work/jirash/deps/SOAPpy/Client.py", line 540, in __call__
   return self.__r_call(*args, **kw)
 File "/home/mcavage/work/jirash/deps/SOAPpy/Client.py", line 562, in __r_call
   self.__hd, self.__ma)
 File "/home/mcavage/work/jirash/deps/SOAPpy/Client.py", line 475, in __call
   raise p
faultType: <Fault soapenv:Server.userException: com.atlassian.jira.rpc.exception.RemoteException: Error occurred when running workflow action Resolve Issue: 
Errors: {}
Error Messages: [Action 5 is invalid]: <SOAPpy.Types.structType detail at 150378284>: {'hostname': 'devhub', 'com.atlassian.jira.rpc.exception.RemoteException': ''}>

Python: 2.7.2 (default, Mar 23 2012, 13:45:04) 
[GCC 4.6.2]
OS: ('SunOS', 'martin', '5.11', 'joyent_20120921T180038Z', 'i86pc')

* * * * * * * * * * * * * * * * * * * * * * * *
* Please log a bug at                         *
*    https://github.com/trentm/jirash/issues  *
* to report this error. Thanks!               *
* -- Trent                                    *
* * * * * * * * * * * * * * * * * * * * * * * *

License?

What's the license on those files?

Thanks.

boom in createissue without an assignee

$ jirash -d createissue CNAPI trent is testing here
Assignee (blank for default, 'me' for yourself): 
Description (use '.' on a line by itself to finish):
testing jirash bug reported by MarkC
.
jirash: ERROR: cannot marshal None unless allow_none is enabled (/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xmlrpclib.py:704 in dump_nil)
()
Traceback (most recent call last):
  File "/Users/trentm/tm/jirash/lib/jirashell.py", line 823, in <module>
    retval = main(sys.argv)
  File "/Users/trentm/tm/jirash/lib/jirashell.py", line 817, in main
    return shell.main(argv, loop=cmdln.LOOP_IF_EMPTY)
  File "/Users/trentm/tm/jirash/lib/cmdln.py", line 259, in main
    return self.cmd(args)
  File "/Users/trentm/tm/jirash/lib/cmdln.py", line 277, in cmd
    retval = self.onecmd(argv)
  File "/Users/trentm/tm/jirash/lib/cmdln.py", line 412, in onecmd
    return self._dispatch_cmd(handler, argv)
  File "/Users/trentm/tm/jirash/lib/cmdln.py", line 1115, in _dispatch_cmd
    return handler(argv[0], opts, *args)
  File "/Users/trentm/tm/jirash/lib/jirashell.py", line 685, in do_createissue
    issue = self.jira.create_issue(data)
  File "/Users/trentm/tm/jirash/lib/jirashell.py", line 340, in create_issue
    return self.server.jira1.createIssue(self.auth, data)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xmlrpclib.py", line 1201, in __call__
    return self.__send(self.__name, args)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xmlrpclib.py", line 1485, in __request
    allow_none=self.__allow_none)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xmlrpclib.py", line 1134, in dumps
    data = m.dumps(params)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xmlrpclib.py", line 678, in dumps
    dump(v, write)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xmlrpclib.py", line 700, in __dump
    f(self, value, write)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xmlrpclib.py", line 781, in dump_struct
    dump(v, write)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xmlrpclib.py", line 700, in __dump
    f(self, value, write)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/xmlrpclib.py", line 704, in dump_nil
    raise TypeError, "cannot marshal None unless allow_none is enabled"
TypeError: cannot marshal None unless allow_none is enabled

jirash issues blows up on Windows 8

$ python lib/jirashell.py issues -p IMAGE elb
KEY        STATE          ASSIGNEE    SUMMARY
jirash: ERROR: error making issue repr: 'charmap' codec can't encode character u
'\u2026' in position 35: character maps to <undefined> (issue={'status': '5', 'p
roject': 'IMAGE', 'updated': '2013-09-24 15:59:59.0', 'votes': '0', 'components'
: [{'name': 'Stingray', 'id': '10278'}], 'reporter': 'carlos', 'customFieldValue
s': [{'values': '13461', 'customfieldId': 'customfield_10112'}], 'resolution': '
1', 'created': '2013-09-17 21:05:26.0', 'fixVersions': [], 'summary': 'Update st
m-adc for ELB', 'priority': '2', 'assignee': 'christopher', 'key': 'IMAGE-345',
'id': '32408', 'affectsVersions': [], 'type': '3', 'duedate': '2013-09-20 00:00:
00.0', 'description': 'We need to update stm-adc to include the following:\r\n\r
\n * REST API enabled\r\n * SNMP enabled but restricted to private network to pr
event DDoS reflection attacks\r\n * Also we need a script, run at provision time
, that will use a metadata key to add an entry in the /etc/hosts of the machine.
 (key being: sschost)\r\n\r\nSo the entry will look like:\r\n{noformat}\r\n$ssch
ost ssc1 ssc1.elb.joyent.com\r\n{noformat}'})

Traceback (most recent call last):
  File "lib/jirashell.py", line 1031, in <module>
    retval = main(sys.argv)
  File "lib/jirashell.py", line 1026, in main
    return shell.main(argv, loop=cmdln.LOOP_IF_EMPTY)
  File "c:\Users\Carlos Cardenas\Documents\Lrrr-backup\working\gh-public\jirash\
lib\cmdln.py", line 259, in main
    return self.cmd(args)
  File "c:\Users\Carlos Cardenas\Documents\Lrrr-backup\working\gh-public\jirash\
lib\cmdln.py", line 277, in cmd
    retval = self.onecmd(argv)
  File "c:\Users\Carlos Cardenas\Documents\Lrrr-backup\working\gh-public\jirash\
lib\cmdln.py", line 412, in onecmd
    return self._dispatch_cmd(handler, argv)
  File "c:\Users\Carlos Cardenas\Documents\Lrrr-backup\working\gh-public\jirash\
lib\cmdln.py", line 1115, in _dispatch_cmd
    return handler(argv[0], opts, *args)
  File "lib/jirashell.py", line 666, in do_issues
    self._print_issue_table(issues, long_format=opts.long)
  File "lib/jirashell.py", line 896, in _print_issue_table
    clip(issue["summary"], summary_width),
  File "lib/jirashell.py", line 969, in safeprint
    print s
  File "c:\Anaconda\lib\encodings\cp437.py", line 12, in encode
    return codecs.charmap_encode(input,errors,encoding_map)
UnicodeEncodeError: 'charmap' codec can't encode character u'\u2026' in position
 35: character maps to <undefined>
Traceback (most recent call last):
  File "lib/jirashell.py", line 1053, in <module>
    sys.version, os.uname()))
AttributeError: 'module' object has no attribute 'uname'

createissue: support additional fields

When trying to create an issue with our JIRA, I get the following error:

Traceback (most recent call last):
...
Fault: <Fault 0: 'java.lang.Exception: com.atlassian.jira.rpc.exception.RemoteValidationException: {customfield_10620=QA status is required.} : []'>

It would be nice if one could specify values for arbitrary fields, e.g.
-f "QA status: Test case exists"

prompt user for password

Rather than encourage users to stash their passwords into a file, allow them to provide the password interactively.

Trivial patch:

--- a/lib/jirashell.py
+++ b/lib/jirashell.py
@@ -15,6 +15,7 @@ warnings.filterwarnings("ignore", module="wstools.XMLSchema", lineno=3107)
 #   /opt/local/lib/python2.6/xmlrpclib.py:612: DeprecationWarning: The xmllib module is obsolete.
 warnings.filterwarnings("ignore", module="xmlrpclib", lineno=612)

+import getpass
 import os
 import sys
 import logging
@@ -447,6 +448,8 @@ class JiraShell(cmdln.Cmdln):
             sys.exit(0)
         self.cfg = self._load_cfg()
         self.jira_url = self.options.jira_url or self.cfg["jira_url"]
+        if not self.cfg[self.jira_url].has_key("password"):
+            self.cfg[self.jira_url]["password"] = getpass.getpass("Jira password: ")

     _jira_cache = None
     @property

Get Description of a Ticket

This is not a bug but a feature request:

When you do:

[drende@lem ~]$ jirash issue MYPROJ-81
MYPROJ-81: This is a test ticket (deniz -> john doe, Elevated, Open)

which is fine, but could we also get the description of the same ticket? That would be the first comments made when opening tickets.

".jirash.json" should be created with mode 0600

I used the interactive setup for jirash, and it created a file in my home directory:

jclulow@jmcbook ~ $ ls -lh ~/.jirash.json
-rw-r--r--  1 jclulow  staff   153B Jun 18 13:51 /Users/jclulow/.jirash.json

It would be best, seeing as this file contains sensitive information, if it was created with mode 0600.

update_filter bug

Annotation 2020-04-02 142741

Issue after creating a filter, if the description is 'None' or is blank, when you go to update the filter it will break. Located on line 956 I believe, it does not allow for a pass through of 'None' into the update filter. Work around is currently to have the same description for both and not leaving it blank.

Support JIRA 7.0+ and JIRA Cloud

I know this is a heavy lift, but Atlassian deprecated the SOAP and XML RPC API in JIRA 6, and removed it in JIRA 7 and JIRA Cloud.

https://developer.atlassian.com/jiradev/latest-updates/soap-and-xml-rpc-api-deprecation-notice

It would be great to update this to support the newer JIRA REST APIs.

This is a migration guide provided by Atlassian:
https://developer.atlassian.com/jiradev/latest-updates/soap-and-xml-rpc-api-deprecation-notice/jira-soap-to-rest-migration-guide

jirash blew up: expired session from long 'jirash>' shell

()
Traceback (most recent call last):
  File "/Users/mark/jirash/lib/jirashell.py", line 986, in <module>
    retval = main(sys.argv)
  File "/Users/mark/jirash/lib/jirashell.py", line 981, in main
    return shell.main(argv, loop=cmdln.LOOP_IF_EMPTY)
  File "/Users/mark/jirash/lib/cmdln.py", line 261, in main
    return self.cmdloop()
  File "/Users/mark/jirash/lib/cmdln.py", line 348, in cmdloop
    retval = self.onecmd(argv)
  File "/Users/mark/jirash/lib/cmdln.py", line 412, in onecmd
    return self._dispatch_cmd(handler, argv)
  File "/Users/mark/jirash/lib/cmdln.py", line 1115, in _dispatch_cmd
    return handler(argv[0], opts, *args)
  File "/Users/mark/jirash/lib/jirashell.py", line 781, in do_createissue
    issue = self.jira.create_issue(data)
  File "/Users/mark/jirash/lib/jirashell.py", line 387, in create_issue
    return self.server.jira1.createIssue(self.auth, data)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1224, in __call__
    return self.__send(self.__name, args)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1570, in __request
    verbose=self.__verbose
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1264, in request
    return self.single_request(host, handler, request_body, verbose)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1297, in single_request
    return self.parse_response(response)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1468, in parse_response
    return u.close()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 793, in close
    raise Fault(**self._stack[0])
Fault: <Fault 0: 'java.lang.Exception: com.atlassian.jira.rpc.exception.RemoteAuthenticationException: User not authenticated yet, or session timed out.'>

Python: 2.7.1 (r271:86832, Jul 31 2011, 19:30:53) 
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)]
OS: ('Darwin', 'bluesnoop', '11.4.0', 'Darwin Kernel Version 11.4.0: Mon Apr  9 19:32:15 PDT 2012; root:xnu-1699.26.8~1/RELEASE_X86_64', 'x86_64')

* * * * * * * * * * * * * * * * * * * * * * * *
* Please log a bug at                         *
*    https://github.com/trentm/jirash/issues  *
* to report this error. Thanks!               *
* -- Trent                                    *
* * * * * * * * * * * * * * * * * * * * * * * *

Blow up on search on a non-existant Project

[2013-106-10:57:32]
[~]
carlos@Lrrr:% jirash issues -p IMAGES ubuntu

Traceback (most recent call last):
File "/Users/carlos/working/gh-public/jirash/lib/jirashell.py", line 1006, in
retval = main(sys.argv)
File "/Users/carlos/working/gh-public/jirash/lib/jirashell.py", line 1001, in main
return shell.main(argv, loop=cmdln.LOOP_IF_EMPTY)
File "/Users/carlos/working/gh-public/jirash/lib/cmdln.py", line 259, in main
return self.cmd(args)
File "/Users/carlos/working/gh-public/jirash/lib/cmdln.py", line 277, in cmd
retval = self.onecmd(argv)
File "/Users/carlos/working/gh-public/jirash/lib/cmdln.py", line 412, in onecmd
return self._dispatch_cmd(handler, argv)
File "/Users/carlos/working/gh-public/jirash/lib/cmdln.py", line 1115, in _dispatch_cmd
return handler(argv[0], opts, *args)
File "/Users/carlos/working/gh-public/jirash/lib/jirashell.py", line 635, in do_issues
project_keys=opts.project_keys)
File "/Users/carlos/working/gh-public/jirash/lib/jirashell.py", line 232, in issues_from_search
self.auth, project_keys, terms, BIG)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1224, in call
return self.__send(self.__name, args)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1575, in __request
verbose=self.__verbose
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1264, in request
return self.single_request(host, handler, request_body, verbose)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1297, in single_request
return self.parse_response(response)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1473, in parse_response
return u.close()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 793, in close
raise Fault(**self._stack[0])
Fault: <Fault 0: 'java.lang.Exception: java.lang.NullPointerException'>

Python: 2.7.2 (default, Oct 11 2012, 20:14:37)
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)]
OS: ('Darwin', 'Lrrr.local', '12.3.0', 'Darwin Kernel Version 12.3.0: Sun Jan 6 22:37:10 PST 2013; root:xnu-2050.22.13~1/RELEASE_X86_64', 'x86_64')

Update issue in jira

Hi,

Is it possible to update an issue with jirash?
I do see something like this:

    def update_issue(self, key, data):
        # Actual helpful docs on updateIssue():
        # https://jira.atlassian.com/browse/JRA-10588
        if log.isEnabledFor(logging.DEBUG):
            log.debug("calling updateIssue(%r, %s)", key, json.dumps(data))
        return self.server.jira1.updateIssue(self.auth, key, data)

but I can not find in the help overview.
Would be a nice feature :)

Michiel

jirash blows up when resolving issue

$ jirash resolve ADMINUI-1173

Traceback (most recent call last):
  File "/Users/kevin/opt/jirash/lib/jirashell.py", line 1007, in <module>
    retval = main(sys.argv)
  File "/Users/kevin/opt/jirash/lib/jirashell.py", line 1002, in main
    return shell.main(argv, loop=cmdln.LOOP_IF_EMPTY)
  File "/Users/kevin/opt/jirash/lib/cmdln.py", line 259, in main
    return self.cmd(args)
  File "/Users/kevin/opt/jirash/lib/cmdln.py", line 277, in cmd
    retval = self.onecmd(argv)
  File "/Users/kevin/opt/jirash/lib/cmdln.py", line 412, in onecmd
    return self._dispatch_cmd(handler, argv)
  File "/Users/kevin/opt/jirash/lib/cmdln.py", line 1115, in _dispatch_cmd
    return handler(argv[0], opts, *args)
  File "/Users/kevin/opt/jirash/lib/jirashell.py", line 820, in do_resolve
    self.jira.resolve(key)
  File "/Users/kevin/opt/jirash/lib/jirashell.py", line 376, in resolve
    res = self._jira_soap_call("progressWorkflowAction", [key, "5"])
  File "/Users/kevin/opt/jirash/lib/jirashell.py", line 113, in _jira_soap_call
    server, auth = self._get_soap_server()
  File "/Users/kevin/opt/jirash/lib/jirashell.py", line 97, in _get_soap_server
    XXX
NameError: global name 'XXX' is not defined

Python: 2.7.2 (default, Oct 11 2012, 20:14:37)
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)]
OS: ('Darwin', 'kbook.local', '12.3.0', 'Darwin Kernel Version 12.3.0: Sun Jan  6 22:37:10 PST 2013; root:xnu-2050.22.13~1/RELEASE_X86_64', 'x86_64')

Save a copy of the issue when editing in vim in case of error

I have "createissue_use_editor": true set in my config, so I always edit issues with vim. However, I sometimes mistype the Jira project when creating the issue. I then fill out the (sometimes lengthy) description, only to have jirash throw an exception and not save my description (or print it out).

It would be nice if jirash could either print out what I typed into vim, or save a copy of it somewhere in the case of an error.

jirash implodes on resolve (sunos)

jirash resolve XXXX-333
()
Traceback (most recent call last):
  File "/home/mcavage/work/jirash/lib/jirashell.py", line 986, in <module>
    retval = main(sys.argv)
  File "/home/mcavage/work/jirash/lib/jirashell.py", line 981, in main
    return shell.main(argv, loop=cmdln.LOOP_IF_EMPTY)
  File "/home/mcavage/work/jirash/lib/cmdln.py", line 259, in main
    return self.cmd(args)
  File "/home/mcavage/work/jirash/lib/cmdln.py", line 277, in cmd
    retval = self.onecmd(argv)
  File "/home/mcavage/work/jirash/lib/cmdln.py", line 412, in onecmd
    return self._dispatch_cmd(handler, argv)
  File "/home/mcavage/work/jirash/lib/cmdln.py", line 1115, in _dispatch_cmd
    return handler(argv[0], opts, *args)
  File "/home/mcavage/work/jirash/lib/jirashell.py", line 809, in do_resolve
    self.jira.resolve(key)
  File "/home/mcavage/work/jirash/lib/jirashell.py", line 358, in resolve
    res = self._jira_soap_call("progressWorkflowAction", [key, "5"])
  File "/home/mcavage/work/jirash/lib/jirashell.py", line 95, in _jira_soap_call
    server, auth = self._get_soap_server()
  File "/home/mcavage/work/jirash/lib/jirashell.py", line 87, in _get_soap_server
    self._soap_server = SOAPpy.WSDL.Proxy(soap_url)
  File "/home/mcavage/work/jirash/deps/SOAPpy/WSDL.py", line 77, in __init__
    except xml.parsers.expat.ExpatError, e:
AttributeError: 'module' object has no attribute 'expat'

Python: 2.7.2 (default, Mar 23 2012, 13:45:04) 
[GCC 4.6.2]
OS: ('SunOS', 'martin', '5.11', 'joyent_20120921T180038Z', 'i86pc')

* * * * * * * * * * * * * * * * * * * * * * * *
* Please log a bug at                         *
*    https://github.com/trentm/jirash/issues  *
* to report this error. Thanks!               *
* -- Trent                                    *
 * * * * * * * * * * * * * * * * * * * * * * *

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.