aci format: change methods to staticmethods
This commit is contained in:
parent
e95b4f43dd
commit
7f6b42f8f3
1 changed files with 11 additions and 8 deletions
|
@ -26,7 +26,8 @@ class ACIImage(TarImageFormatter):
|
||||||
for entry in layer_merger.get_generator():
|
for entry in layer_merger.get_generator():
|
||||||
yield entry
|
yield entry
|
||||||
|
|
||||||
def _build_isolators(self, docker_config):
|
@staticmethod
|
||||||
|
def _build_isolators(docker_config):
|
||||||
""" Builds ACI isolator config from the docker config. """
|
""" Builds ACI isolator config from the docker config. """
|
||||||
|
|
||||||
def _isolate_memory(memory):
|
def _isolate_memory(memory):
|
||||||
|
@ -70,7 +71,8 @@ class ACIImage(TarImageFormatter):
|
||||||
|
|
||||||
return isolators
|
return isolators
|
||||||
|
|
||||||
def _build_ports(self, docker_config):
|
@staticmethod
|
||||||
|
def _build_ports(docker_config):
|
||||||
""" Builds the ports definitions for the ACI. """
|
""" Builds the ports definitions for the ACI. """
|
||||||
ports = []
|
ports = []
|
||||||
|
|
||||||
|
@ -100,7 +102,8 @@ class ACIImage(TarImageFormatter):
|
||||||
|
|
||||||
return ports
|
return ports
|
||||||
|
|
||||||
def _build_volumes(self, docker_config):
|
@staticmethod
|
||||||
|
def _build_volumes(docker_config):
|
||||||
""" Builds the volumes definitions for the ACI. """
|
""" Builds the volumes definitions for the ACI. """
|
||||||
volumes = []
|
volumes = []
|
||||||
names = set()
|
names = set()
|
||||||
|
@ -128,7 +131,8 @@ class ACIImage(TarImageFormatter):
|
||||||
return volumes
|
return volumes
|
||||||
|
|
||||||
|
|
||||||
def _build_manifest(self, namespace, repository, tag, docker_layer_data, synthetic_image_id):
|
@staticmethod
|
||||||
|
def _build_manifest(namespace, repository, tag, docker_layer_data, synthetic_image_id):
|
||||||
""" Builds an ACI manifest from the docker layer data. """
|
""" Builds an ACI manifest from the docker layer data. """
|
||||||
|
|
||||||
config = docker_layer_data.get('config', {})
|
config = docker_layer_data.get('config', {})
|
||||||
|
@ -174,9 +178,9 @@ class ACIImage(TarImageFormatter):
|
||||||
"workingDirectory": config.get('WorkingDir', ''),
|
"workingDirectory": config.get('WorkingDir', ''),
|
||||||
"environment": [{"name": key, "value": value}
|
"environment": [{"name": key, "value": value}
|
||||||
for (key, value) in [e.split('=') for e in config.get('Env')]],
|
for (key, value) in [e.split('=') for e in config.get('Env')]],
|
||||||
"isolators": self._build_isolators(config),
|
"isolators": ACIImage._build_isolators(config),
|
||||||
"mountPoints": self._build_volumes(config),
|
"mountPoints": ACIImage._build_volumes(config),
|
||||||
"ports": self._build_ports(config),
|
"ports": ACIImage._build_ports(config),
|
||||||
"annotations": [
|
"annotations": [
|
||||||
{"name": "created", "value": docker_layer_data.get('created', '')},
|
{"name": "created", "value": docker_layer_data.get('created', '')},
|
||||||
{"name": "homepage", "value": source_url},
|
{"name": "homepage", "value": source_url},
|
||||||
|
@ -186,4 +190,3 @@ class ACIImage(TarImageFormatter):
|
||||||
}
|
}
|
||||||
|
|
||||||
return json.dumps(manifest)
|
return json.dumps(manifest)
|
||||||
|
|
||||||
|
|
Reference in a new issue