Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails with my .arcrc which only contains token #22

Closed
kov opened this issue Jun 25, 2015 · 2 comments
Closed

Fails with my .arcrc which only contains token #22

kov opened this issue Jun 25, 2015 · 2 comments

Comments

@kov
Copy link

kov commented Jun 25, 2015

My .arcrc was produced by running arc install-certificate and looks like this:

{
  "hosts": {
    "https:\/\/phabricator[redacted]\/api\/": {
      "token": "cli-[redacted]"
    }
  }
}

python-phabricator complains about not finding the user key and, after I added it by hand, it complains about the cert key not being found:

>>> phab = Phabricator()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/kov/.local/lib/python2.7/site-packages/phabricator-0.4.0-py2.7.egg/phabricator/__init__.py", line 318, in __init__
    self.certificate = certificate if certificate else ARCRC['hosts'][self.host]['cert']
KeyError: 'cert'
>>> 
kov pushed a commit to kov/python-phabricator that referenced this issue Jun 26, 2015
Phabricator has moved on from the clunky user+certificate-based authentication
scheme into one that provides the API user with a single token that can be
used directly. This change adds support for that and prefers it when available.

Fixes disqus#22.
@koobs
Copy link

koobs commented Jun 27, 2015

Do tests pass after including this commit?

I see this failure:

  File "/usr/home/koobs/repos/freebsd/ports/devel/py-phabricator/work/phabricator-0.4.0/phabricator/tests.py", line 14, in setUp
    self.api = phabricator.Phabricator(username='test', certificate='test', host='http://localhost')
  File "/usr/home/koobs/repos/freebsd/ports/devel/py-phabricator/work/phabricator-0.4.0/phabricator/__init__.py", line 296, in __init__
    if token or ARCRC['hosts'][self.host].has_key('token'):
KeyError: 'http://localhost'

In the following tests:

test_connect (phabricator.tests.PhabricatorTest) ... ERROR
test_generate_hash (phabricator.tests.PhabricatorTest) ... ERROR
test_maniphest_find (phabricator.tests.PhabricatorTest) ... ERROR
test_user_whoami (phabricator.tests.PhabricatorTest) ... ERROR
test_validation (phabricator.tests.PhabricatorTest) ... ERROR

kov pushed a commit to kov/python-phabricator that referenced this issue Jun 29, 2015
Phabricator has moved on from the clunky user+certificate-based authentication
scheme into one that provides the API user with a single token that can be
used directly. This change adds support for that and prefers it when available.

Fixes disqus#22.
@kov
Copy link
Author

kov commented Jun 29, 2015

Oops, apparently the tests used the installed version so I was misled into thinking they were passing. This new commit fixes that.

uqs pushed a commit to freebsd/freebsd-ports that referenced this issue Jul 15, 2015
Backport upstream pull request #23 [1] that adds support for new style
token-based authentication. This PR fixes issue #22 [2]. Additionally
modify the patch to add the token argument to the and of the argument
list as per upstream pull request comment.

This change fixes errors associated with not being able to find 'user'
or 'cert' configuration keys (in ~/.arcrc) keys when using token based
authentication.

This was reproducible with deskutils/py-bugwarrior

- Sort Makefile
- Sort USE_PYTHON values
- Canonicalize regression-test invocation

[1] disqus/python-phabricator#23
[2] disqus/python-phabricator#22

Approved by:		sbz (maintainer)
Differential Revision:	https://reviews.freebsd.org/D2983


git-svn-id: svn+ssh://svn.freebsd.org/ports/head@392126 35697150-7ecd-e111-bb59-0022644237b5
koobs added a commit to freebsd/freebsd-ports that referenced this issue Jul 15, 2015
Backport upstream pull request #23 [1] that adds support for new style
token-based authentication. This PR fixes issue #22 [2]. Additionally
modify the patch to add the token argument to the and of the argument
list as per upstream pull request comment.

This change fixes errors associated with not being able to find 'user'
or 'cert' configuration keys (in ~/.arcrc) keys when using token based
authentication.

This was reproducible with deskutils/py-bugwarrior

- Sort Makefile
- Sort USE_PYTHON values
- Canonicalize regression-test invocation

[1] disqus/python-phabricator#23
[2] disqus/python-phabricator#22

Approved by:		sbz (maintainer)
Differential Revision:	https://reviews.freebsd.org/D2983
kov pushed a commit to kov/python-phabricator that referenced this issue Sep 17, 2015
Phabricator has moved on from the clunky user+certificate-based authentication
scheme into one that provides the API user with a single token that can be
used directly. This change adds support for that and prefers it when available.

Fixes disqus#22.
@BYK BYK closed this as completed in #23 Oct 29, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants