Merge pull request #3830 from shin-/3534-machine-config-args

Remove surrounding quotes from TLS paths, if present
This commit is contained in:
Joffrey F 2016-09-07 18:35:43 -07:00 committed by GitHub
commit 3dec600d82
4 changed files with 48 additions and 3 deletions

View file

@ -11,15 +11,16 @@ from docker.utils import kwargs_from_env
from ..const import HTTP_TIMEOUT
from .errors import UserError
from .utils import generate_user_agent
from .utils import unquote_path
log = logging.getLogger(__name__)
def tls_config_from_options(options):
tls = options.get('--tls', False)
ca_cert = options.get('--tlscacert')
cert = options.get('--tlscert')
key = options.get('--tlskey')
ca_cert = unquote_path(options.get('--tlscacert'))
cert = unquote_path(options.get('--tlscert'))
key = unquote_path(options.get('--tlskey'))
verify = options.get('--tlsverify')
skip_hostname_check = options.get('--skip-hostname-check', False)

View file

@ -122,3 +122,11 @@ def generate_user_agent():
else:
parts.append("{}/{}".format(p_system, p_release))
return " ".join(parts)
def unquote_path(s):
if not s:
return s
if s[0] == '"' and s[-1] == '"':
return s[1:-1]
return s