Use deployment name rather than id for compose project
Latest docker-compose only recreates containers whose configurationhas changed since they were created[1]. This patch uses sd 'name' rather than 'id' for the project name that helps in recreating containers with the same name after an update. Also changes docker-compose version to 1.4.0. [1] https://github.com/docker/compose/releases/tag/1.4.0 Change-Id: Ia9b8621c8785b55551a0660fed0148b15ab4f20c
This commit is contained in:
parent
43bc1a171f
commit
37efe6f243
@ -12,6 +12,6 @@ elif [ -f /etc/redhat-release ]; then
|
||||
systemctl enable docker.service
|
||||
fi
|
||||
|
||||
pip install -U dpath docker-compose
|
||||
pip install -U dpath docker-compose==1.4.0
|
||||
|
||||
install -D -g root -o root -m 0755 ${SCRIPTDIR}/hook-docker-compose.py /var/lib/heat-config/hooks/docker-compose
|
@ -62,7 +62,7 @@ def main(argv=sys.argv):
|
||||
|
||||
input_values = dict((i['name'], i['value']) for i in c['inputs'])
|
||||
|
||||
proj = os.path.join(WORKING_DIR, c.get('id'))
|
||||
proj = os.path.join(WORKING_DIR, c.get('name'))
|
||||
prepare_dir(proj)
|
||||
|
||||
stdout, stderr = {}, {}
|
||||
|
@ -64,7 +64,7 @@ def main(argv=sys.argv):
|
||||
def cleanup_stale_projects(configs):
|
||||
def deployments(configs):
|
||||
for c in configs:
|
||||
yield c['id']
|
||||
yield c['name']
|
||||
|
||||
def compose_projects(compose_dir):
|
||||
for proj in os.listdir(compose_dir):
|
||||
@ -104,7 +104,7 @@ def write_compose_config(c):
|
||||
yaml_config = yaml.safe_dump(compose_conf, default_flow_style=False)
|
||||
else:
|
||||
yaml_config = compose_conf
|
||||
proj_dir = os.path.join(DOCKER_COMPOSE_DIR, c['id'])
|
||||
proj_dir = os.path.join(DOCKER_COMPOSE_DIR, c['name'])
|
||||
prepare_dir(proj_dir)
|
||||
fn = os.path.join(proj_dir, 'docker-compose.yml')
|
||||
with os.fdopen(os.open(fn, os.O_CREAT | os.O_WRONLY, 0o600), 'w') as f:
|
||||
|
@ -13,8 +13,8 @@ yum clean all
|
||||
pip install dpath
|
||||
|
||||
# using binary as 'docker-compose' and 'os-collect-config' has conflict on 'requests' version
|
||||
# 1.3.0rc1 required by tripleo
|
||||
curl -L https://github.com/docker/compose/releases/download/1.3.0rc1/docker-compose-`uname -s`-`uname -m` \
|
||||
# docker-compose pins requests version to 2.6.1
|
||||
curl -L https://github.com/docker/compose/releases/download/1.4.0/docker-compose-`uname -s`-`uname -m` \
|
||||
> /usr/local/bin/docker-compose
|
||||
chmod +x /usr/local/bin/docker-compose
|
||||
|
||||
|
@ -27,7 +27,7 @@ class HeatConfigDockerComposeORCTest(common.RunScriptTest):
|
||||
|
||||
data = [
|
||||
{
|
||||
"id": "abcdef001",
|
||||
"name": "abcdef001",
|
||||
"group": "docker-compose",
|
||||
"inputs": {},
|
||||
"config": {
|
||||
@ -46,7 +46,7 @@ class HeatConfigDockerComposeORCTest(common.RunScriptTest):
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "abcdef002",
|
||||
"name": "abcdef002",
|
||||
"group": "docker-compose",
|
||||
"inputs": {},
|
||||
"config": {
|
||||
|
@ -21,7 +21,7 @@ from tests.software_config import common
|
||||
|
||||
class HookDockerComposeTest(common.RunScriptTest):
|
||||
data = {
|
||||
"id": "abcdef001",
|
||||
"name": "abcdef001",
|
||||
"group": "docker-compose",
|
||||
"inputs": [
|
||||
{
|
||||
@ -50,7 +50,7 @@ class HookDockerComposeTest(common.RunScriptTest):
|
||||
}
|
||||
|
||||
data_without_input = {
|
||||
"id": "abcdef001",
|
||||
"name": "abcdef001",
|
||||
"group": "docker-compose",
|
||||
"inputs": [],
|
||||
"config": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user