Merge "Check mode support for 2 modules"

This commit is contained in:
Zuul 2020-09-30 04:52:20 +00:00 committed by Gerrit Code Review
commit 740d5b46d0
6 changed files with 27 additions and 13 deletions

View File

@ -72,6 +72,7 @@ def main():
config_data = args['config_data']
config_dir = args['config_dir']
if not module.check_mode:
for path, config in config_data.items():
# this is specific to how the files are written in config-download
mode = config.get('mode', '0600')

View File

@ -79,6 +79,7 @@ def main():
# Set parameters
config_data = args['config_data']
if not module.check_mode:
for path, config in config_data.items():
with open(path, "wb") as config_file:
config_file.write(json.dumps(config, indent=2).encode('utf-8'))

View File

@ -14,6 +14,8 @@
content: "#!/bin/bash\npuppet apply"
mode: "0700"
config_dir: "{{ container_config_scripts_tmp_dir.path }}"
when:
- not ansible_check_mode|bool
- name: Check that container_puppet_apply.sh file was created with right permissions
stat:
path: "{{ container_config_scripts_tmp_dir.path }}/container_puppet_apply.sh"
@ -21,9 +23,13 @@
failed_when:
- not st_config.stat.exists
- not (st_config.stat.mode == '0700')
when:
- not ansible_check_mode|bool
- name: Check that container_puppet_apply.sh script is correct
slurp:
src: "{{ container_config_scripts_tmp_dir.path }}/container_puppet_apply.sh"
register: slurp_config
failed_when:
- ('puppet apply' not in slurp_config['content']|b64decode)
when:
- not ansible_check_mode|bool

View File

@ -45,6 +45,7 @@ scenario:
test_sequence:
- prepare
- converge
- check
verifier:
name: testinfra

View File

@ -25,9 +25,13 @@
register: st_config
failed_when:
- not st_config.stat.exists
when:
- not ansible_check_mode|bool
- name: Check that container_config1.json configuration is correct
slurp:
src: "/tmp/container_config1.json"
register: slurp_config
failed_when:
- ('ceilometer-polling' not in slurp_config['content']|b64decode)
when:
- not ansible_check_mode|bool

View File

@ -45,6 +45,7 @@ scenario:
test_sequence:
- prepare
- converge
- check
verifier:
name: testinfra