From ec70bb01ef49d3995da323df4ade2fc14df2ad74 Mon Sep 17 00:00:00 2001 From: Hector Acosta Date: Sat, 19 Jul 2014 17:52:35 -0500 Subject: [PATCH] Add check_mode support to authorized_key. Fixes #7300 Signed-off-by: Hector Acosta --- library/system/authorized_key | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/library/system/authorized_key b/library/system/authorized_key index c40edb1f16..f964113127 100644 --- a/library/system/authorized_key +++ b/library/system/authorized_key @@ -388,8 +388,13 @@ def enforce_state(module, params): do_write = True if do_write: + if module.check_mode: + module.exit_json(changed=True) writekeys(module, keyfile(module, user, do_write, path, manage_dir), existing_keys) params['changed'] = True + else: + if module.check_mode: + module.exit_json(changed=False) return params @@ -404,7 +409,8 @@ def main(): state = dict(default='present', choices=['absent','present']), key_options = dict(required=False, type='str'), unique = dict(default=False, type='bool'), - ) + ), + supports_check_mode=True ) results = enforce_state(module, module.params)