Ship YAML file to /usr/share

Ship YAML files except for polling.yaml to /usr/share
so that users can update on upgrade.

Change-Id: I642a5f70d940e3e463d58d4a67fb02a5ff415404
This commit is contained in:
Hanxi Liu 2016-12-19 14:20:12 +08:00
parent 68e5bab1f5
commit d9c11bb0ab
13 changed files with 41 additions and 19 deletions

View File

@ -13,6 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import os
from oslo_config import cfg
from oslo_log import log
from oslo_utils import fnmatch
@ -25,7 +26,10 @@ from ceilometer.i18n import _
OPTS = [
cfg.StrOpt('definitions_cfg_file',
default="event_definitions.yaml",
default=os.path.abspath(
os.path.join(
os.path.split(os.path.dirname(__file__))[0],
"pipeline", "data", "event_definitions.yaml")),
help="Configuration file for event definitions."
),
cfg.BoolOpt('drop_unmatched_notifications',

View File

@ -37,11 +37,17 @@ from ceilometer import sample as sample_util
OPTS = [
cfg.StrOpt('pipeline_cfg_file',
default="pipeline.yaml",
default=os.path.abspath(
os.path.join(
os.path.dirname(__file__),
"pipeline", "data", "pipeline.yaml")),
help="Configuration file for pipeline definition."
),
cfg.StrOpt('event_pipeline_cfg_file',
default="event_pipeline.yaml",
default=os.path.abspath(
os.path.join(
os.path.dirname(__file__),
"pipeline", "data", "event_pipeline.yaml")),
help="Configuration file for event pipeline definition."
),
cfg.BoolOpt('refresh_pipeline_cfg',

View File

@ -186,10 +186,6 @@ class TestBase(test_base.BaseTestCase):
# tests work even if ceilometer is not installed globally on
# the system.
self.CONF.import_opt('pipeline_cfg_file', 'ceilometer.pipeline')
self.CONF.set_override(
'pipeline_cfg_file',
self.path_get('etc/ceilometer/pipeline.yaml')
)
def tearDown(self):
self.conn.clear()

View File

@ -86,7 +86,8 @@ class BinTestCase(base.BaseTestCase):
class BinSendSampleTestCase(base.BaseTestCase):
def setUp(self):
super(BinSendSampleTestCase, self).setUp()
pipeline_cfg_file = self.path_get('etc/ceilometer/pipeline.yaml')
pipeline_cfg_file = self.path_get(
'ceilometer/pipeline/data/pipeline.yaml')
content = ("[DEFAULT]\n"
"transport_url = fake://\n"
"pipeline_cfg_file={0}\n".format(pipeline_cfg_file))

View File

@ -241,10 +241,7 @@ class BaseRealNotification(tests_base.BaseTestCase):
self.CONF.set_override("event_pipeline_cfg_file",
ev_pipeline_cfg_file)
self.CONF.set_override(
"definitions_cfg_file",
self.path_get('etc/ceilometer/event_definitions.yaml'),
group='event')
self.publisher = test_publisher.TestPublisher(self.CONF, "")
def _check_notification_service(self):

View File

@ -204,7 +204,7 @@ class TestDecoupledPipeline(pipeline_base.BasePipelineTestCase):
def _do_test_rate_of_change_in_boilerplate_pipeline_cfg(self, index,
meters, units):
with open('etc/ceilometer/pipeline.yaml') as fap:
with open('ceilometer/pipeline/data/pipeline.yaml') as fap:
data = fap.read()
pipeline_cfg = yaml.safe_load(data)
for s in pipeline_cfg['sinks']:

View File

@ -270,14 +270,14 @@ function _ceilometer_configure_storage_backend {
fi
if [ "$CEILOMETER_BACKEND" = 'mysql' ] || [ "$CEILOMETER_BACKEND" = 'postgresql' ] || [ "$CEILOMETER_BACKEND" = 'mongodb' ]; then
sed -i 's/gnocchi:\/\//database:\/\//g' $CEILOMETER_CONF_DIR/event_pipeline.yaml $CEILOMETER_CONF_DIR/pipeline.yaml
sed -i 's/gnocchi:\/\//database:\/\//g' $CEILOMETER_DIR/ceilometer/pipeline/data/event_pipeline.yaml $CEILOMETER_DIR/ceilometer/pipeline/data/pipeline.yaml
fi
# configure panko
if is_service_enabled panko-api; then
iniadd $CEILOMETER_CONF DEFAULT event_dispatchers panko
if ! grep -q 'panko' $CEILOMETER_CONF_DIR/event_pipeline.yaml ; then
echo ' - direct://?dispatcher=panko' >> $CEILOMETER_CONF_DIR/event_pipeline.yaml
echo ' - direct://?dispatcher=panko' >> $CEILOMETER_DIR/ceilometer/pipeline/data/event_pipeline.yaml
fi
fi
@ -310,8 +310,7 @@ function configure_ceilometer {
# with rootwrap installation done elsewhere and also clobber
# ceilometer.conf settings that have already been made.
# Anyway, explicit is better than implicit.
for conffile in policy.json api_paste.ini pipeline.yaml polling.yaml \
event_definitions.yaml event_pipeline.yaml; do
for conffile in policy.json api_paste.ini polling.yaml; do
cp $CEILOMETER_DIR/etc/ceilometer/$conffile $CEILOMETER_CONF_DIR
done

View File

@ -153,6 +153,20 @@ configuration settings should be added::
If gnocchi dispatcher is enabled, Ceilometer api calls will return a 410 with
an empty result. The Gnocchi Api should be used instead to access the data.
Custom pipeline
===============
The paths of all pipeline files including ``pipeline.yaml`` and ``event_pipeline.yaml``
are located to ceilometer/pipeline/data by default. And it's possible to set the
path through ``pipeline_cfg_file`` being assigned to another one in ``ceilometer.conf``.
Ceilometer allow users to customize pipeline files. Before that, copy the following
yaml files::
$ cp ceilometer/pipeline/data/*.yaml /etc/ceilometer
Then you can add configurations according to the former section.
Efficient polling
=================

View File

@ -114,7 +114,6 @@ Installing the notification agent
to their final location::
$ mkdir -p /etc/ceilometer
$ cp etc/ceilometer/*.yaml /etc/ceilometer
$ cp etc/ceilometer/ceilometer.conf /etc/ceilometer
5. Edit ``/etc/ceilometer/ceilometer.conf``
@ -192,7 +191,6 @@ Installing the Polling Agent
to their final location::
$ mkdir -p /etc/ceilometer
$ cp etc/ceilometer/*.yaml /etc/ceilometer
$ cp etc/ceilometer/ceilometer.conf /etc/ceilometer/ceilometer.conf
5. Configure messaging by editing ``/etc/ceilometer/ceilometer.conf``::

View File

@ -0,0 +1,7 @@
---
other:
- |
Ship YAML files to ceilometer/pipeline/data/ make it convenient
to update all the files on upgrade. Users can copy yaml files from
/usr/share/ceilometer and customise their own files located in
/etc/ceilometer/.