From 6fdfa5016c261937e31d38977cf6b2fb222f3ffc Mon Sep 17 00:00:00 2001 From: lessmian Date: Tue, 19 Feb 2013 11:33:38 +0100 Subject: [PATCH 1/2] mail module: properly set charset --- mail | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/mail b/mail index db8bf19d38c..5c6faaeb37f 100644 --- a/mail +++ b/mail @@ -94,6 +94,11 @@ options: default: null required: false version_added: "1.0" + charset: + description: + - The character set of email being sent + default: 'us-ascii' + requred: false examples: - description: "Example playbook sending mail to root" code: "local_action: mail msg='System ${ansible_hostname} has been sucessfully provisioned.'" @@ -109,6 +114,7 @@ examples: cc="Charlie Root " attach="/etc/group /tmp/pavatar2.png" headers=Reply-To=john@example.com|X-Special="Something or other" + charset=utf8 """ import os @@ -144,6 +150,7 @@ def main(): body = dict(default=None), attach = dict(default=None), headers = dict(default=None), + charset = dict(default='us-ascii') ) ) @@ -157,6 +164,7 @@ def main(): body = module.params.get('body') attach_files = module.params.get('attach') headers = module.params.get('headers') + charset = module.params.get('charset') sender_phrase, sender_addr = parseaddr(sender) @@ -206,7 +214,7 @@ def main(): if len(cc_list) > 0: msg['Cc'] = ", ".join(cc_list) - part = MIMEText(body + "\n\n") + part = MIMEText(body + "\n\n", _charset=charset) msg.attach(part) if attach_files is not None: From 2366654c26ed5e11639de18f79967dff79e4084f Mon Sep 17 00:00:00 2001 From: lessmian Date: Tue, 19 Feb 2013 15:45:08 +0100 Subject: [PATCH 2/2] sysctl module: fixed issue when checks_after fail on comparing keys with values separated by white strings --- sysctl | 1 + 1 file changed, 1 insertion(+) diff --git a/sysctl b/sysctl index c1f34f4f808..9b2cbebfa51 100644 --- a/sysctl +++ b/sysctl @@ -189,6 +189,7 @@ def sysctl_check(current_step, **sysctl_args): output = f.read() f.close() output = output.strip(' \t\n\r') + output = re.sub(r'\s+', ' ', output) # multi positive integer values separated by spaces as described in issue #2004 : if re.search('^([\d\s]+)$', sysctl_args['value']):