From fc87dd9650de0aea3c75cd75376692209d618378 Mon Sep 17 00:00:00 2001 From: PikachuEXE Date: Tue, 16 Aug 2016 20:44:24 +0800 Subject: [PATCH] Allow specifying human readable value for option `memory_limit` again (#4049) --- lib/ansible/modules/cloud/docker/_docker.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/cloud/docker/_docker.py b/lib/ansible/modules/cloud/docker/_docker.py index 10f8a4fb73a..439f537a6dd 100644 --- a/lib/ansible/modules/cloud/docker/_docker.py +++ b/lib/ansible/modules/cloud/docker/_docker.py @@ -566,6 +566,8 @@ def _human_to_bytes(number): if isinstance(number, int): return number + if number.isdigit(): + return int(number) if number[-1] == suffixes[0] and number[-2].isdigit(): return number[:-1] @@ -1870,7 +1872,7 @@ def main(): volumes_from = dict(default=None, type='list'), links = dict(default=None, type='list'), devices = dict(default=None, type='list'), - memory_limit = dict(default=0, type='int'), + memory_limit = dict(default=0), memory_swap = dict(default=0, type='int'), cpu_shares = dict(default=0, type='int'), docker_url = dict(),