aci format: change methods to staticmethods

This commit is contained in:
Jimmy Zelinskie 2015-02-02 16:13:37 -05:00
parent e95b4f43dd
commit 7f6b42f8f3

View file

@ -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)