-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Anca Iordache <anca.iordache@docker.com>
- Loading branch information
Showing
11 changed files
with
156 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import sys, os | ||
import sys | ||
import os | ||
from .version import version | ||
|
||
DEFAULT_DOCKER_API_VERSION = '1.35' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
# flake8: noqa | ||
from .context import Context | ||
from .api import ContextAPI | ||
from .api import ContextAPI |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,25 @@ | ||
import os, hashlib, base64 | ||
import os | ||
import hashlib | ||
from .. import utils | ||
|
||
CONTEXTS_DIR = os.path.join(os.path.dirname(utils.find_docker_config_file()), "contexts") | ||
CONTEXTS_DIR = os.path.join(os.path.dirname( | ||
utils.find_docker_config_file() or ""), "contexts") | ||
METADATA_DIR = os.path.join(CONTEXTS_DIR, "meta") | ||
TLS_DIR = os.path.join(CONTEXTS_DIR, "tls") | ||
METAFILE = "meta.json" | ||
TLS_DIR = os.path.join(CONTEXTS_DIR, "tls") | ||
METAFILE = "meta.json" | ||
|
||
get_context_id = lambda name: hashlib.sha256(name.encode('utf-8')).hexdigest() | ||
get_meta_dir = lambda name: os.path.join(METADATA_DIR, get_context_id(name)) | ||
get_meta_file = lambda name: os.path.join(get_meta_dir(name), METAFILE) | ||
get_tls_dir = lambda name, endpoint = "": os.path.join(TLS_DIR, get_context_id(name), endpoint) | ||
|
||
def get_context_id(name): | ||
return hashlib.sha256(name.encode('utf-8')).hexdigest() | ||
|
||
|
||
def get_meta_dir(name): | ||
return os.path.join(METADATA_DIR, get_context_id(name)) | ||
|
||
|
||
def get_meta_file(name): | ||
return os.path.join(get_meta_dir(name), METAFILE) | ||
|
||
|
||
def get_tls_dir(name, endpoint=""): | ||
return os.path.join(TLS_DIR, get_context_id(name), endpoint) |
Oops, something went wrong.