From f6380d7393e3e8f3eb2c02dffe4cdcb8f34864c4 Mon Sep 17 00:00:00 2001 From: "yolanda.robla@canonical.com" <> Date: Wed, 13 Feb 2013 17:04:56 +0100 Subject: [PATCH] added ceilometer-agent relationship --- hooks/ceilometer-service-relation-changed | 1 + hooks/ceilometer-service-relation-joined | 1 + hooks/hooks.py | 24 ++++++++++++++++++++++- metadata.yaml | 2 ++ revision | 2 +- 5 files changed, 28 insertions(+), 2 deletions(-) create mode 120000 hooks/ceilometer-service-relation-changed create mode 120000 hooks/ceilometer-service-relation-joined diff --git a/hooks/ceilometer-service-relation-changed b/hooks/ceilometer-service-relation-changed new file mode 120000 index 0000000..9416ca6 --- /dev/null +++ b/hooks/ceilometer-service-relation-changed @@ -0,0 +1 @@ +hooks.py \ No newline at end of file diff --git a/hooks/ceilometer-service-relation-joined b/hooks/ceilometer-service-relation-joined new file mode 120000 index 0000000..9416ca6 --- /dev/null +++ b/hooks/ceilometer-service-relation-joined @@ -0,0 +1 @@ +hooks.py \ No newline at end of file diff --git a/hooks/hooks.py b/hooks/hooks.py index f26faa6..ea879ed 100755 --- a/hooks/hooks.py +++ b/hooks/hooks.py @@ -104,6 +104,26 @@ def keystone_changed(): if render_ceilometer_conf(): utils.restart(*ceilometer_utils.CEILOMETER_SERVICES) +def ceilometer_joined(): + pass + +def ceilometer_changed(): + # check if we have rabbit and keystone already set + context = get_rabbit_conf() + contextkeystone = get_keystone_conf() + + if context and contextkeystone: + context.update(contextkeystone) + context['metering_secret'] = ceilometer_utils.get_shared_secret() + + utils.relation_set(metering_secret=context['metering_secret']) + utils.relation_set(rabbit_host=context['rabbit_host'], rabbit_virtual_host=context['rabbit_virtual_host'], rabbit_userid=context['rabbit_userid'], rabbit_password=context['rabbit_password']) + utils.relation_set(keystone_os_username=context['keystone_os_username'], keystone_os_password=context['keystone_os_password'], keystone_os_tenant=context['keystone_os_tenant'], + keystone_host=context['keystone_host'], keystone_port=context['keystone_port']) + else: + # still waiting + utils.juju_log("INFO", "ceilometer: rabbit and keystone credentials not yet received from peer.") + utils.do_hooks({ "install": install, "amqp-relation-joined": amqp_joined, @@ -112,6 +132,8 @@ utils.do_hooks({ "shared-db-relation-changed": db_changed, "config-changed": config_changed, "identity-service-relation-joined": keystone_joined, - "identity-service-relation-changed": keystone_changed + "identity-service-relation-changed": keystone_changed, + "ceilometer-service-relation-joined": ceilometer_joined, + "ceilometer-service-relation-changed": ceilometer_changed }) sys.exit(0) diff --git a/metadata.yaml b/metadata.yaml index 793f1f6..1259c90 100644 --- a/metadata.yaml +++ b/metadata.yaml @@ -10,6 +10,8 @@ description: | provides: endpoint: interface: http + ceilometer-service: + interface: ceilometer requires: shared-db: interface: mongodb diff --git a/revision b/revision index 8f92bfd..7facc89 100644 --- a/revision +++ b/revision @@ -1 +1 @@ -35 +36