X Tutup
The Wayback Machine - https://web.archive.org/web/20201014002919/https://github.com/docker/docker-py/pull/2517
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

Fix secret repr #2517

Open
wants to merge 4 commits into
base: master
from
Open

Conversation

@feliperuhland
Copy link
Contributor

@feliperuhland feliperuhland commented Feb 19, 2020

This PR fixes issue #2025

- a post fake secret
- added to fake api
- create a unit test

Signed-off-by: Felipe Ruhland <felipe.ruhland@gmail.com>
- Change id_attribute to Id
- add new property id
- add name fallback

Fixes #2025

Signed-off-by: Felipe Ruhland <felipe.ruhland@gmail.com>
Signed-off-by: Felipe Ruhland <felipe.ruhland@gmail.com>
@feliperuhland
Copy link
Contributor Author

@feliperuhland feliperuhland commented Feb 19, 2020

@shin- @ulyssessouza

Could you take a look?

Thanks.

Copy link
Contributor

@ulyssessouza ulyssessouza left a comment

I have some considerations on why the replacement of name by id

@@ -4,14 +4,14 @@

class Secret(Model):
"""A secret."""
id_attribute = 'ID'
id_attribute = 'Id'

This comment has been minimized.

@ulyssessouza

ulyssessouza Feb 26, 2020
Contributor

I'm not sure to understand this change. According to https://docs.docker.com/engine/api/v1.30/#tag/Secret that's an uppercase "D"

This comment has been minimized.

@feliperuhland

feliperuhland Feb 27, 2020
Author Contributor

I don't remember why I did it, but it's fixed now.
Thanks.


def __repr__(self):
return "<%s: '%s'>" % (self.__class__.__name__, self.name)
return "<%s: '%s'>" % (self.__class__.__name__, self.id)

This comment has been minimized.

@ulyssessouza

ulyssessouza Feb 26, 2020
Contributor

Why changing the attribute here?

This comment has been minimized.

@feliperuhland

feliperuhland Feb 27, 2020
Author Contributor

It's because List Secrets doesn't return the name attribute.

Issue #2025

This comment has been minimized.

@ulyssessouza

ulyssessouza Feb 28, 2020
Contributor

Well...
The API says it does. That's in the very link you mentioned. If not, it's a bug

This comment has been minimized.

@thaJeztah

thaJeztah Feb 28, 2020
Member

Name is nested in the Spec in the response, so not at the same level as id;

[
  {
    "ID": "ktnbjxoalbkvbvedmg1urrz8h",
    "Version": {
      "Index": 11
    },
    "CreatedAt": "2016-11-05T01:20:17.327670065Z",
    "UpdatedAt": "2016-11-05T01:20:17.327670065Z",
    "Spec": {
      "Name": "app-dev.crt"
    }
  }
]

Screenshot 2020-02-28 at 17 01 01

@GordonTheTurtle
Copy link

@GordonTheTurtle GordonTheTurtle commented Feb 27, 2020

Please sign your commits following these rules:
https://github.com/moby/moby/blob/master/CONTRIBUTING.md#sign-your-work
The easiest way to do this is to amend the last commit:

$ git clone -b "fix-secret-repr" git@github.com:feliperuhland/docker-py.git somewhere
$ cd somewhere
$ git rebase -i HEAD~842354382592
editor opens
change each 'pick' to 'edit'
save the file and quit
$ git commit --amend -s --no-edit
$ git rebase --continue # and repeat the amend for each commit
$ git push -f

Amending updates the existing PR. You DO NOT need to open a new one.

Signed-off-by: Felipe Ruhland <felipe.ruhland@gmail.com>
@feliperuhland feliperuhland force-pushed the feliperuhland:fix-secret-repr branch from 191da62 to 3626329 Feb 27, 2020
@GordonTheTurtle GordonTheTurtle removed the dco/no label Feb 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.
X Tutup