Skip to content

Commit d99a01c

Browse files
authored
Merge pull request #127 from Icinga/fix/el-non-idempotent
Fix non-idenpotence during feature disabling
2 parents 3eee7c0 + c5fd02d commit d99a01c

File tree

3 files changed

+16
-13
lines changed

3 files changed

+16
-13
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
bugfixes:
3+
- Fix non-idenpotence during feature disabling

plugins/action/icinga2_object.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,18 @@ def run(self, tmp=None, task_vars=None):
4343
path = task_vars['icinga2_fragments_path'] + '/' + obj['file'] + '/'
4444
file_fragment = path + obj['order'] + '_' + object_type.lower() + '-' + obj['name']
4545

46-
file_args = dict()
47-
file_args['state'] = 'directory'
48-
file_args['path'] = path
49-
file_module = self._execute_module(
50-
module_name='file',
51-
module_args=file_args,
52-
task_vars=task_vars,
53-
tmp=tmp
54-
)
55-
result = merge_hash(result, file_module)
56-
5746
if obj['state'] != 'absent':
47+
file_args = dict()
48+
file_args['state'] = 'directory'
49+
file_args['path'] = path
50+
file_module = self._execute_module(
51+
module_name='file',
52+
module_args=file_args,
53+
task_vars=task_vars,
54+
tmp=tmp
55+
)
56+
result = merge_hash(result, file_module)
57+
5858
varlist = list() # list of variables from 'apply for'
5959

6060
#

roles/icinga2/tasks/configure.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@
4545
- item.path not in _icinga2_custom_conf_paths
4646

4747
- name: collect empty config dirs
48-
shell: >
49-
find {{ icinga2_fragments_path }} -type d -empty
48+
shell: >-
49+
find {{ icinga2_fragments_path }} -mindepth 1 -type d -empty
5050
register: _empty_result
5151
check_mode: false
5252
changed_when: _empty_result.stdout_lines |length > 0

0 commit comments

Comments
 (0)