Skip to content
This repository has been archived by the owner on Jan 1, 2023. It is now read-only.

Validate Names #15

Closed
ambsw-technology opened this issue Dec 12, 2016 · 1 comment
Closed

Validate Names #15

ambsw-technology opened this issue Dec 12, 2016 · 1 comment

Comments

@ambsw-technology
Copy link
Contributor

ambsw-technology commented Dec 12, 2016

Due to a change in docker, container names can no longer include an underscore. A legacy name with an underscore leads to an invalid hostname (merll/docker-fabric#14) error that is hard to trace down. I suggest an assertion in the constructor for maps/containers (and/or their configs) that validates names and raises an informative exception.

@merll
Copy link
Owner

merll commented Dec 17, 2016

Underscores are quite common for variable names in Python and in my opinion should therefore also be valid for container and client configuration names. As the restriction only seems to apply to the host names but not the Docker container names, I have added a method for replacing certain characters for container host names and link alias names. Underscores are replaced with dashes. Similarly, dots are replaced with dashes since they would lead to a strange subdomain syntax. The behavior can be customized by changing the dockermap.map.policy.base.BasePolicy.hostname_replace dictionary.

@merll merll closed this as completed Dec 17, 2016
This was referenced Feb 6, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants