Skip to content
This repository has been archived by the owner on Apr 11, 2022. It is now read-only.

Call for tokens in "latest" like the other sub-commands #36

Merged

Conversation

rafaelcaricio
Copy link

@rafaelcaricio rafaelcaricio commented May 30, 2016

We should be uniform in how to get tokens to use in subcommands. User reported:

Traceback (most recent call last):
  File "/usr/local/bin/pierone", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.5/site-packages/pierone/cli.py", line 342, in main
    cli()
  File "/usr/local/lib/python3.5/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.5/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.5/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.5/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.5/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.5/site-packages/click/decorators.py", line 27, in new_func
    return f(get_current_context().obj, *args, **kwargs)
  File "/usr/local/lib/python3.5/site-packages/pierone/cli.py", line 214, in latest
    print(get_latest_tag('pierone', image))
  File "/usr/local/lib/python3.5/site-packages/pierone/api.py", line 105, in get_latest_tag
    raise Unauthorized()
pierone.api.Unauthorized: Unauthorized: token missing or invalid

But other sub-commands work fine, like "pierone tags". The only reason it is not working for the latest sub-command is because it calls for the pierone token in a different way than other sub-commands. This PR makes latest call for tokens the same way.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.4%) to 81.044% when pulling 6a04129 on rafaelcaricio:use-same-code-for-latest into 991c05e on zalando-stups:master.

@hjacobs
Copy link
Contributor

hjacobs commented Jun 2, 2016

👍

@hjacobs hjacobs merged commit 6a1982d into zalando-stups:master Jun 2, 2016
@whiskeysierra
Copy link

Temporary workaround (requires jq):

pierone tags stups zmon-aws-agent -o json | jq -r '.[length - 1].tag'

@rafaelcaricio rafaelcaricio deleted the use-same-code-for-latest branch June 2, 2016 14:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants