Merge lp:~wesmason/charms/trusty/conn-check/trunk-use-bool into lp:~ubuntuone-hackers/charms/trusty/conn-check/trunk

Proposed by Wes Mason
Status: Merged
Approved by: Wes Mason
Approved revision: 35
Merged at revision: 35
Proposed branch: lp:~wesmason/charms/trusty/conn-check/trunk-use-bool
Merge into: lp:~ubuntuone-hackers/charms/trusty/conn-check/trunk
Diff against target: 47 lines (+3/-14)
2 files modified
filter_plugins/is_true.py (+0/-11)
playbook.yaml (+3/-3)
To merge this branch: bzr merge lp:~wesmason/charms/trusty/conn-check/trunk-use-bool
Reviewer Review Type Date Requested Status
Matt Goodall (community) Approve
Review via email: mp+258849@code.launchpad.net

Commit message

Remove custom is_true filter and use inbuilt bool

Description of the change

Switch custom is_true() filter for Ansible's inbuilt bool() filter [1].

[1] http://docs.ansible.com/playbooks_filters.html#other-useful-filters

To post a comment you must log in.
Revision history for this message
Matt Goodall (matt-goodall) wrote :

lgtm

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== removed directory 'filter_plugins'
2=== removed file 'filter_plugins/is_true.py'
3--- filter_plugins/is_true.py 2015-04-29 10:05:56 +0000
4+++ filter_plugins/is_true.py 1970-01-01 00:00:00 +0000
5@@ -1,11 +0,0 @@
6-class FilterModule(object):
7-
8- def filters(self):
9- return {
10- 'is_true': self.is_true,
11- }
12-
13- def is_true(self, s):
14- # We need this for testing ansible playbook flags, as they're passed
15- # through as strings rather than the actual bool value
16- return bool(str(s).strip().lower() == 'true')
17
18=== modified file 'playbook.yaml'
19--- playbook.yaml 2015-04-28 21:43:53 +0000
20+++ playbook.yaml 2015-05-12 09:10:19 +0000
21@@ -66,7 +66,7 @@
22 content: "{{ relations['conn-check'][0]['config'] }}"
23 dest: "{{ config_path }}"
24 mode: 0600
25- when: not (path_provided | is_true) and (config_provided | is_true)
26+ when: not (path_provided | bool) and (config_provided | bool)
27
28 - name: Write nagios check command config.
29 tags:
30@@ -79,7 +79,7 @@
31 owner: nagios
32 group: nagios
33 mode: 0644
34- when: (nagios_enabled | is_true) and (config_or_path_provided | is_true)
35+ when: (nagios_enabled | bool) and (config_or_path_provided | bool)
36
37 - name: Write nagios check service definition for export.
38 tags:
39@@ -92,7 +92,7 @@
40 owner: nagios
41 group: nagios
42 mode: 0644
43- when: (nagios_enabled | is_true) and (config_or_path_provided | is_true)
44+ when: (nagios_enabled | bool) and (config_or_path_provided | bool)
45
46 # We only need user/group for the run-check action, as the Nagios user executes checks above
47 - name: create group

Subscribers

People subscribed via source and target branches

to all changes: