Merge "Check mode support for 2 modules"
This commit is contained in:
commit
740d5b46d0
@ -72,14 +72,15 @@ def main():
|
||||
config_data = args['config_data']
|
||||
config_dir = args['config_dir']
|
||||
|
||||
for path, config in config_data.items():
|
||||
# this is specific to how the files are written in config-download
|
||||
mode = config.get('mode', '0600')
|
||||
config_path = os.path.join(config_dir, path)
|
||||
with open(config_path, "w") as config_file:
|
||||
config_file.write(config['content'])
|
||||
os.chmod(config_path, int(mode, 8))
|
||||
results['changed'] = True
|
||||
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')
|
||||
config_path = os.path.join(config_dir, path)
|
||||
with open(config_path, "w") as config_file:
|
||||
config_file.write(config['content'])
|
||||
os.chmod(config_path, int(mode, 8))
|
||||
results['changed'] = True
|
||||
|
||||
module.exit_json(**results)
|
||||
|
||||
|
@ -79,11 +79,12 @@ def main():
|
||||
# Set parameters
|
||||
config_data = args['config_data']
|
||||
|
||||
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'))
|
||||
os.chmod(path, 0o600)
|
||||
results['changed'] = True
|
||||
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'))
|
||||
os.chmod(path, 0o600)
|
||||
results['changed'] = True
|
||||
|
||||
module.exit_json(**results)
|
||||
|
||||
|
@ -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
|
||||
|
@ -45,6 +45,7 @@ scenario:
|
||||
test_sequence:
|
||||
- prepare
|
||||
- converge
|
||||
- check
|
||||
|
||||
verifier:
|
||||
name: testinfra
|
||||
|
@ -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
|
||||
|
@ -45,6 +45,7 @@ scenario:
|
||||
test_sequence:
|
||||
- prepare
|
||||
- converge
|
||||
- check
|
||||
|
||||
verifier:
|
||||
name: testinfra
|
||||
|
Loading…
Reference in New Issue
Block a user