Pass list of config_files to git.upstart template

This commit is contained in:
Corey Bryant 2015-04-08 17:46:13 +00:00
parent f17dd07e4a
commit 46456e389e
4 changed files with 21 additions and 6 deletions

View File

@ -1,4 +1,4 @@
branch: lp:charm-helpers branch: lp:charm-helpers
destination: hooks/charmhelpers destination: hooks/charmhelpers
include: include:
- core - core

View File

@ -9,5 +9,7 @@ respawn
exec start-stop-daemon --start --chuid {{ user_name }} \ exec start-stop-daemon --start --chuid {{ user_name }} \
--chdir {{ start_dir }} --name {{ process_name }} \ --chdir {{ start_dir }} --name {{ process_name }} \
--exec {{ executable_name }} -- \ --exec {{ executable_name }} -- \
{% for config_file in config_files -%}
--config-file={{ config_file }} \ --config-file={{ config_file }} \
{% endfor -%}
--log-file={{ log_file }} --log-file={{ log_file }}

View File

@ -20,11 +20,13 @@
# Authors: # Authors:
# Charm Helpers Developers <juju@lists.ubuntu.com> # Charm Helpers Developers <juju@lists.ubuntu.com>
from __future__ import print_function
import os import os
import json import json
import yaml import yaml
import subprocess import subprocess
import sys import sys
import errno
from subprocess import CalledProcessError from subprocess import CalledProcessError
import six import six
@ -87,7 +89,18 @@ def log(message, level=None):
if not isinstance(message, six.string_types): if not isinstance(message, six.string_types):
message = repr(message) message = repr(message)
command += [message] command += [message]
subprocess.call(command) # Missing juju-log should not cause failures in unit tests
# Send log output to stderr
try:
subprocess.call(command)
except OSError as e:
if e.errno == errno.ENOENT:
if level:
message = "{}: {}".format(level, message)
message = "juju-log: {}".format(message)
print(message, file=sys.stderr)
else:
raise
class Serializable(UserDict): class Serializable(UserDict):

View File

@ -622,7 +622,7 @@ def git_post_install(projects_yaml):
'start_dir': '/var/lib/cinder', 'start_dir': '/var/lib/cinder',
'process_name': 'cinder-api', 'process_name': 'cinder-api',
'executable_name': '/usr/local/bin/cinder-api', 'executable_name': '/usr/local/bin/cinder-api',
'config_file': '/etc/cinder/cinder.conf', 'config_files': ['/etc/cinder/cinder.conf'],
'log_file': '/var/log/cinder/cinder-api.log', 'log_file': '/var/log/cinder/cinder-api.log',
} }
@ -633,7 +633,7 @@ def git_post_install(projects_yaml):
'start_dir': '/var/lib/cinder', 'start_dir': '/var/lib/cinder',
'process_name': 'cinder-backup', 'process_name': 'cinder-backup',
'executable_name': '/usr/local/bin/cinder-backup', 'executable_name': '/usr/local/bin/cinder-backup',
'config_file': '/etc/cinder/cinder.conf', 'config_files': ['/etc/cinder/cinder.conf'],
'log_file': '/var/log/cinder/cinder-backup.log', 'log_file': '/var/log/cinder/cinder-backup.log',
} }
@ -644,7 +644,7 @@ def git_post_install(projects_yaml):
'start_dir': '/var/lib/cinder', 'start_dir': '/var/lib/cinder',
'process_name': 'cinder-scheduler', 'process_name': 'cinder-scheduler',
'executable_name': '/usr/local/bin/cinder-scheduler', 'executable_name': '/usr/local/bin/cinder-scheduler',
'config_file': '/etc/cinder/cinder.conf', 'config_files': ['/etc/cinder/cinder.conf'],
'log_file': '/var/log/cinder/cinder-scheduler.log', 'log_file': '/var/log/cinder/cinder-scheduler.log',
} }
@ -655,7 +655,7 @@ def git_post_install(projects_yaml):
'start_dir': '/var/lib/cinder', 'start_dir': '/var/lib/cinder',
'process_name': 'cinder-volume', 'process_name': 'cinder-volume',
'executable_name': '/usr/local/bin/cinder-volume', 'executable_name': '/usr/local/bin/cinder-volume',
'config_file': '/etc/cinder/cinder.conf', 'config_files': ['/etc/cinder/cinder.conf'],
'log_file': '/var/log/cinder/cinder-volume.log', 'log_file': '/var/log/cinder/cinder-volume.log',
} }