Changeset View
Changeset View
Standalone View
Standalone View
_modules/paas_docker.py
# -*- coding: utf-8 -*- | # -*- coding: utf-8 -*- | ||||
# ------------------------------------------------------------- | # ------------------------------------------------------------- | ||||
# Salt — PaaS Docker execution module | # Salt — PaaS Docker execution module | ||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | ||||
# Project: Nasqueron | # Project: Nasqueron | ||||
# Created: 2018-10-07 | # Created: 2018-10-07 | ||||
# Description: Functions related to data format conversions | # Description: Functions related to data format conversions | ||||
# License: BSD-2-Clause | # License: BSD-2-Clause | ||||
# ------------------------------------------------------------- | # ------------------------------------------------------------- | ||||
from six import iteritems | |||||
def get_image(default_image, args): | def get_image(default_image, args): | ||||
""" | """ | ||||
A function to output a pillar key in JSON. | A function to output a pillar key in JSON. | ||||
State Example:: | State Example:: | ||||
{% image = salt['paas_docker.get_image']("nasqueron/mysql", container) %} | {% image = salt['paas_docker.get_image']("nasqueron/mysql", container) %} | ||||
""" | """ | ||||
Show All 22 Lines | except KeyError: | ||||
networks = {} | networks = {} | ||||
# Defined Docker subnet | # Defined Docker subnet | ||||
subnets = [network["subnet"] for network in networks.values()] | subnets = [network["subnet"] for network in networks.values()] | ||||
# Default Docker subnet | # Default Docker subnet | ||||
subnets.append("172.17.0.0/16") | subnets.append("172.17.0.0/16") | ||||
return subnets | return subnets | ||||
def _build_container_info_dict(container, key, value): | |||||
dereckson: Unused, see online line 66 | |||||
return {'container': container, key: value} | |||||
def get_containers_info(service, key): | |||||
Done Inline ActionsNothing uses this function, and I don't remember the use case, so we can drop it. dereckson: Nothing uses this function, and I don't remember the use case, so we can drop it. | |||||
containers = __pillar__['docker_containers'][__grains__['id']] | |||||
if service not in containers: | |||||
return [] | |||||
return [{'container': container, key: args[key]} | |||||
for container, args | |||||
in iteritems(containers[service])] |
Nasqueron DevCentral · If it had been much bigger the moon would have had a core of ice. · Powered by Phabricator
Unused, see online line 66