Example #1
0
def main():
    try:
        get_ipython
    except NameError:
        pass
    else:
        exit("Running ipython inside ipython isn't supported. :(")

    options, basic_auth, oauth = get_config()

    if basic_auth:
        basic_auth = (basic_auth['username'], basic_auth['password'])

    if oauth.get('oauth_dance') is True:
        oauth = oauth_dance(options['server'], oauth['consumer_key'],
                            oauth['key_cert'], oauth['print_tokens'],
                            options['verify'])
    elif not all((oauth.get('access_token'), oauth.get('access_token_secret'),
                  oauth.get('consumer_key'), oauth.get('key_cert'))):
        oauth = None

    jira = JIRA(options=options, basic_auth=basic_auth, oauth=oauth)

    import IPython
    # The top-level `frontend` package has been deprecated since IPython 1.0.
    if IPython.version_info[0] >= 1:
        from IPython.terminal.embed import InteractiveShellEmbed
    else:
        from IPython.frontend.terminal.embed import InteractiveShellEmbed

    ipshell = InteractiveShellEmbed(banner1='<JIRA Shell ' + __version__ +
                                    ' (' + jira.client_info() + ')>')
    ipshell("*** JIRA shell active; client is in 'jira'."
            ' Press Ctrl-D to exit.')
Example #2
0
def main():
    try:
        get_ipython
    except NameError:
        pass
    else:
        exit("Running ipython inside ipython isn't supported. :(")

    options, basic_auth, oauth = get_config()

    if basic_auth:
        basic_auth = (basic_auth['username'], basic_auth['password'])

    if oauth['oauth_dance']:
        oauth = oauth_dance(options['server'], oauth['consumer_key'],
                            oauth['key_cert'], oauth['print_tokens'],
                            options['verify'])
    else:
        oauth = None

    jira = JIRA(options=options, basic_auth=basic_auth, oauth=oauth)

    from IPython.frontend.terminal.embed import InteractiveShellEmbed

    ipshell = InteractiveShellEmbed(banner1='<JIRA Shell ' + __version__ +
                                    ' (' + jira.client_info() + ')>')
    ipshell("*** JIRA shell active; client is in 'jira'."
            ' Press Ctrl-D to exit.')
Example #3
0
def main():
    try:
        get_ipython
    except NameError:
        pass
    else:
        exit("Running ipython inside ipython isn't supported. :(")

    options, basic_auth, oauth = get_config()

    if basic_auth:
        basic_auth = (basic_auth['username'], basic_auth['password'])

    if oauth['oauth_dance']:
        oauth = oauth_dance(
            options['server'], oauth['consumer_key'], oauth['key_cert'], oauth['print_tokens'], options['verify'])
    else:
        oauth = None

    jira = JIRA(options=options, basic_auth=basic_auth, oauth=oauth)

    from IPython.frontend.terminal.embed import InteractiveShellEmbed

    ipshell = InteractiveShellEmbed(
        banner1='<JIRA Shell ' + __version__ + ' (' + jira.client_info() + ')>')
    ipshell("*** JIRA shell active; client is in 'jira'."
            ' Press Ctrl-D to exit.')
Example #4
0
def main():
    try:
        get_ipython
    except NameError:
        pass
    else:
        exit("Running ipython inside ipython isn't supported. :(")

    options, basic_auth, oauth = get_config()

    if basic_auth:
        basic_auth = (basic_auth['username'], basic_auth['password'])

    if oauth.get('oauth_dance') is True:
        oauth = oauth_dance(
            options['server'], oauth['consumer_key'], oauth['key_cert'], oauth['print_tokens'], options['verify'])
    elif not all((oauth.get('access_token'), oauth.get('access_token_secret'),
                  oauth.get('consumer_key'), oauth.get('key_cert'))):
        oauth = None

    jira = JIRA(options=options, basic_auth=basic_auth, oauth=oauth)

    import IPython
    # The top-level `frontend` package has been deprecated since IPython 1.0.
    if IPython.version_info[0] >= 1:
        from IPython.terminal.embed import InteractiveShellEmbed
    else:
        from IPython.frontend.terminal.embed import InteractiveShellEmbed

    ip_shell = InteractiveShellEmbed(
        banner1='<JIRA Shell ' + __version__ + ' (' + jira.client_info() + ')>')
    ip_shell("*** JIRA shell active; client is in 'jira'."
             ' Press Ctrl-D to exit.')
Example #5
0
def main():

    try:
        try:
            get_ipython
        except NameError:
            pass
        else:
            sys.exit("Running ipython inside ipython isn't supported. :(")

        options, basic_auth, oauth, kerberos_auth = get_config()

        if basic_auth:
            basic_auth = handle_basic_auth(auth=basic_auth, server=options["server"])

        if oauth.get("oauth_dance") is True:
            oauth = oauth_dance(
                options["server"],
                oauth["consumer_key"],
                oauth["key_cert"],
                oauth["print_tokens"],
                options["verify"],
            )
        elif not all(
            (
                oauth.get("access_token"),
                oauth.get("access_token_secret"),
                oauth.get("consumer_key"),
                oauth.get("key_cert"),
            )
        ):
            oauth = None

        use_kerberos = kerberos_auth.get("use_kerberos", False)
        del kerberos_auth["use_kerberos"]

        jira = JIRA(
            options=options,
            basic_auth=basic_auth,
            kerberos=use_kerberos,
            kerberos_options=kerberos_auth,
            oauth=oauth,
        )

        import IPython

        # The top-level `frontend` package has been deprecated since IPython 1.0.
        if IPython.version_info[0] >= 1:
            from IPython.terminal.embed import InteractiveShellEmbed
        else:
            from IPython.frontend.terminal.embed import InteractiveShellEmbed

        ip_shell = InteractiveShellEmbed(
            banner1="<Jira Shell " + __version__ + " (" + jira.client_info() + ")>"
        )
        ip_shell("*** Jira shell active; client is in 'jira'." " Press Ctrl-D to exit.")
    except Exception as e:
        print(e, file=sys.stderr)
        return 2
