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():
|
||||
yield entry
|
||||
|
||||
def _build_isolators(self, docker_config):
|
||||
@staticmethod
|
||||
def _build_isolators(docker_config):
|
||||
""" Builds ACI isolator config from the docker config. """
|
||||
|
||||
def _isolate_memory(memory):
|
||||
|
@ -70,7 +71,8 @@ class ACIImage(TarImageFormatter):
|
|||
|
||||
return isolators
|
||||
|
||||
def _build_ports(self, docker_config):
|
||||
@staticmethod
|
||||
def _build_ports(docker_config):
|
||||
""" Builds the ports definitions for the ACI. """
|
||||
ports = []
|
||||
|
||||
|
@ -100,7 +102,8 @@ class ACIImage(TarImageFormatter):
|
|||
|
||||
return ports
|
||||
|
||||
def _build_volumes(self, docker_config):
|
||||
@staticmethod
|
||||
def _build_volumes(docker_config):
|
||||
""" Builds the volumes definitions for the ACI. """
|
||||
volumes = []
|
||||
names = set()
|
||||
|
@ -128,7 +131,8 @@ class ACIImage(TarImageFormatter):
|
|||
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. """
|
||||
|
||||
config = docker_layer_data.get('config', {})
|
||||
|
@ -174,9 +178,9 @@ class ACIImage(TarImageFormatter):
|
|||
"workingDirectory": config.get('WorkingDir', ''),
|
||||
"environment": [{"name": key, "value": value}
|
||||
for (key, value) in [e.split('=') for e in config.get('Env')]],
|
||||
"isolators": self._build_isolators(config),
|
||||
"mountPoints": self._build_volumes(config),
|
||||
"ports": self._build_ports(config),
|
||||
"isolators": ACIImage._build_isolators(config),
|
||||
"mountPoints": ACIImage._build_volumes(config),
|
||||
"ports": ACIImage._build_ports(config),
|
||||
"annotations": [
|
||||
{"name": "created", "value": docker_layer_data.get('created', '')},
|
||||
{"name": "homepage", "value": source_url},
|
||||
|
@ -186,4 +190,3 @@ class ACIImage(TarImageFormatter):
|
|||
}
|
||||
|
||||
return json.dumps(manifest)
|
||||
|
||||
|
|
Reference in a new issue