-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Description
I couldn't create secret object, the problem seemed to boil down to the way that a secret was being created from the docker daemon response.
docker-py/docker/models/secrets.py
Lines 31 to 33 in 467cacb
def create(self, **kwargs): | |
obj = self.client.api.create_secret(**kwargs) | |
return self.prepare_model(obj) |
Docker version 18.03.1-ce and python version 3.5 had the following error:
File "docker/models/secrets.py", line 10 in __repr__
return "<%s: %s'>" % (self.__class__.__name__, self.name)
File "docker/models/secrets.py", line 14 in name
return self.attrs['Spec']['Name']
KeyError: 'Spec'
When calling:
import docker
client -docker.from_env()
mySecret = client.secrets.create(name='randomName', data='platform_node_requirements.md')
Changing the code to the following seemed to fix it.
obj = self.client.api.create_secret(**kwargs)
secret = self.client.secrets.get(obj.get('ID'))
return self.prepare_model(secret)
VivaLaVile, knackjax, douglasmiranda, remorses, etienne-napoleone and 1 more
Metadata
Metadata
Assignees
Labels
No labels