Example #6
0
def main():
    # workaround for avoiding UnicodeEncodeError when printing exceptions
    # containing unicode on py2
    if sys.version_info[0] < 3 and sys.getdefaultencoding() != 'utf-8':
        # without reload print would fail even if sys.stdin.encoding
        # would report utf-8
        # see: https://stackoverflow.com/a/23847316/99834
        stdin, stdout, stderr = sys.stdin, sys.stdout, sys.stderr
        reload(sys)
        sys.stdin, sys.stdout, sys.stderr = stdin, stdout, stderr
        sys.setdefaultencoding(os.environ.get('PYTHONIOENCODING', 'utf-8'))

    try:
        try:
            get_ipython
        except NameError:
            pass
        else:
            sys.exit("Running ipython inside ipython isn't supported. :(")

        options, basic_auth, oauth, kerberos_auth = get_config()

        if basic_auth:
            basic_auth = (basic_auth['username'], basic_auth['password'])

        if oauth.get('oauth_dance') is True:
            oauth = oauth_dance(options['server'], oauth['consumer_key'],
                                oauth['key_cert'], oauth['print_tokens'],
                                options['verify'])
        elif not all(
            (oauth.get('access_token'), oauth.get('access_token_secret'),
             oauth.get('consumer_key'), oauth.get('key_cert'))):
            oauth = None

        use_kerberos = kerberos_auth.get('use_kerberos', False)
        del kerberos_auth['use_kerberos']

        jira = JIRA(options=options,
                    basic_auth=basic_auth,
                    kerberos=use_kerberos,
                    kerberos_options=kerberos_auth,
                    oauth=oauth)

        import IPython
        # The top-level `frontend` package has been deprecated since IPython 1.0.
        if IPython.version_info[0] >= 1:
            from IPython.terminal.embed import InteractiveShellEmbed
        else:
            from IPython.frontend.terminal.embed import InteractiveShellEmbed

        ip_shell = InteractiveShellEmbed(banner1='<JIRA Shell ' + __version__ +
                                         ' (' + jira.client_info() + ')>')
        ip_shell("*** JIRA shell active; client is in 'jira'."
                 ' Press Ctrl-D to exit.')
    except Exception as e:
        print(e, file=sys.stderr)
        return 2
Example #7
0
def main():
    # workaround for avoiding UnicodeEncodeError when printing exceptions
    # containing unicode on py2
    if sys.version_info[0] < 3 and sys.getdefaultencoding() != 'utf-8':
        # without reload print would fail even if sys.stdin.encoding
        # would report utf-8
        # see: https://stackoverflow.com/a/23847316/99834
        stdin, stdout, stderr = sys.stdin, sys.stdout, sys.stderr
        reload(sys)
        sys.stdin, sys.stdout, sys.stderr = stdin, stdout, stderr
        sys.setdefaultencoding(os.environ.get('PYTHONIOENCODING', 'utf-8'))

    try:
        try:
            get_ipython
        except NameError:
            pass
        else:
            sys.exit("Running ipython inside ipython isn't supported. :(")

        options, basic_auth, oauth = get_config()

        if basic_auth:
            basic_auth = (basic_auth['username'], basic_auth['password'])

        if oauth.get('oauth_dance') is True:
            oauth = oauth_dance(
                options['server'], oauth['consumer_key'], oauth['key_cert'], oauth['print_tokens'], options['verify'])
        elif not all((oauth.get('access_token'), oauth.get('access_token_secret'),
                     oauth.get('consumer_key'), oauth.get('key_cert'))):
            oauth = None

        jira = JIRA(options=options, basic_auth=basic_auth, oauth=oauth)

        import IPython
        # The top-level `frontend` package has been deprecated since IPython 1.0.
        if IPython.version_info[0] >= 1:
            from IPython.terminal.embed import InteractiveShellEmbed
        else:
            from IPython.frontend.terminal.embed import InteractiveShellEmbed

        ip_shell = InteractiveShellEmbed(
            banner1='<JIRA Shell ' + __version__ + ' (' + jira.client_info() + ')>')
        ip_shell("*** JIRA shell active; client is in 'jira'."
                 ' Press Ctrl-D to exit.')
    except Exception as e:
        print(e, file=sys.stderr)
        return 2
Example #8
0
def moveTasksToTest(version, build):
    fixedInBuild = 'build: {0}'.format(build)

    options = { 'server': SERVER }
    jira = JIRA(options, basic_auth=(CURRENT_USER, PASSWORD)) # a username/password tuple
    print('INFO -> jira: %s' % jira.client_info())
    print('INFO -> current_user: %s' % CURRENT_USER)
    print('INFO -> target_user: %s' % TARGET_USER)

    assignee = 'assignee={0}'.format(CURRENT_USER) #на ком таска
    issues = jira.search_issues(assignee)

    print('\n')
    for issue in issues:
        if issue.fields.status.name in(u'READY TO MERGE'):
            print('INFO -> Task: %s' % issue.key.encode('utf-8','ignore'))
            print('INFO -> Summary: %s' % issue.fields.summary.encode('utf-8','replace'))
            print('INFO -> Status: %s\n' % issue.fields.status)
            fixedInMsg = 'fixed in ' + version + ' ' + fixedInBuild
            comment = jira.add_comment(issue.key, fixedInMsg)
            jira.transition_issue(issue, transition='Ready for test')
            jira.assign_issue(issue, TARGET_USER)

    print('DEBUG -> Success!')