Skip to content

Commit

Permalink
Change repr and return id insted name attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
feliperuhland committed Dec 4, 2019
1 parent 7750c91 commit fd66de0
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions docker/models/secrets.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,11 @@ class Secret(Model):
id_attribute = 'Id'

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

@property
def name(self):
"""
Create secret only returns Id field, so if the name field is not
present, it will show id value instead.
Issue #2025
"""
if self.attrs.get('Spec', {}).get('Name'):
return self.attrs['Spec']['Name']

return self.id
return self.attrs.get('Spec', {}).get('Name')

def remove(self):
"""
Expand Down

0 comments on commit fd66de0

Please sign in to comment.