Merge lp:~niedbalski/charms/precise/rsyslog-forwarder-ha/fix-no-rel into lp:charms/rsyslog-forwarder-ha

Proposed by Jorge Niedbalski
Status: Merged
Merged at revision: 7
Proposed branch: lp:~niedbalski/charms/precise/rsyslog-forwarder-ha/fix-no-rel
Merge into: lp:charms/rsyslog-forwarder-ha
Diff against target: 60 lines (+16/-6)
2 files modified
README.md (+10/-3)
hooks/hooks.py (+6/-3)
To merge this branch: bzr merge lp:~niedbalski/charms/precise/rsyslog-forwarder-ha/fix-no-rel
Reviewer Review Type Date Requested Status
Matt Bruzek (community) Approve
Review via email: mp+232454@code.launchpad.net

Description of the change

- If no relation data is available, then force a die(), otherwise add the server relation.

To post a comment you must log in.
Revision history for this message
Jorge Niedbalski (niedbalski) wrote :

environment: local
machines:
  "0":
    agent-state: started
    agent-version: 1.20.5.1
    dns-name: localhost
    instance-id: localhost
    series: trusty
    state-server-member-status: has-vote
  "1":
    agent-state: started
    agent-version: 1.20.5.1
    dns-name: 10.0.3.160
    instance-id: niedbalski-local-machine-1
    series: trusty
    hardware: arch=amd64
  "2":
    agent-state: started
    agent-version: 1.20.5.1
    dns-name: 10.0.3.169
    instance-id: niedbalski-local-machine-2
    series: trusty
    hardware: arch=amd64
services:
  mysql:
    charm: cs:trusty/mysql-4
    exposed: false
    relations:
      cluster:
      - mysql
      juju-info:
      - rsyslog-forwarder-ha
    units:
      mysql/0:
        agent-state: started
        agent-version: 1.20.5.1
        machine: "1"
        public-address: 10.0.3.160
        subordinates:
          rsyslog-forwarder-ha/0:
            upgrading-from: local:trusty/rsyslog-forwarder-ha-0
            agent-state: started
            agent-version: 1.20.5.1
            public-address: 10.0.3.160
  rsyslog:
    charm: local:trusty/rsyslog-14
    exposed: false
    relations:
      aggregator:
      - rsyslog-forwarder-ha
    units:
      rsyslog/0:
        agent-state: started
        agent-version: 1.20.5.1
        machine: "2"
        open-ports:
        - 514/tcp
        - 514/udp
        public-address: 10.0.3.169
  rsyslog-forwarder-ha:
    charm: local:trusty/rsyslog-forwarder-ha-0
    exposed: false
    relations:
      juju-info:
      - mysql
      syslog:
      - rsyslog
    subordinate-to:
    - mysql

8. By Jorge Niedbalski

Moved readme to readme.md

Revision history for this message
Matt Bruzek (mbruzek) wrote :

+1 LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== renamed file 'README' => 'README.md'
2--- README 2014-05-02 20:11:28 +0000
3+++ README.md 2014-08-27 22:35:28 +0000
4@@ -1,17 +1,24 @@
5 # General
6
7-This Charm provides support for adding a [rsyslog](http://www.rsyslog.org) forwarder listener to any service
8+This Charm provides support for adding a [rsyslog](http://www.rsyslog.org) forwarder listener to any service
9 in addition this charm allows to have multiple rsyslog aggregators servers offering currently 2 replication
10 modes ( fanout, failover ).
11
12 # Usage method
13
14-This is a subordinate charm, which means it requires to have a service to hook in.
15+This is a subordinate charm, which means it requires to have a service to hook in. On this
16+example we are going to deploy mysql
17
18 ```shell
19 juju deploy mysql
20 ```
21
22+Then you must deploy this charm
23+
24+```shell
25+ juju deploy rsyslog-forwarder-ha
26+```
27+
28 Once your service is running, you can relate this charm:
29
30 ```shell
31@@ -32,7 +39,7 @@
32 juju add-relation rsyslog-forwarder-ha secondary
33 ```
34
35-By default the 'fanout' replication mode is going to be used, which means that all the
36+By default the 'fanout' replication mode is going to be used, which means that all the
37 syslog messages will be forwarder to any aggregator server using UDP port 514.
38
39 In you want to choose to failover mode, this will require that your current
40
41=== modified file 'hooks/hooks.py'
42--- hooks/hooks.py 2014-05-02 19:55:18 +0000
43+++ hooks/hooks.py 2014-08-27 22:35:28 +0000
44@@ -142,10 +142,13 @@
45
46 @hooks.hook()
47 def syslog_relation_joined():
48- relation = relation_id()
49+ try:
50+ relation = relation_id()
51+ except Exception as ex:
52+ die("Cannot get syslog relation id: %s" % ex.message)
53
54- if Server.has_relation(relation_id):
55- die("Relation %s already exists" % relation_id)
56+ if Server.has_relation(relation):
57+ die("Relation %s already exists" % relation)
58
59 server = Server(relation_id=relation,
60 remote_unit=remote_unit(),

Subscribers

People subscribed via source and target branches

to all changes: